I'm using a PIC18f26k80 chip with a RS 485 ( sn65hvd75 ) communication between a master and its 2 slaves.
We are trying to send characters of USART and lighting up LEDs when the slaves received the correct characters.
We have tested a system where the master sends out an ID number and each slave receives that number, and if it is their ID, they echo back their ID.
The master iterates through all the node IDs, either turning on a light if it worked and turning on another light if it didnt work.
We have tested this and we know it works.
Next we had the master send out a string "ns=9" (broadcasting)
using this format:
While(!Data1Rdy());
high = getc1USART();
if(high == 'n')
turn on LED 1
and so on. ---All LEDs turns on, so we know we got all the characters on both modules
Then we do the same thing above, and it works as well.
Now we are trying to send data to the Master, and the master isnt receiving anything.
First our master sends out the ID number of the first node
if the id number matches that certain slave's node number, it sends back its ID number like before,
and then it sends back one single character:
we use this set up:
while(Busy1USART());
Write1USART('A');
//we've also tried 65, data = 'A' Write1USART(data) and so on)
on the master side, we wait for data to be ready and receive
While(!Data1Rdy());
high = getc1USART();
if(high == 'A')
turn on LED 1
and we get the node ID, completely fine, but we dont get the letter A.
In fact, through precarious LED changing and blinking we dont even get past that DataRDY while loop.
We have also sent the character 'n' 10 times, and it only got back 9, and so on.
Could it be syncing issues? How often do we need to clear the Rx buffer?
(sorry about all the PIC code, the microchip forums arnt very useful)