I have been experiencing strange behaviour with Serout. The short version is this: I have a number of Serout commands (to hyperterminal on my laptop) in my code and my 16f88 would always skip the first Serout and start with the second Serout.
Here's an example of what I see on my laptop:
This is a test 2
This is a test 3
This is a test 4
etc....
When it should read:
This is a test 1
This is a test 2
This is a test 3
etc...
I added the huge pause thinking that it might 'settle down' the pic. It didn't.
I'm running a 1k resistor between the serout pin and the Com1 port on the laptop.
Here's an example of the code:
Include "modedefs.bas"
@ __config _config1, _INTRC_IO & _WDT_OFF & _MCLR_OFF & _LVP_OFF
'Interal Oscillator, WDT off, MCLR off, LVP off
'For use with Microchip Assembler
Define OSC4
i VAR Byte
OSCCON = %01101000 'OSC4, internal
'DEFINE CHAR_PACING 1000 'For leaving slight spacing between Serout characters
CMCON = 7 'Comparators Off
' Set the port directions
' 0=output 1=input
TRISA = %11111111 'Need to set A.0 as Input
TRISB = %11111011 'Set B.2 as output
ANSEL = %00000000 ' Set digital
Pause 5000
i = 0
for i = 1 to 10
High PortB.1 'Turn on LED
Pause 1000
Low PortB.1 'Turn off LED
Pause 1000
Serout PortB.2,N2400,["This is a test ", #i,10,13]
Pause 500
Next i
END
Bookmarks