'+=========================================================================+ '+ GVG100 Panel software 12 includes cut subroutine for PGM to PST selection + '+ subroutines to display analogue pots currently T-Bar and Softness and '+ wipe buttons positioner reverse buttons on top panel now active + '+ code is Annex ESP8266 Basic + '+ https://sites.google.com/site/annexwifi/home + '+ CQ-DATV Magazine GVG project Author Trevor G8CJS + '+ Notes and guidance are in CQ-DATV issue 78 onwards + '+ + ' + '+=========================================================================+ ' PCF8574 Device Addresses let PRT1=39 ' Port 1 Control address 64 for /A device sw 1 off off off let PRT3=37 ' Port 3 Address Bus address 62 for /A device sw 2 off on off let PRT4=32 ' Port 4 Data Bus address 56 for /A device sw 3 on on on let IOa =57 ' I/O Port a address 33 for a non/A device sw 4 off off on let IOb =60 ' I/O Port b address 36 for a non/A device sw 5 on on off let ck=251 ' i2c conrtol of CPU lines let tristate =255 let lamps =254 let buttons=253 I2C.SETUP 4,5 ' SDA & SCL Pins LCD.INIT 63, 16, 2 ' PCF8574 Backpack Address 0X3F hex LCD.CLS LCD.PRINT 1,1, "G8CJS software " LCD.PRINT 1,2, "Revison 12c " let n=0 :let o=0 : let p=0 'global variable to store copies off the panel lamps as they cannot be read let q=0 : let r=0 : let s=0 let t=0 : let u=0: let v=0 let w=0 :let y=0 let z=0 :let x =255: let w=255 let analogpot = 0 let Tbarpos =0 'Global variables of all the analog pots let et = 9 let et2 =10 let et3 =11 let data1=0 let address1=0 let analogue = 239 let conv = 247 let tbar = 02 let joystickv = 01 let joystickh = 00 let ckhue = 03 'CK hue let hue = 04 'Matte Box Hue let chroma = 06 'Matte box Chroma let lum = 07 'Mattbox Lum let clip = 08 'CK clip let gain = 09 'CK gain let aspecta = 10 'aspect pattern ajust let mask = 11 'mask preset size let softness = 12 'ede softness let width = 13 'boarder width let pri = 14 'effects priority gosub sevenseg1 ' The routines for the seven segment displays only 3 used gosub sevenseg2 gosub sevenseg3 '-------------------------------------clear all lights and turn power on to PGM,KEY and PST banks----------------------- for c = 0 to 9 'clearlights let data1=0 'data (lights off) let address1=c 'advance through lamp addresses gosub latchmanager 'i2c lamp latch manager next c '------------------------------------'power on to PST,PGM an Key bank lights 'if (q AND 128) <> 0 then let q = q -128 ' turn KEY PGM PST power off 'if (q AND 32) <> 0 then let q = q -32 'if (q AND 8) <> 0 then let q = q -8 let q=q+ 168 ' turn key PGM PST power on gosub strobeq '---------------------set Set KEY PGM PST to source 0 selected-------------------- let B = 1 'set key bank to 0 let e = 254 gosub KEYlatch ' "Key 0 " let B = 2 'set PGM bank to 0 let e = 254 gosub PGMlatch ' "PGM 0 let B = 3 'set PST bank to 0 let e = 254 gosub PSTlatch ' PST 0 '-----------------------------------------------button pole to see if we have a button press-------------------------- do 'wlog analogpot for B=0 to 9 i2c.begin PRT1 ' switch all maps off i2c.write tristate i2c.end i2c.begin PRT3 ' Address port i2c.write B ' Scan buttons BS2 low i2c.end i2c.begin PRT4 ' Control port i2c.write 255 ' needed to work i2c.end i2c.begin PRT1 ' Control port i2c.write buttons ' Scan buttons i2c.end i2c.reqfrom PRT4,1 e = i2c.read i2c.end i2c.begin PRT1 ' switch all maps off i2c.write tristate i2c.end if e< 255 then gosub push next B gosub analog1 gosub analog2 gosub mixduration loop until 0 '----------------------------------------push buttons director----------------------- push: If b=7 and e=127 then gosub sevenseg1 'frame one button pressed If b=8 and e=191 then gosub sevenseg2 'frame one button pressed If b=9 and e=191 then gosub sevenseg3 'frame one button pressed ' key bank buttons precessed here if B = 1 and e = 254 then gosub KEYlatch ' "Key 0 " if B = 1 and e = 253 then gosub KEYlatch ' "key 1 " if B = 1 and e = 251 then gosub KEYlatch ' "key 2 " If B = 1 and e = 247 then gosub KEYlatch ' "key 3 " if B = 1 and e = 239 then gosub KEYlatch ' "key 4 " if B = 1 and e = 223 then gosub KEYlatch ' "key 5 " if B = 1 and e = 191 then gosub KEYlatch ' "key 6 " if B = 1 and e = 127 then gosub KEYlatch ' "key 7 " if B = 4 and e = 251 then gosub KEYlatch ' "key 8 " if B = 4 and e = 247 then gosub KEYlatch ' "key 9 " if B = 4 and e = 127 then gosub auto 'autotrans 'PGM bank button processed here if B = 2 and e = 254 then gosub PGMlatch ' "PGM 0 if B = 2 and e = 253 then gosub PGMlatch ' "PGM 1 if B = 2 and e = 251 then gosub PGMlatch ' "PGM 2 if B = 2 and e = 247 then gosub PGMlatch ' "PGM 3 if B = 2 and e = 239 then gosub PGMlatch ' "PGM 4 if B = 2 and e = 223 then gosub PGMlatch ' "PGM 5 if B = 2 and e = 191 then gosub PGMlatch ' PGM 6 if B = 2 and e = 127 then gosub PGMlatch ' PGM 7 if B = 4 and e = 254 then gosub PGMlatch ' PGM 8 " if B = 4 and e = 253 then gosub PGMlatch ' PGM 9 'yellow key control buttons prrocessed here if B=0 and e = 254 then gosub KEYCTRL if B=0 and e = 253 then gosub KEYCTRL if B=0 and e = 251 then gosub KEYCTRL if B=0 and e = 247 then gosub KEYCTRL if B=0 and e = 239 then gosub KEYCTRL if B=0 and e = 223 then gosub KEYCTRL if B=0 and e = 191 then gosub KEYCTRL if B=5 and e = 127 then gosub KEYCTRL 'boardline key processed here if B=5 and e = 254 then gosub boarderline ' "NORMAL" if B=5 and e = 253 then gosub boarderline ' "BORDER" if B=5 and e = 251 then gosub boarderline ' "DROP SHADOW" if B=7 and e = 254 then gosub boarderline ' EXTRUDE" if B=7 and e = 253 then gosub boarderline 'OUTLINE" 'fade transition mix and wipe processed here if B=5 and e = 191 then gosub Tran 'Transition wipe if B=5 and e = 223 then gosub Tran 'Transistion mix if B=6 and e = 191 then gosub fade2black 'FADE TO BLACK ' cut button PGM = PST selection if B=4 and e= 191 then gosub cut ' cut button 'PST key processed here if B = 3 and e = 254 then gosub PSTlatch 'PST 0 if B = 3 and e = 253 then gosub PSTlatch 'PST 1 if B = 3 and e = 251 then gosub PSTlatch 'PST 2 if B = 3 and e = 247 then gosub PSTlatch 'PST 3 if B = 3 and e = 239 then gosub PSTlatch 'PST 4 if B = 3 and e = 223 then gosub PSTlatch 'PST 5 if B = 3 and e = 191 then gosub PSTlatch 'PST 6 if B = 3 and e = 127 then gosub PSTlatch 'PST 7 if B = 4 and e = 239 then gosub PSTlatch 'PST 8 if B = 4 and e = 223 then gosub PSTlatch 'PST 9 'wipe buttons processed here If b=8 and e=254 then gosub wipe 'wipe 5 if b=8 and e=253 then gosub wipe 'wipe 4 if b=8 and e=251 then gosub wipe 'wipe 3 if b=8 and e=247 then gosub revpos 'positioner if b=8 and e=239 then gosub wipe 'wipe 1 if b=8 and e=223 then gosub wipe 'wipe 2 if b=9 and e=254 then gosub wipe 'wipe 10 if b=9 and e=253 then gosub wipe 'wipe 9 if b=9 and e=251 then gosub wipe 'wipe 8 if b=9 and e=247 then gosub revpos 'reverse if b=9 and e=239 then gosub wipe 'wipe 6 if b=9 and e=223 then gosub wipe 'wipe 7 '--------------------------------mix and wipe ------ Tran: if (s and 2) <> 0 then let s=s-2 'if wipe lit turn off if (s and 8) <> 0 then let s=s-8 'if mix lit turn off if B=5 and e=223 then let s=s+2 'Transistion wipe on if B=5 and e= 191 then let s=s+8 ' Transistion mix on gosub strobes gosub IOswitch return KEYCTRL: ' only one key allowed on ay once------- if (p and 8) <> 0 then let p=p-8 ' "EMEM" if (p and 16) <> 0 then let P=P-16 ' "AUTO SELECT" if (p and 32) <> 0 then let p=p-32 ' "PST PTN" if (p and 128) <>0 then let p=p-128 ' "LUM KEY" if (p and 4) <> 0 then let p=p-4 ' "LINEAR KEY" if (P and 64) <> 0 then let P=P-64 'CHROMA KEY" if (p and 2) <> 0 then let p=p-2 ' "KEY MASK" if( p and 1) <> 0 then let p=p-1 ' "KEY INVERT" if(u and 1) <> 0 then let u=u-1 if B=0 and e = 254 then let p=p+8 ' "EMEM" if B=0 and e = 253 then let p=p+16 ' "AUTO SELECT" if B=0 and e = 251 then let p=p+32 ' "PST PTN" if B=0 and e = 247 then let p=p+128 ' "LUM KEY" if B=0 and e = 239 then let p=p+4 ' "LINEAR KEY" if B=0 and e = 223 then let p=P+64 ' "CHROMA KEY" if B=0 and e = 191 then let p=p+2 ' "KEY MASK" if B=5 and e = 127 then let p =p+1 ' "KEY INVERT" if B=0 and e=223 then let u=u+1 'key on if B=0 and e=239 then let u=u+1 if B=0 and e=247 then let u=u+1 gosub strobeu gosub strobep return '-----------------------turn oo one key at once--------- boarderline: ' if (u and 8) <> 0 then let u=u-8 'normal turn off if (u and 2) <> 0 then let u=u-2 'boarder turn off if (u and 64) <> 0 then let u=u-64 'shadow turn off If (u and 16) <> 0 then let u=u-16 'extrude turn of if (u and 4) <> 0 then let u=u-4 'outline turn off if B=5 and e = 254 then let u=u+8 'normal turn on if B=5 and e = 253 then let u=u+2 'boarder " if B=5 and e = 251 then let u=u+64 'shadow " if B=7 and e = 254 then let u=u+16 'Extrude " if B=7 and e = 253 then let u=u+4 'outline " gosub strobeu return '--------------------memory routines to mirror the PGM PST KEY latches------ ' more complex as soft control of turning keys off required KEYlatch: 'clear any previous selection from soft latch q, o and t if (q AND 64) <> 0 then let q = q-64 'if key 0 lit turn off if (q AND 16) <> 0 then let q = q-16 'if key 1 lit turn off if (q AND 4) <> 0 then let q = q -4 'if key 2 lit turn off if (q AND 1) <> 0 then let q = q -1 'if key 3 lit turn off if (o AND 2) <> 0 then let o = o -2 'if key 4 lit turn off if (o AND 1) <> 0 then let o = o -1 'if key 5 lit turn off if (o AND 8) <> 0 then let o = o -8 'if key 6 lit turn off if (o AND 4) <> 0 then let o = o -4 'if key 7 lit turn off if (t AND 8) <> 0 then let t = t- 8 'if key 8 lit turn off if (t AND 32) <> 0 then let t = t- 32 'if key 9 lit turn off if B=1 and e=254 then let q = q+64 'if key 0 pressed turn on if B=1 and e=253 then let q = q+16 'if key 1 pressed turn on if B=1 and e=251 then let q = q+4 'if key 2 pressed turn on if B=1 and e=247 then let q = q+1 'if key 3 pressed turn on if B=1 and e=239 then let o = o+2 'if key 4 pressed turn on if B=1 and e=223 then let o = o+1 'if key 5 pressed turn on if B=1 and e=191 then let o = o+8 'if key 6 pressed turn on if B=1 and e=127 then let o = o+4 'if key 7 pressed turn on if B=4 and e=251 then let t = t+8 'if key 8 pressed turn on if B=4 and e=247 then let t = t+32 'if key 9 pressed turn on gosub strobeq 'q latch lamps gosub strobeo 'o latch lamps gosub strobet 't latch lamps gosub IOkey 'Input Output routines return PGMlatch: 'clear any previous selection from soft latch r o and n if (r AND 2) <> 0 then let r=r-2 'If PGM 0 lit turn off if (r AND 8) <> 0 then let r=r-8 'If PGM 1 lit turn off if (r AND 32) <> 0 then let r=r-32 'If PGM 2 lit turn off if (r AND 128) <> 0 then let r=r-128 'If PGM 3 lit turn off if (o AND 32) <> 0 then let o = o -32 'if PGM 4 lit turn off if (o AND 128) <> 0 then let o = o -128 'if PGM 5 lit turn off if (o AND 64) <> 0 then let o = o -64 'if PGM 6 lit turn off if (o AND 16) <> 0 then let o = o -16 'if PGM 7 lit turn off if (n AND 1) <> 0 then let n = n - 1 'If PGM 8 lit turn off if (n AND 4) <> 0 then let n = n - 4 'If PGM 9 lit turn off if B=2 and e=254 then let r = r+ 2 'if PGM 0 pressed turn on if B=2 and e=253 then let r = r+ 8 'if PGM 1 pressed turn on if B=2 and e=251 then let r = r+ 32 'if PGM 2 pressed turn on if B=2 and e=247 then let r =r + 128 'if PGM 3 pressed turn on if B=2 and e=239 then let o =o + 32 'if PGM 4 pressed turn on if B=2 and e=223 then let o =o + 128 'if PGM 5 pressed turn on if B=2 and e=191 then let o= o + 64 'if PGM 6 pressed turn on if B=2 and e=127 then let o= o + 16 'if PGM 7 Pressed turn on if b=4 and e=254 then let n= n + 1 'if PGM 8 pressed turn on if b=4 and e=253 then let n =n + 4 'if PGM 9 pressed turn on gosub strobeo ' O latch lamps gosub strober ' r latch lamps gosub stroben ' n latch lamps gosub IOpgm ' Input Output routine return cut: if (r AND 2) <> 0 then let r=r-2 'If PGM 0 lit turn off if (r AND 8) <> 0 then let r=r-8 'If PGM 1 lit turn off if (r AND 32) <> 0 then let r=r-32 'If PGM 2 lit turn off if (r AND 128) <> 0 then let r=r-128 'If PGM 3 lit turn off if (o AND 32) <> 0 then let o = o -32 'if PGM 4 lit turn off if (o AND 128) <> 0 then let o = o -128 'if PGM 5 lit turn off if (o AND 64) <> 0 then let o = o -64 'if PGM 6 lit turn off if (o AND 16) <> 0 then let o = o -16 'if PGM 7 lit turn off if (n AND 1) <> 0 then let n=n-1 'If PGM 8 lit turn off if (n AND 4) <> 0 then let n=n-4 'If PGM 9 lit turn off if (n and 16) <> 0 then let n=n+4 'PST9 cut to PGM9 if (n and 64) <> 0 then let n=n+1 'PST8 cut to PGM8 if (n and 128)<> 0 then let o=o+16 'PST7 cut to PGM7 if (n and 32) <> 0 then let o=o+64 'PST6 cut to PGM6 if (n and 8) <> 0 then let o=o +128 'PST5 cut to PGM5 if (n and 2) <> 0 then let o=o+32 'PST4 cut to PGM4 if (r and 1) <> 0 then let r=r+128 'PST3 cut to PGM3 if (r and 4) <> 0 then let r=r+32 'PST2 cut to PGM2 if (r and 16) <> 0 then let r=r+8 'PST1 cut to PGM1 if (r and 64) <> 0 then let r=r+2 'PST0 cut to PGM0 if (n and 16) <> 0 then let x = 80 'PGM 9 IO update if (n and 64) <> 0 then let x = 96 'PGM 8 IO update if (n and 128)<>0 then let x = 112 'PGM 7 IO update if (n and 32)<> 0 then let x = 128 'PGM 6 IO update if (n and 8) <> 0 then let x = 144 'PGM 5 IO update if (n and 2) <> 0 then let x = 160 'PGM 4 IO update if (r and 1) <> 0 then let x = 176 'PGM 3 IO update if (r and 4) <> 0 then let x = 192 'PGM 2 IO update if (r and 16)<> 0 then let x = 208 'PGM 1 IO update if (r and 64)<> 0 then let x = 224 'PGM 0 IO update gosub strobeo ' O latch lamps gosub strober ' r latch lamps gosub stroben ' n latch lamps i2c.begin IOa 'I/O port a' i2c.write x+w 'PGM bank to I/O i2c.end return PSTlatch: 'clear any previous selection from soft latch r and n if (r AND 64) <> 0 then let r=r-64 'If PST 0 lit turn off if (r AND 16) <> 0 then let r=r-16 'If PST 1 lit turn off if (r AND 4 ) <> 0 then let r=r- 4 'If PST 2 lit turn off if (r AND 1) <> 0 then let r=r-1 'If PST 3 lit turn off if (n AND 2) <> 0 then let n=n-2 'If PST 4 lit turn off if (n AND 8) <> 0 then let n=n-8 'If PST 5 lit turn off if (n AND 32 ) <> 0 then let n=n-32 'If PST 6 lit turn off if (n AND 128) <> 0 then let n=n-128 'If PST 7 lit turn off if (n AND 64) <> 0 then let n=n-64 'If PST 8 lit turn off if (n AND 16) <> 0 then let n=n-16 'If PST 9 lit turn off if B= 3 AND e=254 then let r=r+64 'Turn PST 0 on if B= 3 AND e=253 then let r=r+16 'Turn PST 1 on if B= 3 AND e=251 then let r=r+4 'Turn PST 2 on if B= 3 AND e=247 then let r=r+1 'Turn PST 3 on if B= 3 AND e=239 then let n=n+2 'Turn PST 4 on if B= 3 AND e=223 then let n=n+8 'Turn PST 5 on if B= 3 AND e=191 then let n=n+32 'Turn PST 6 on if B= 3 AND e=127 then let n=n+128 'Turn PST 7 on if B= 4 AND e=239 then let n=n+64 'Turn PST 8 on if B= 4 AND e=223 then let n=n+16 'Turn PST 9 on gosub strober ' r latch lamps gosub stroben ' n latch lamps gosub IOPST 'Input Output routines return wipe:' small pattern selector buttons on the top panel if (v and 64) <> 0 then let v=v-64 'turn wipe 1 off if (v and 32) <> 0 then let v=v-32 'turn wipe 2 off if (v and 2) <> 0 then let v=v-2 'turn wipe 3 off if (w and 128) <> 0 then let w=w-128 'turn wipe 4 off if (w and 8) <> 0 then let w=w-8 'turn wipe 5 off if (v and 16) <> 0 then let v=v-16 'turn wipe 6 off if (v and 128) <> 0 then let v=v-128 'turn wipe 7 off if (v and 8) <> 0 then let v=v-8 'turn wipe 8 off if (w and 64) <> 0 then let w=w-64 'turn wipe 9 off if (w and 32) <> 0 then let w=w-32 'turn wipe 10 off if b=8 and e=239 then let v=v+64 'turn on wipe 1 if b=8 and e=223 then let v=v+32 'turn on'wipe 2 if b=8 and e=251 then let v=v+2 'turn on wipe 3 if b=8 and e=253 then let w=w+128 'turn on wipe 4 If b=8 and e=254 then let w=w+8 'turn on wipe 5 if b=9 and e=239 then let v=v+16 'turn on wipe 6 if b=9 and e=223 then let v=v+128 'turn on wipe 7 if b=9 and e=251 then let v=v+8 'turn on wipe 8 if b=9 and e=253 then let w=w+64 'turn on'wipe 9 if b=9 and e=254 then let w=w+32 'turn on wipe 10 gosub strobev gosub strobew return revpos: 'toggles position and reverse if b=9 and e=247 then goto rev 'reverse button pressed pause 100 'debounce dely if (v and 4) <> 0 then goto on 'pos light was on let v=v+4 'turn pos on as was not on goto done on: let v=v-4 'pos was on so turn off goto done rev: pause 100 'revlight routine if (v and 1) <> 0 then goto onn 'rev light was on let v=v+1 ' not lit turn on 'turn rev on as was no on goto done onn: let v=v-1 'rev was on so turn off done: gosub strobev return IOswitch: ' I/O routine for 4 transition buttons if z=1 then let z =128 ' Fade to Black if z=8 then let z= 64 ' mix if z=2 then let z= 32 'wipe gosub IOPST return IOPST: 'I/O for PST bank to control 4 bits of IC5 if B = 3 and e = 254 then let y=14 'if PST 0 pressed turn on if B = 3 and e = 253 then let y=13 'if PST 1 pressed turn on if B = 3 and e = 251 then let y=12 'if PST 2 pressed turn on if B = 3 and e = 247 then let y=11 'if PST 3 pressed turn on if B = 3 and e = 239 then let y=10 'if PST 4 pressed turn on if B = 3 and e = 223 then let y=9 'if PST 5 pressed turn on if B = 3 and e = 191 then let y=8 'if PST 6 pressed turn on if B = 3 and e = 127 then let y=7 'if PST 7 pressed turn on if B = 4 and e = 239 then let y=6 'if PST 8 pressed turn on if B = 4 and e = 223 then let y=5 'if PST 9 pressed turn on i2c.begin IOb 'I/O port a' i2c.write y+z 'PST Bank to I/O i2c.end return IOkey: 'I/O for key bank to control 4 bits of IC4 if B=1 and e=254 then let w=14 'if key 0 pressed turn on if B=1 and e=253 then let w=13 'if key 1 pressed turn on if B=1 and e=251 then let w=12 'if key 2 pressed turn on if B=1 and e=247 then let w=11 'if key 3 pressed turn on if B=1 and e=239 then let w=10 'if key 4 pressed turn on if B=1 and e=223 then let w=9 'if key 5 pressed turn on if B=1 and e=191 then let w=8 'if key 6 pressed turn on if B=1 and e=127 then let w=7 'if key 7 pressed turn on if B=4 and e=251 then let w=6 'if key 8 pressed turn on if B=4 and e=247 then let w=5 'if key 9 pressed turn on i2c.begin IOa 'I/O port a' i2c.write w+x 'key bank to I/O i2c.end return IOpgm: 'I/O for PGM bank to control 4 bits of IC4 if B=2 and e=254 then let x= 224 'if PGM 0 pressed turn on if B=2 and e=253 then let x= 208 'if PGM 1 pressed turn on if B=2 and e=251 then let x= 192 'if PGM 2 pressed turn on if B=2 and e=247 then let x= 176 'if PGM 3 pressed turn on if B=2 and e=239 then let x= 160 'if PGM 4 pressed turn on if B=2 and e=223 then let x= 144 'if PGM 5 pressed turn on if B=2 and e=191 then let x= 128 'if PGM 6 pressed turn on if B=2 and e=127 then let x= 112 'If PGM 7 pressed turn on if b=4 and e=254 then let x= 96 'if PGM 8 pressed turn on if b=4 and e=253 then let x= 80 'if PGM 9 pressed turn on i2c.begin IOa 'I/O port a' i2c.write x+w 'PGM bank to I/O i2c.end return fade2black: if B=6 and e = 191 let s=s+1' turn on FTB lamp let B = 3 'set PST bank to 0 'PST to black let e = 254 gosub PSTlatch ' PST 0 gosub auto let s=s-1 'light off gosub strobes return auto: let s=s+192 'arrow lights on let t=t+4 'auto trans light on gosub strobet gosub strobes if Tbarpos = 255 then goto down 'virtual T-Bar down if Tbarpos = 0 then goto up 'virtual T-Bar up autotranoff: if (t and 4) <> 0 then let t = t -4 'autotrans off if (s and 128) <> 0 then let s=s -128 'arrow lights off if (s and 64) <> 0 then let s=s -64 'arrow lights off gosub strobes gosub strobet gosub cut return up: for Tbarpos = 0 to 254 ' step Tbar up let z= durtotal 'value set in 7 segs doo: let z=z-1 'loop that steps through the 7 seg delay if z > 0 then goto doo next Tbarpos 'end of T-Bar loop goto autotranoff 'go to auto light off and arrow light off down: for x = 1 to 255 'Step T- Bar down let Tbarpos = Tbarpos-1 'decrement T-Bar position let z= durtotal 'value set by 7 segs dooo: let z=z-1 'Delay loop set by 7 segs if z > 0 then goto dooo next x 'terminate T-Bar goto autotranoff 'light off ' ----------------------------------strobe the latches to move data to GVG Lamp Latches----------- stroben: let data1=n let address1=0 gosub latchmanager return strobeo: let data1=o let address1=01 gosub latchmanager return strobep: let data1=p let address1=02 gosub latchmanager return strobeq: let data1=q let address1=03 gosub latchmanager return strober: let data1=r let address1=04 gosub latchmanager return strobes: let data1=s let address1=05 gosub latchmanager return strobet: let data1=t let address1=06 gosub latchmanager return strobeu: let data1=u let address1=07 gosub latchmanager return strobev: let data1=v let address1=08 gosub latchmanager return strobew: let data1=w let address1=09 gosub latchmanager return latchmanager: i2c.begin PRT1 'Contol port' i2c.write tristate 'no command i2c.end i2c.begin PRT4 ' load n contents onto data bus i2c.write data1 i2c.end i2c.begin PRT3 ' Address hard latch i2c.write address1 i2c.end i2c.begin PRT1 ' Control port i2c.write lamps ' low i2c.end i2c.begin PRT1 ' switch lamp map off i2c.write tristate ' high i2c.end return analog1: i2c. begin PRT3 i2c. write tbar 'tbar address i2c. end i2c. begin PRT1 i2c. write conv 'line low i2c. end i2c. begin PRT1 i2c. write tristate 'high again i2c. end i2c. begin PRT1 i2c. write analogue 'analogue line low i2c. end i2c.reqfrom PRT4,1 Tbarpos = i2c.read 'tbar value i2c.end return analog2: i2c. begin PRT3 i2c. write 00 'analogue address i2c. end i2c. begin PRT1 i2c. write conv 'line low i2c. end i2c. begin PRT1 i2c. write tristate 'high again i2c. end i2c. begin PRT1 i2c. write analogue 'analogue line low i2c. end i2c.reqfrom PRT4,1 analogpot = i2c.read 'soft value value i2c.end return sevenseg1:'-------subrouting for the seven segment displays let et = et + 8 ' set the size of the incremnets if et = 81 then let et = 1 'retet the dispay after 9 i2c.begin PRT4 'data port' i2c.write et i2c.end i2c.begin PRT1 'Contol port' i2c.write ck 'ck low i2c.end i2c.begin PRT1 'Contol port' i2c.write tristate ' CK high i2c.end pause 400 return sevenseg2: let et2 = et2 + 8 if et2 = 82 then let et2 = 2 i2c.begin PRT4 'data port' i2c.write et2 i2c.end i2c.begin PRT1 'Contol port' i2c.write ck 'ck low i2c.end i2c.begin PRT1 'Contol port' i2c.write tristate ' CK high i2c.end pause 400 return sevenseg3: let et3 = et3 + 8 if et3 = 83 then let et3 = 3 i2c.begin PRT4 'data port' i2c.write et3 i2c.end i2c.begin PRT1 'Contol port' i2c.write ck 'ck low i2c.end i2c.begin PRT1 'Contol port' i2c.write tristate ' CK high i2c.end pause 400 return mixduration: 'add up and round off the product of the & segment displays let dur= et/8*100-12.5 let dur2 = et2/8*10-2.5 let dur3 = et3/8 let durtotal= INT ( dur+dur2+dur3)+1 ' "durtotal = lenght of mix return