Figure 1-15. Sample Basic Program - Brainboxes AD-1200 H User Manual

Relay multiplexer board
Table of Contents

Advertisement

Analog Relay Mux Board
_______________________________

Figure 1-15. Sample Basic Program.

10 BASE=&H218:
11 W=2500:
12 ADCSR=BASE :ADGCR=BASE+1 :ADCLO=BASE+2 :ADCHI=BASE+3
13 DIGIN=BASE+6 :DIGOUT=BASE+6: REM Digital i/o ports at same address
14 FEED=&H1 :REM Relay Made Feedback Jumper Set To Bit 0
15 :
16 :
20 FOR RELAY = 0 TO 15
25 OUT DIGOUT,&HFF:
27:
30 OUT DIGOUT,RELAY:
35:
40 GOSUB 1000:
50:
60 FOR C=1 TO W :NEXT:
70 NEXT RELAY
80 :
90 END
99 :
100 REM FEEDBACK signal goes LOW when new relay made also on &H21E
1000 REM wait for feed back
1010 PRINT"Select Relay "RELAY "
1060 F=INP(DIGIN):
1070 IF ( (F AND FEED)<>0) THEN GOTO 1060
1100 REM got feedback
1110 PRINT"Feedback Signal Received!";
1120:
1130:REM PERFORM A/D CONVERSION HERE
1140 OUT ADGCR,0:
1150 IF ( (INP(ADCSR) AND 128)<>128) THEN GOTO 1150: REM Wait for AD
1160 LO=INP(ADCLO):
1170 HI=INP(ADCHI):
1180 ADIN=HI*256 + LO: PRINT TAB(65)"A/D In="Hex$(ADIN)
1190:
1200 RETURN
5999 END
6000 SAVE "admux",A
REM Wait For FeedBack=Relay Closed
REM Delay To Prevent Us Wasting RELAY's Life
";
REM Select Channel Force Conversion
REM Always Read Low Byte First
REM AD1200 BASE ADDRESS
REM DELAY Time
REM UNADDRESS ALL BOARDS
REM ADDRESS CHOSEN RELAY
REM Read Digital Input Port
REM And High Byte Last
Reference
DEFAULT
DONE
Page 17

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad-758Ad-819Ad-967Admux ad1200

Table of Contents