Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help with ATmega8L USART compare

Status
Not open for further replies.

MaiGoL7

Newbie level 3
Joined
Dec 18, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,314
Hi, I'm developing a program about RF positioning.
I have a main base and three bases located in a known area.
What a partner did before was that every base sent a value to the main one every X ms (no overlap with the other bases). And it worked "fairy" well. (The guy had to activate/deactivate the 3 bases).
The question now is that we want to improve that system using the main base to give priority to each base.

So what I want to do is compare the RXD(PD0) value that may be the data sent by the main base, '1','2' or '3' depending on the priority; and if the comparison is good, return data to the main base again.

Im doing the code in assembly.

Also I'm uploading a pic "trying" to explain it.

Thanks!

pic.jpg

PS: the bases that do not send back the data, dont need to use the TXD(PD1) until the next comparison is good.

PS2: i forget about the imporant part, im using 8data and 2stop.

Code:
USART_Transmit:
; Wait for empty transmit buffer
sbis UCSRA,UDRE
rjmp USART_Transmit
; Put data (r16) into buffer, sends the data
out UDR,r16
ret

Code:
USART_Receive:
; Wait for data to be received
sbis UCSRA, RXC
rjmp USART_Receive
; Get and return received data from buffer
in r16, UDR
ret
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top