Andrew Cowan
Senior Member
I'm having some problems with serial communication.
The (largely simplified) setup is the output of a 20M outputting serial data at N4800 baud. This data is then received by a 28X2.
The code running on the 20M is: serout pin,N4800,(b1,b2,b3,b4,b5)
And the code on the 28X2: serin pin,N4800,b1,b2,b3,b4,b5
However, the code in the 28X2 would always get stuck at the serin - it seemed to never receive all the data.
Eventually I found the problem - this was an initial test, and all the variables being transmitted were zero. Changing the variables to other numbers made the system work.
I assumed that the problem was that 0 (%00000000) means the data line never goes high, thus the 28X2 never realises data is being sent. However, the manual refers to stop bits (and I presume there is a start bit) - should this not tell the 28X2 there is data? Is it possible to transfer a string of zeros via serial? The values of the variables could be anything, so it needs to be able to cope with zero.
Any ideas of why this didn't work?
Many thanks
Andrew
The (largely simplified) setup is the output of a 20M outputting serial data at N4800 baud. This data is then received by a 28X2.
The code running on the 20M is: serout pin,N4800,(b1,b2,b3,b4,b5)
And the code on the 28X2: serin pin,N4800,b1,b2,b3,b4,b5
However, the code in the 28X2 would always get stuck at the serin - it seemed to never receive all the data.
Eventually I found the problem - this was an initial test, and all the variables being transmitted were zero. Changing the variables to other numbers made the system work.
I assumed that the problem was that 0 (%00000000) means the data line never goes high, thus the 28X2 never realises data is being sent. However, the manual refers to stop bits (and I presume there is a start bit) - should this not tell the 28X2 there is data? Is it possible to transfer a string of zeros via serial? The values of the variables could be anything, so it needs to be able to cope with zero.
Any ideas of why this didn't work?
Many thanks
Andrew