Code:
'#####################
'16F877A
DEFINE OSC 20
'####################
@ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF &_BODEN_OFF
INCLUDE "modedefs.bas"
'LCD SET UP
DEFINE LCD_DREG PORTC
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50
'#####################
NUMS VAR BYTE[16]
VDAT VAR BYTE[96]
X1 VAR BYTE
X2 VAR BYTE
X3 VAR BYTE
X4 VAR BYTE
X5 VAR BYTE
X6 VAR BYTE
X7 VAR BYTE
X8 VAR BYTE
V1 VAR BYTE
V2 VAR BYTE
V3 VAR BYTE
V4 VAR BYTE
V5 VAR BYTE
V6 VAR BYTE
V7 VAR BYTE
V8 VAR BYTE
VinRXD VAR PORTD.7 'DATA TO VDIP
FLOWIN VAR PORTD.6 'FLOW CONTROL FROM VDIP
'#####################
PAUSE 1000
LCDOUT $FE,1,"MACKRACK"
LCDOUT $FE,$C0,"IT BV2"
PAUSE 1000
RUN:
'LCDOUT $FE,1,X1,X2,X3,X4,X5,X6,X7,X8
SERIN2 PORTB.5,24972,[WAIT("GRAM:"),STR NUMS\8] '7, Even, INVERTED
X1 = NUMS[0]
X2 = NUMS[1]
X3 = NUMS[2]
X4 = NUMS[3]
X5 = NUMS[4]
X6 = NUMS[5]
X7 = NUMS[6]
X8 = NUMS[7]
HIGH PORTD.2
PAUSE 100
LOW PORTD.2
PAUSE 100
LCDOUT $FE,1,X1,X2,X3,X4,X5,X6,X7,X8
PAUSE 100
'#########################
'START STICK
HIGH VinRXD
PAUSE 5
SEROUT2 PORTB.3, 24972,["MACKRACKIT",13,10]
SEROUT2 VinRXD,8588,["ECS",13] '7,E = 8588 , TRUE
HIGH VinRXD
PAUSEUS 10
SEROUT2 VinRXD,8588,["IPA",13]
HIGH VinRXD
PAUSEUS 10
WAIT11:
IF FLOWIN = 1 THEN WAIT11
SEROUT2 VinRXD,8588,["OPR ",X1,X2,X3,X4,X5,X6,X7,X8,".DAT",13]
WAIT12:
IF FLOWIN = 1 THEN WAIT12
SEROUT2 VinRXD,8588,["RDF 1000",13]
SERIN2 PORTB.4,8588,[STR VDAT\96]
V1 = VDAT[0]
V2 = VDAT[1]
V3 = VDAT[2]
V4 = VDAT[3]
V5 = VDAT[4]
V6 = VDAT[5]
V7 = VDAT[6]
V8 = VDAT[7]
PAUSEUS 10
WAIT13:
IF FLOWIN = 1 THEN WAIT13
SEROUT2 VinRXD,8588,["CLF ",X1,X2,X3,X4,X5,X6,X7,X8,".DAT",13]
WAIT14:
LCDOUT $FE,1,"FINISH"
IF FLOWIN = 1 THEN WAIT14
LCDOUT $FE,1,X1,X2,X3,X4,X5,X6,X7,X8
LCDOUT $FE,$C0," SENT"
'SEROUT2 PORTB.3, 24972,[V1,V1,V2,V3,V4,V5,V6,V7,V8,10,13]
SEROUT2 PORTB.3, 24972,[STR VDAT,10,13]
SEROUT2 PORTB.3, 24972,["DONE",10,13]
PAUSE 2000
GOTO RUN
Bookmarks