Here is the PIC code. I am sending the data as a string from a TextBox in Visual Basic. By the way, the "END" is returned as "ÅND" if this gives any further clues!
@ DEVICE HS_OSC,LVP_OFF,WDT_OFF,PROTECT_OFF,BOD_OFF,PWRT_OF F
'declare variables
define OSC 20
DEFINE HSER_BAUD 19200 'serial
DEFINE HSER_RCSTA 90h 'serial
DEFINE HSER_TXSTA 24h 'serial
DEFINE HSER_CLROERR 1 ' automatic clear overrun error
DEFINE HSER_EVEN 1
DEFINE HSER_BITS 7
trisb = %11000000 ' set port b 0-5 o/ps 6&7 i/ps
RCIF VAR PIR1.5
SERIALDATA VAR BYTE
portb.0 = 0
portb.1 = 0
portb.2 = 0
portb.3 = 0
PAUSE 100
MAIN:
portb.0 = 0
IF RCIF THEN
pause 100
sound portb.0,[60,10]
HSERIN [SERIALDATA] 'RCIF is reset by reading HSERIN
HSEROUT [SERIALDATA,"E","N","D"]
ENDIF
GOTO MAIN
end
Bookmarks