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!
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