Code:
define osc 4
INCLUDE "modedefs.bas"
@ device PIC16f690, MCLR_OFF
info var byte[10] 'really should be 5 long, but I lengthened it just for the halibut.
info[0] = "t" 'trying to appease the compiler.. not really needed
info[1] = "t"
info[2] = "t"
info[3] = "t"
info[4] = "t"
info[5] = "t"
trisa = %00000000
trisb = %00000000
trisc = %00000000
'trisa.0 = %0 'me trying to manually set tris registers
'trisa.1 = %0
'trisa.2 = %0
'trisa.3 = %0
'trisa.4 = %0
'trisa.5 = %0
'trisb.4 = %0
'trisb.5 = %0
'trisb.6 = %0
'trisb.7 = %0
'trisc.0 = %0
'trisc.1 = %0
'trisc.2 = %0
'trisc.3 = %0
'trisc.4 = %0
'trisc.5 = %0
'trisc.6 = %0
'trisc.7 = %0
'ADCON0 = 0 'fiddling with additional registers trying to get
'ADCON1 = 0 'all outputs set to digital
'ADCON1 = 15
ansel = 0
anselh = 0
poll:
'SEROUT porta.0,N2400,["p"] 'I had set all pins to output data
'SEROUT porta.1,N2400,["p"] 'originally, all pins worked at one
'SEROUT porta.2,N2400,["p"] 'time using this.
'SEROUT porta.3,N2400,["p"]
'SEROUT porta.4,N2400,["p"]
'SEROUT porta.5,N2400,["p"]
'SEROUT portb.4,N2400,["p"]
'SEROUT portb.5,N2400,["p"]
'SEROUT portb.6,N2400,["p"]
'SEROUT portb.7,N2400,["p"]
'SEROUT portc.0,N2400,["p"]
'SEROUT portc.1,N2400,["p"]
'SEROUT portc.2,N2400,["p"]
'SEROUT portc.3,N2400,["p"]
'SEROUT portc.4,N2400,["p"]
'SEROUT portc.5,N2400,["p"]
'SEROUT portc.6,N2400,["p"]
'SEROUT portc.7,N2400,["p"]
pause 100
SERIN portc.5, N2400, 1000, nxt, ["r"], info[0] 'Get input
SERIN portc.5, N2400, info[1] 'get the word "relay"
SERIN portc.5, N2400, info[2]
SERIN portc.5, N2400, info[3]
SERIN portc.5, N2400, info[4]
SEROUT portc.0, N2400, [info[1], info[2], info[3], info[4] ]
'above line: output received data "relay" to computer serial line
pause 500
gosub poll
nxt:
serout portc.4, N2400, ["timeout"]
return
Bookmarks