This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

code for connecting two 8051 each to AT-XTR-903-A9

I would be so greatful if anyone could help me in providing me a code for the following situation.

I have two 8051 micros each connected to XTR-903 Transceiver. The freq. used is 433MHz and baudrate is 9600. I have managed to write an assembly code to Transmit from one micro and receive on the other micro.
The problem i'm facing now is when I want to transmit and rceieve on each micro, that is when the first micro finishes transmitting, I need it to switch to receiving mode and vice versa and when the second micro receives it should switch itself to transmit mode and vice versa
I tried to have a button and an LED connected to each micro so that when button1 is pressed, micro1 sends a character "A" for example to Micro2 which turns on an LED.
Then when button2 which is attached to micro2 is pressed, micro2 would send a character "A" to micro1 which then switches an LED on micro1 side and so on.
Kindly, if anyone can help would be so much appreciated.

Thanks
Amjed

Parents Reply Children
  • Yes, the assembly code I wrote was good enough for a simplex communication, Transmit on one side and receive on the other side. What I need is basically a half duplex communication, after the transceiver finishes transmitting it should switch to receive mode and the same applies for the other side, after receiving it switches to transmitt mode. How to code in assembly for the 8051 is the difficulty i'm facing.

    Thanks
    Amjed

  • If the radio unit supports both receive and transmit, then your transmit side should wait a tiny bit after polling that the transmitter is empty, or receiving the last transmit interrupt. Then switch to receive mode.

    The receiving side should wait a longer time before switching the radio unit to transmit and starting to send out data.

    Both sides should have logic so that if you loose the communication, then you should either have decided that one side is master and responsible for sending out regular "ping" followed by listen until contact is reestablished. Or you may go for something more advanced, where all micros are symmetric but then you should either give them an ID or find a good way to create random delays in read mode before switching to transmit mode and sending a ping.

  • Well, what is happening is that when the transceiver on micro1 is in transmitting mode and ready to switch to receive mode, it looks like the transceiver on the other micro2 must first switch to transmit mode first before the transceiver on micro1 changes to receive mode. That is to change from one mode to another the two transceivers must go through the transition where both be in transmit mode first then a change of mode can take place and that what is making it difficult.
    I wish someone who had experience with this type of transceiver from ABACOM could help us in writing the assembly code with the 8051.

    Thanks
    Amjed