Discussion in "AVR Discussion Forum" started by    ece    Mar 13, 2008.
Thu Mar 13 2008, 10:27 am
#1
we are working on project controlling of stepper motor through AVR microcontroller using serial communication.in that as a part of testing we are to transmit any one bit data and receive same bit.we are using AVR STUDIO4 software.pls guide us with instruction of serial communication as soon as possible
Thu Mar 13 2008, 02:42 pm
#2
check AVR serial tutorial
Thu Mar 13 2008, 04:45 pm
#3
we have already gone through it and we made program by reffering that but it is not working for transmitting and receiving a bipls,send proper program for that.
Thu Mar 13 2008, 10:47 pm
#4
which AVR you are using?
Mon Mar 17 2008, 11:12 am
#5
AT MEGA32.
Mon Mar 17 2008, 03:37 pm
#6
actualy we have to send and recieve a bit through port D of AT MEGA32 i.e on port D.0 and port D.1 we are not getting wat to do for program how to write.pls guide
Mon Mar 17 2008, 11:43 pm
#7
why D.0 and D.1 ?? you can do it on any pin... just send them/ receive serially
Tue Mar 18 2008, 12:48 am
#8
abbas, PD.0 is RXD and PD.1 is TXD..

can i see your code ece..?
Tue Mar 18 2008, 10:51 am
#9
Here is our program.pls check it and make the necessary changes.

.include"m32def.inc"
.def reg1= r16
.def reg2=r17
.def reg3=r18
.def reg4=r19
Serial_Init:

ldi reg1,00
out UBRRH,reg1
LDI reg1,25
OUT UBRRL,reg1

ldi reg4,( 1<<RXEN)|(1<<TXEN)
out UCSRB,reg4
//ldi reg1,00
ldi reg1,(1<<URSEL)+(1<<USBS)+(3<<UCSZ0)
OUT UCSRC,reg1

//sbi UCSRA,RXC

USART_Transmit:


sbis UCSRA,UDRE
rjmp USART_Transmit
ldi reg1,0XFF
out UDR,reg1

sbi UCSRA,TXC

USART_Receive:
sbis UCSRA,RXC
rjmp USART_Receive
in reg3,UDR
out PORTA,reg3

ret


[ Edited Tue Mar 25 2008, 12:11 pm ]
Tue Mar 18 2008, 09:36 pm
#10
What clock are you using?

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

NaKrutkADamb
Wed May 15 2024, 12:03 am
MichaelGot
Tue May 14 2024, 04:08 pm
FrankTrelm
Tue May 14 2024, 10:39 am
BillyTum
Tue May 14 2024, 09:08 am
Loganbag
Tue May 14 2024, 04:05 am
MichaelMog
Tue May 14 2024, 03:58 am
ThomasGaxaW
Mon May 13 2024, 05:33 pm
RobertInfup
Mon May 13 2024, 04:28 pm