EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies /  Hi, this is what I m doing

 Hi, this is what I m doing

|

Microcontroller › AVR › How to interface fingerprint module serially with AVR ›  Hi, this is what I m doing

April 26, 2011 at 9:47 am #6035
usman
Participant

 

Hi, this is what I m doing but unsuccessful…  :-(
 
#define USART_BAUDRATE 57600
#define F_CPU 8000000
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16))) – 1)
 
 
//this is the packet i want to transmit. I have define the array as:
char GenImg[12] = { 0xEF, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x03, 0x01, 0x00, 0x05 };
 
 
//I have called in the main these functions:
usart_init();
_delay_ms(500);
_delay_ms(500);
send_bytes(GenImg,12);
 
 
//this function is for “initialization of usart”:
void usart_init()
{
 
UCSRB |= (1 << RXEN) | (1 << TXEN);   // Turn on the transmission and reception circuitry
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); 
// Use 8-bit character sizes
UCSRC &= ~(1 << UMSEL); // In UCSRC, UMSEL = 0 for asynchronous
UCSRC &= ~(1<<USBS); //In UCSRC, USBS = 0 => 1 stop bit
 
UBRRL = BAUD_PRESCALE; 
// Load lower 8-bits of the baud rate value into the low byte of the UBRR register
UBRRH = (BAUD_PRESCALE >> 8); // Load upper 8-bits of the baud rate value..
// into the high byte of the UBRR register
}
 
 
//this is function for transmitting:
void send_bytes(char *s, int length)
{
while (length–)
{
usart_transmit(*s);
s++;
}
}
 
 
void usart_transmit(unsigned char c)
{
while(!(UCSRA & (1 << UDRE))); // wait until UDR ready
UDR = c; // send character
}
 
 
Please help me to correct any errors!

RSS feed: Recent Posts Recent Posts

  • Speed control on power tools... October 8, 2026
  • How much does generator frequency stability matter for sensitive electrical equipment? October 7, 2026
  • Curiosity is difficult. October 6, 2026
  • On off switch hack October 6, 2026
  • DBT alternative idea October 4, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 Arrowfly LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of Arrowfly
Privacy Policy | Advertising

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise