list p=18F1320
include <p18f1320.inc>
;CONFIG OSC=INTIO2,WDT=OFF,MCLRE=ON,LVP=OFF
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF, DEBUG = ON
cblock 0x00
buff2,buff3,char,numr,bitnum,loop1,loop2,temp1,temp2
endc
org 0x0000
goto init
hello db 0x0d,0x0a,"Hello World!",0x0d,0x0a,0x00
pa_val db 0x0d,0x0a,"PortA = ",0x00
pb_val db 0x0d,0x0a,"PortB = ",0x00
string3 db 0x0d,0x0a,"PORTA cleared",0x0d,0x00
string4 db 0x0d,0x0a,"PORTB cleared",0x0d,0x00
string5 db 0x0d,0x0a,"RA1 toggled",0x0d,0x00
string6 db 0x0d,0x0a,"RA4 toggled",0x0d,0x00
string7 db 0x0d,0x0a,"RA6 toggled",0x0d,0x00
string8 db 0x0d,0x0a,"RA7 toggled",0x0d,0x00
string9 db 0x0d,0x0a,"RB0 toggled",0x0d,0x00
stringa db 0x0d,0x0a,"RB2 toggled",0x0d,0x00
stringb db 0x0d,0x0a,"RB3 toggled",0x0d,0x00
stringc db 0x0d,0x0a,"RB5 toggled",0x0d,0x00
stringd db 0x0d,0x0a,"LEDs flashed",0x0d,0x00
stringe db 0x0d,0x0a,"RA3 toggled",0x0d,0x00
stringf db 0x0d,0x0a,"Please Enter Code:",0x0d,0x00 ;[b] Happened when i added this line [/b]
menu db 0x0d,0x0a,0x0d,0x0a,"Junebug PIC18F1320",0x0d,0x0a,0x0d,0x0a
db " A - PORTA Status",0x0d,0x0a
db " B - PORTB Status",0x0d,0x0a
db " C - Clear PORTA bits 1,2,3,4,6,7",0x0d,0x0a
db " D - Clear PORTB bits 0,5",0x0d,0x0a
db " H - Hello World!",0x0d,0x0a
db " L - Flash LEDs",0x0d,0x0a
db "1,2,3,4,6,7 - Toggle PORTA pins ",0x0d,0x0a
db "0,5 - Toggle PORTB pins ",0x0d,0x0a
db "<ENTER> - Display menu",0x0d,0x0a
db "Modded by Jason aka AtomSoft, thx futz!",0x0d,0x0a,0x0d,0x0a,0x00
init bsf OSCCON,IRCF2 ;set to 8MHz clock
bsf OSCCON,IRCF1
bsf OSCCON,IRCF0
setf ADCON1 ;set PortA to all digital
clrf TRISA ;set PortA pins to outputs
clrf LATA ;turn off LEDs
movlw b'00010010' ;set PORTB data directions
movwf TRISB
call rs_init ;init rs232
;STARTUP HERE MAIN
;[b]
Reject
movlw stringf
call strsend ;Send Login text
; [/b]
call rs_recv
xorlw 'P'
btfss STATUS,Z
goto Reject
call rs_recv
xorlw 'a'
btfss STATUS,Z
goto Reject
call rs_recv
xorlw 's'
btfss STATUS,Z
goto Reject
call rs_recv
xorlw 's'
btfss STATUS,Z
goto Reject
ShowMen ;if it gets here then the 4 characters matched. [b]
movlw menu ;send menu
call strsend ; [/b]