PICBASIC PRO program displays to 3 x 7 segments LED display the result of pulse count on PORTA.4 pin/sec. Based on a 16F84A. Schematic included. Written by Steve Monfette counter.zip |
By lowering the baud rate you're now allowing device B (and SERIN2) twice the time to receive the bits and assemble the byte.
That's probably what's helping a lot more than any line noise issue.
...
Tumbleweed, I had very strong suspicions that the issues were in the communication lines. I changed the Baud rate from 19200 to 9600 and I haven't got anymore wrong data at the receiver. I remember...
rsocor01 - 22nd April 2024, 22:35Ioannis, yes I'm doing data validation checks all the time. The first byte of the array is always 174. If this condition is not met, then the reading is discarded.
rsocor01 - 22nd April 2024, 22:26Just to correct myself in #9...
At 19200 baud each bit should be 52us +/-1.5us, give or take (about 3%).
I was thinking byte times, not bit times.
As Richard noted, the problem could be in any other part of your code. So you are alone on this as we cannot guess what may be happening there.
However, the part you posted does not somehow checks...
'Code at device A, PIC18F4550
SendData:
pause 5
SEROUT2 PORTB.7,32,[STR RFID_IN\7]
goto SendData
You're only allowing device B 5ms between transfers to receive the data and display...
alone, until you provide at least a minimal, complete and verifiable example [MCVE]
posting useless snippets is a good example of a worthless bad example
my guess for the nearest to the pot...
There is no much code to show here. I know device A is sending the right data because I can see it with a logical analyzer. I know device B, like 1 out of 5 times, is reading some bytes wrong because...
rsocor01 - 21st April 2024, 02:51Your best shot would be to post your code...
Ioannis
PICBASIC PRO program displays to 3 x 7 segments LED display the result of pulse count on PORTA.4 pin/sec. Based on a 16F84A. Schematic included. Written by Steve Monfette counter.zip |
Re: SERIN2 Receiving Wrong Data
There is probably a little bit of both. I did a search in the forum, but couldn't find anyone having the same issue.
rsocor01 Yesterday, 23:22