- This topic has 3 replies, 3 voices, and was last updated 12 years, 7 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
|
Microcontroller › AVR › Sending data serially to pc
Hello,
i am new to AVR. Currently working on Atmega16. I want to transmit data with maximum possible rate to PC serially.
Getting help from avr book by mazidi, i have written the following code for my controller.
LDI R16,(1<<TXEN)
OUT UCSRB, R16
LDI R16,(1<<UCSZ1)|(1<<UCSZ0)|(1<<URSEL)
OUT UCSRC, R16
LDI R16, 0x33
OUT UBRRL,R16
AGAIN:
LDI R17,’Y’
CALL TRNSMT
LDI R17,’E’
CALL TRNSMT
LDI R17,’S’
CALL TRNSMT
LDI R17,’ ‘
CALL TRNSMT
RJMP AGAIN
TRNSMT:
SBIS UCSRA,UDRE
RJMP TRNSMT
OUT UDR,R17
RET
The fuse bits are set to high byte D9 low byte FF
i am using 8 Mhz crystal with 22 capacitor.
I have tried a lot but not receiving data on the hyperterminal, pls guide me.
Also connecting the osciloscope probe on the txd pin pulses are seen there.
Thanks
Gulham,
Using osciloscope, check the data at tx pin of MAX232. If you find data at tx pin of MAX232, there might be some thing wrong in baudrate. Try lowering the baudrate.
have you did the loopback test with your serial port of pc? connect a db9 connector, short pin 2 and 3, type something and the same should be received in hyperterminal