Below is the code that is causing the grief. It is evidently not a 2k barrier problem but has to do with the SEROUT2 command. If I run the simple code shown below, the HyperTerminal shows:
I:
J:
If I then get rid of the second SEROUT2 command, the Hyperterminal shows:
I: 4
I: 56
It appears that the timeout, label of the second SEROUT2 command destroys the variable. Although I am not using the second SEROUT2 command, it's presense seems to effect the variables.
I would be curious if you tried this yourself. It's either a bug or a possible problem with using PORTA pins of the 16F876.
Kind Regards,
Eric
DEFINE OSC 20 ' define oscillator to be 20Mhz
ADCON1 = 7 ' set the analog pins to digital
' serial connections
RX VAR PORTA.3 ' receive (from PC)
TX VAR PORTA.2 ' transmit (to PC)
CTS VAR PORTA.1 ' clear to send
RTS VAR PORTA.0 ' request to send
' General variables
I VAR byte ' general variable
J var byte
BaudRate var word
'Baud rate constants
Baud96 CON 16468 ' 9.6K baud rate
'1. set baud rate to 38400
BaudRate = Baud96
I = 4
J = 56
Main:
pause 1000
SEROUT2 TX, BaudRate,["I: ", DEC I, 13, 10,"J: ", DEC J, 13, 10]
goto Main
SEROUT2 TX\CTS, BaudRate, 200, NoData, ["Test"]
NoData:
Goto Main
Bookmarks