I have an at89C4051 chip attached to the PC serial port via 3V conversion. The reason for this is because eventually I'll connect to a radio module instead of PC and the radio module won't work past 3.9V.
When its time to output data to the serial port, I set R4 to equal #OUTPUTCHAR and accumlator high nibble to the data itself. R2 represents the sequence number from 0 to 15 to sync the data and is always supposed to count from 0 to 15 then reset to 0 and repeat that counting pattern on every call to the code.
Now when I call another function to collect data inputted from the serial port, I notice that my output data continuously skips sequence 1.
This is example of data transmitted to the PC that's ok:
and this is bad data after calling the function to collect serial data:
IR2 is R2's address. If I modify the location of IR2, or R2, then R2 is modified.
The strange thing is, I never modified the contents of the above in any other function, so the only thing that comes to my mind is that 57.6kbps baud is too high for a 22.1184Mhz crystal?
Is there another thing that could cause such skipping?
When its time to output data to the serial port, I set R4 to equal #OUTPUTCHAR and accumlator high nibble to the data itself. R2 represents the sequence number from 0 to 15 to sync the data and is always supposed to count from 0 to 15 then reset to 0 and repeat that counting pattern on every call to the code.
Now when I call another function to collect data inputted from the serial port, I notice that my output data continuously skips sequence 1.
This is example of data transmitted to the PC that's ok:
10 41 32 23 34 45 46 47 58 49 6a 4b 7c 4d 8e 4f
and this is bad data after calling the function to collect serial data:
1f 10 32 23 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
IR2 is R2's address. If I modify the location of IR2, or R2, then R2 is modified.
The strange thing is, I never modified the contents of the above in any other function, so the only thing that comes to my mind is that 57.6kbps baud is too high for a 22.1184Mhz crystal?
cjne R4,#OUTPUTCHAR,nooutc
cjne R2,#3h,sudest1
mov A,MEL ;MEL=20h
sudest1:
cjne R2,#2h,sudest2
mov A,MEH ;MEL=30h
sudest2:
orl A,R2
clr TI
mov SBUF,A
inc R2
anl IR2,#0Fh
jnb TI,$
nooutc:
Is there another thing that could cause such skipping?