Welche Konstante wird hier erwartet?
Code:
SYS LED_DRIVE:pulse LSTROBE:RETURN
Ganzes Programm:
Code:
'--------------------------
'------ I/O PORTS ---------
'--------------------------
'- INTERFACE LCD/EXTPORT --
define sdio port[1]
define sclio port[3]
define strobe port[4]
define LSTROBE port[7]
'-- INTERFACE COM/NAV -----
define DATALINE port[1]
define CLOCKLINE port[2]
'-- CC2 INTERFACE -------
define CC2POWER port[8]
'--------------------------
'------ SENSORS ---------
'--------------------------
define LIGHT_L ad[7]
define LIGHT_R ad[6]
define SYS_VOLTS ad[3]
define CHRG_CURRENT ad[2]
define SYS_CURRENT ad[1]
define MIC ad[4]
define TOUCH ad[5]
'---------------------------
'------ DRIVE -------------
'---------------------------
define SPEED_L da[1]
define SPEED_R da[2]
define REV_L port[6]
define REV_R port[5]
'--------------------------
'---- SYSTEM MEMORY -------
'--------------------------
'--- INTERFACE BUFFER ----
define LBYTE byte[1]
define HBYTE byte[2]
define SUBCMD byte[3]
'---- OPERATION DATA ------
define EXTPORT byte[4]
define LED1_F bit[29]
define LED2_F bit[30]
define LED3_F bit[31]
define LED4_F bit[32]
define SYSTEM_STATUS byte[5]
define LEDPORT byte[6]
define L1_F bit[41]
define L2_F bit[42]
define L3_F bit[43]
define L4_F bit[44]
define L5_F bit[45]
define L6_F bit[46]
define L7_F bit[47]
define L8_F bit[48]
'--------------------------
'---- USER MEMORY -------
'--------------------------
define TIM byte[6]
define PGM byte[7]
'--- SYSTEMROUTINEN -----------
define PLM_SLOW &H01C4
define SYSTEM &H01C9
define COMNAV &H0154
'- ERWEITERTE SYSTEM ROUTINEN -
define REVR &H0101 'ANTRIEB RECHTS RÜCKWÄRTS
define REVL &H0106 'ANTRIEB LINKS RÜCKWÄRTS
define FWDR &H010B 'ANTRIEG RECHTS VORWÄRTS
define FWDL &H0110 'ANTRIEB LINKS VORWÄRTS
define ROTR &H0115 'RECHTS DREHEN
define ROTL &H0119 'LINKS DREHEN
define REV &H011D 'RÜCKWÄRTS
define FWD &H0121 'VORWÄRTS
define COMNAV_STATUS &H0125 'UPDATED ALLE FLAGS IM STATUS-REGISTER
define ACS_LO &H01E1 'ACS POWER LO
define ACS_HI &H01E9 '
define ACS_MAX &H01F1 '
define SEND_TLM &H014A 'SENDET TELEMETRIE (CH=HBYTE,DATEN=LBYTE)
define SEND_SPEEDR &H0134 'SENDET TLM KANAL 8,PLM RECHTS
define SEND_SPEEDL &H013A 'SENDET TLM KANAL 7,PLM LINKS
define SEND_SYSSTAT &H0144 'SENDET TLM KANAL 0,SYSTEM STATUS
'(FLAGS für ACS,FWD/REV, ACS_LO/HI/MAX)
'---------- INIT---------------
LSTROBE=off:CC2POWER=on
gosub SUBSYS_PWR_ON:REV_L=off:REV_R=off
beep 368,10,0:pause 50
PGM=1
'--------------------------------------------
'--- DEMO BERÜHRUNGSSENSOR UND LEDs ---
'--------------------------------------------
#NO_SELECT
on PGM goto LOOP,PGM1,PGM2,PGM3,PGM4
gosub LEDSOFF
#LOOP
if TOUCH < 20 then goto NO_SELECT
if TOUCH < 40 then goto SEL1
if TOUCH < 60 then goto SEL2
if TOUCH < 80 then goto SEL3
if TOUCH < 100 then goto SEL4
if TOUCH < 120 then goto SEL5
if TOUCH < 140 then goto SEL6
if TOUCH < 160 then goto SEL7
if TOUCH < 180 then goto SEL8
goto LOOP
'------------- AUSWAHL ---------------------------
#SEL1
gosub LEDSOFF:gosub L1ON:pause 10:PGM=1:goto LOOP
#SEL2
gosub LEDSOFF:gosub L2ON:pause 10:PGM=2:goto LOOP
#SEL3
gosub LEDSOFF:gosub L3ON:pause 10:PGM=3:goto LOOP
#SEL4
gosub LEDSOFF:gosub L4ON:pause 10:PGM=4:goto LOOP
#SEL5
gosub LEDSOFF:gosub L5ON:pause 10:PGM=5:goto LOOP
#SEL6
gosub LEDSOFF:gosub L6ON:pause 10:PGM=6:goto LOOP
#SEL7
gosub LEDSOFF:gosub L7ON:pause 10:PGM=7:goto LOOP
#SEL8
gosub LEDSOFF:gosub L8ON:pause 10:PGM=8:goto LOOP
'-------- AUSGEWÄHLTE PROGRAMME ----------------------
#PGM1
gosub LEDSOFF:pause 20:GOSUB L8ON:pause 20:goto loop
#PGM2
gosub LEDSOFF:pause 20:GOSUB L7ON:pause 20:goto loop
#PGM3
gosub LEDSOFF:pause 20:GOSUB L6ON:pause 20:goto loop
#PGM4
gosub LEDSOFF:pause 20:GOSUB L5ON:pause 20:goto loop
#PGM5
gosub LEDSOFF:pause 20:GOSUB L4ON:pause 20:goto loop
#PGM6
gosub LEDSOFF:pause 20:GOSUB L3ON:pause 20:goto loop
#PGM7
gosub LEDSOFF:pause 20:GOSUB L2ON:pause 20:goto loop
#PGM8
gosub LEDSOFF:pause 20:GOSUB L1ON:pause 20:goto loop
'-------------------------------------------------------
'IIIIIIIIIII LED DRIVER IIIIIIIIIIIIIIIII
#LED1ON
LED1_F=on:goto EXTPORT_WRITE
#LED1OFF
LED1_F=off :goto EXTPORT_WRITE
#LED2ON
LED2_F=on:goto EXTPORT_WRITE
#LED2OFF
LED2_F=off:goto EXTPORT_WRITE
#LED3ON
LED3_F=on:goto EXTPORT_WRITE
#LED3OFF
LED3_F=off:goto EXTPORT_WRITE
#LED4ON
LED4_F=on:goto EXTPORT_WRITE
#LED4OFF
LED4_F=off:goto EXTPORT_WRITE
#LEDSOFF
EXTPORT=EXTPORT and &H0F:goto EXTPORT_WRITE
#EXTPORT_WRITE
SYS SYSTEM:pulse STROBE:RETURN
'--- LEDS AUF DER BASIS ERWEITERUNG ------
#L1ON
L1_F=on:goto LEDPORT_WRITE
#L1OFF
L1_F=off :goto LEDPORT_WRITE
#L2ON
L2_F=on:goto LEDPORT_WRITE
#L2OFF
L2_F=off :goto LEDPORT_WRITE
#L3ON
L3_F=on:goto LEDPORT_WRITE
#L3OFF
L3_F=off :goto LEDPORT_WRITE
#L4ON
L4_F=on:goto LEDPORT_WRITE
#L4OFF
L4_F=off :goto LEDPORT_WRITE
#L5ON
L5_F=on:goto LEDPORT_WRITE
#L5OFF
L5_F=off :goto LEDPORT_WRITE
#L6ON
L6_F=on:goto LEDPORT_WRITE
#L6OFF
L6_F=off :goto LEDPORT_WRITE
#L7ON
L7_F=on:goto LEDPORT_WRITE
#L7OFF
L7_F=off :goto LEDPORT_WRITE
#L8ON
L8_F=on:goto LEDPORT_WRITE
#L8OFF
L8_F=off :goto LEDPORT_WRITE
#LOFF
LEDPORT=0
#LEDPORT_WRITE
SYS LED_DRIVE:pulse LSTROBE:RETURN
'IIIIII SYSTEMROUTINEN COMM/NAV SYSTEM IIIII
#GET_IRDATA
SUBCMD=1:sys COMNAV:return
#SEND_IRDATA
SUBCMD=0:sys COMNAV:return
#RC5
SUBCMD=4:sys COMNAV:LBYTE= HBYTE and &HFC
HBYTE=00:SUBCMD=2:sys COMNAV:return
#RC5_INT
SUBCMD=4:sys COMNAV:LBYTE= (HBYTE and &HFE)or 2
HBYTE=00:SUBCMD=2:sys COMNAV:return
#REC80
SUBCMD=4:sys COMNAV:LBYTE= (HBYTE or &H01)and&HFD
HBYTE=00:SUBCMD=2:sys COMNAV:return
#REC80_INT
SUBCMD=4:sys COMNAV:LBYTE= (HBYTE or &H03)
HBYTE=00:SUBCMD=2:sys COMNAV:return
'IIIIII SYSTEMROUTINEN SYSTEM IIIIIIIIIIII
#NO_ACS_INT
SUBCMD=4:sys COMNAV:LBYTE= HBYTE and &HFB
HBYTE=00:SUBCMD=2:sys COMNAV:return
#ACS_INT_200
SUBCMD=4:sys COMNAV:LBYTE= HBYTE or &H04
HBYTE=50:SUBCMD=2:sys COMNAV:return
#SUBSYS_PWR_ON
sdio=on:sclio=on:strobe=off:EXTPORT=(EXTPORT and &HFE)or 8
sys SYSTEM:return
#SUBSYS_PWR_OFF
EXTPORT=(EXTPORT and &HF7)or 1:sys SYSTEM
deact sdio:deact sclio:return
#CLR_DISTANCE
SUBCMD=3:sys COMNAV:return
#L_DISTANCE
SUBCMD=6:sys COMNAV:return
#R_DISTANCE
SUBCMD=7:sys COMNAV:return
'---------COM/NAV GERÄTEREIBER -------------
syscode "p5driv.s19"
Lesezeichen