Hi,
Can someone please tell me what I am doing wrong.
I want to DEGUGIN a character and branch according to its value.
However, typing any character causes a reset!!
Thank you
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ LIST P=PIC16F648A
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF & _BODEN_ON & _PWRTE_ON
DEFINE OSC 04
Define DEBUG_REG PORTB
Define DEBUG_BIT 5
define DEBUG_BAUD 9600
Define DEBUG_MODE 1
Define DEBUGIN_REG PORTB
Define DEBUGIN_BIT 4
Define DEBUGIN_BAUD 9600
Define DEBUGIN_MODE 1
x var byte
CR con $0D 'Carriage Return
LF con $0A 'Line Feed
Start: CMCON = 7
PortA = 0:TRISA = 0
PortB = 0:TRISB = 0
PIR1 = 0
PIE1 = 0
clear
pause 500
debug "We are alive...",cr,lf ' Say hello
pause 500
TestLoop: debug "Enter A or B "
debugin 20000,NoReply,[x] ' wait 20 seconds reply
debug x,cr,lf 'echo back
if x="A" then debug "AAAAAAAA",cr,lf
if x="B" then debug "BBBBBBBB",cr,lf
pause 500
goto TestLoop
NoReply: debug "TimeOut...",cr,lf
pause 500
goto TestLoop
end
Bookmarks