samam
- 29th June 2006, 00:03
I'm having trouble using the SEROUT2 command with some of the newer PIC parts. I've compiled and programmed the following code onto both the 18F258 and the 18F2585. Everything works as expected for the 18F258 but the SEROUT2 command doesn't seem to do anything for the 18F2585. Probing with an oscilloscope shows no activity at the pin. I've had similar problems using the SEROUT2 command with other newer parts including the 18F2525,18F2550.
DEFINE OSC 20
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 19200
TRISC = %10000000
LED0 VAR PORTC.4
LED1 VAR PORTC.5
LED0 = 0
LED1 = 0
LOOP:
HSEROUT [254,84,254,88]
SEROUT2 PORTC.0,32,[254,84,254,88]
LED0 = 1
LED1 = 0
PAUSE 500
HSEROUT [254,72,"HARDWARE SERIAL OUT"]
SEROUT2 PORTC.0,32,[254,72,"SOFTWARE SERIAL OUT"]
LED0 = 0
LED1 = 1
PAUSE 500
GOTO LOOP
END
DEFINE OSC 20
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 19200
TRISC = %10000000
LED0 VAR PORTC.4
LED1 VAR PORTC.5
LED0 = 0
LED1 = 0
LOOP:
HSEROUT [254,84,254,88]
SEROUT2 PORTC.0,32,[254,84,254,88]
LED0 = 1
LED1 = 0
PAUSE 500
HSEROUT [254,72,"HARDWARE SERIAL OUT"]
SEROUT2 PORTC.0,32,[254,72,"SOFTWARE SERIAL OUT"]
LED0 = 0
LED1 = 1
PAUSE 500
GOTO LOOP
END