'' ********************************************************************** ' ** Program name: S1DEB7.BAS - Version : 1.0 - 10 May 1999 ** ' ** Compiler : BASCOM LT, (IDE V.1.20, LIB V.1.27) ** ' ** Board : GPC(r) 323 ** ' ** Firm: grifo(r) ITALIAN TECHNOLOGY ** ' ** Via Dell' Artigiano 8/6 40016 San Giorgio di Piano (BO) ** ' ** Tel.+39 051 892 052 Fax +39 051 893 661 ** ' ** http://www.grifo.com http://www.grifo.it ** ' ** sales@grifo.it tech@grifo.it grifo@grifo.it ** ' ** ** ' ** Written by: Graziano Gaiba ** ' ********************************************************************** ' ' This program shifts the lighting of a LED to one direction or the other ' according to the status of switch 1. If switch 1 is OFF shifts from the red ' LEDs to the others. ' To achieve the visualization of the lines, you should connect the CN7 ' connector of GPC(r) 323 board to the CN15 connector of DEB(r) 01 board by ' a 20-pin flat cable. ' '************************ Compiler Directives ******************************* ' $romstart = &H8050 ' start address of machine code $ramstart = &HD000 ' start address of data area $ramsize = &H2800 ' 10k of data area $crystal = 22118400 ' clock of microcontroller $baud = 19200 ' RS-232 baud rate $large ' 16 bit addressing mode ' '************************** Constant declarations **************************** ' Dim Pda As Const &HFFFC ' port A data register Dim Pdb As Const &HFFFD ' port B data register Dim Pdc As Const &HFFFE ' port C data register Dim Cnt As Const &HFFFF ' control register Dim Dsw1 As Const &HFFF9 ' dip switch register ' '************************** Variable declarations **************************** ' Dim Shifter As Byte ' Lighting shifter Dim Dip As Byte ' Stores status of dip-switches Dim Porta As Bit ' If 1 selects port A, else selects port C Waitms 1 ' Delay for signals settling Out Cnt , &B10000010 ' Configures port B for output, ' port A e C for input ' '***************************** Main Program ********************************** ' Print " Demonstration program 7 for section 1 of DEB(r) 01 board" Print : Print " Shifts the lighting of a LED to one direction (from red LEDs to others)" Print " if switch1 1 is OFF, otherwise shifts to the other direction." Print " BE CAREFUL ! Do not touch the switches 5, 6, 7 and 8." Print : Print " Running..." Print Shifter = 1 ' Starts with the LSB Porta = 1 ' Selects port A as first Do Shifter = Not Shifter ' Negates to drive LEDs in negated logic If Porta = 0 Then ' If port C selected Out Pda , 255 ' Turns off port A LEDs Out Pdc , Shifter ' Drives port C LEDs Else Out Pda , Shifter ' Drives port A LEDs Out Pdc , 255 ' Turns off port C LEDs End If Shifter = Not Shifter ' Restores normal value for rotation Waitms 255 ' Delay for few rotations per second Dip = Inp(dsw1) ' Reads the dip-switches Dip = Dip And &B00000001 ' Isolates switch 1 If Dip <> 0 Then ' If switch 1 OFF Rotate Shifter , Left ' Shift from red LEDs to others Else Rotate Shifter , Right ' Else does the opposite End If If Shifter = 0 Then ' If rotation is over Porta = Not Porta ' Switch selection between port A and C If Dip <> 0 Then ' If switch 1 OFF Shifter = 1 ' Restart shifting from red LEDs to others Else Shifter = 128 'Else restart shifting to the other direction End If End If Loop End ' '*************************** End of Main program ***************************** '