Hi,
I wrote the following code:
Code:
Main:
HIGH LED_RED
LOW LED_GREEN
pause 500
;Common setup
SPBRG = 129 ;Baud rate 9600
TXSTA.2 = 1 ;BRGH for hight speed
TXSTA.4 = 0 ;USART coomunication
RCSTA.7 = 1 ;Serial enable
;Tx setup
PIE1.4 = 0 ;
TXSTA.6 = 0 ;8 bit
;Rx setup
PIE1.5 = 1
RCSTA.6 = 0
RCSTA.4 = 1
RCSTA.2 = 0
RCSTA.1 = 0
HIGH LED_GREEN
LOW LED_RED
Ever:
;BUTTON switch, 1, 0, 100, button_count, 1, Rx_command
Hserout ["I wait"]
hserin [WAIT("MR")]
HIGH LED_RED
PAUSE 500
low LED_RED
GOTO Ever
The first time posting on the serial "MR,00,0000,CR" works fine, but then the second time does not work anymore. Advise anyone know any solution?
Bookmarks