' ********************************************************************** ' ** Program name: S1DEB9.BAS - Version : 1.1 - 03 June 1999 ** ' ** Compiler : BASCOM LT, (IDE V.1.20, LIB V.1.27) ** ' ** Board : GPC(r) 552 ** ' ** 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 two LEDs to two different directions. ' To achieve the visualization of the lines, you should connect the CN2 ' connector of GPC(r) 552 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 &HFFF8 ' port A data register Dim Pdb As Const &HFFF9 ' port B data register Dim Pdc As Const &HFFFA ' port C data register Dim Cnt As Const &HFFFB ' control register ' '************************** Variable declarations **************************** ' Dim Shifter1 As Byte , Shifter2 As Byte' Lighting shifters Dim Dir As Bit ' Direction selector Waitms 1 ' Delay for signals settling Out Cnt , &B10000010 ' Configure port B for input, ' port A and C for output ' '***************************** Main Program ********************************** ' Print " Demonstration program 9 for section 1 of DEB(r) 01 board" Print : Print " Shifts two LEDs to two different directions." Print : Print " Running..." Print Dir = 0 ' Moves to gather LEDs Do If Dir = 0 Then ' If LEDs gathered Shifter1 = 1 ' Resets shifter values to move them away Shifter2 = 128 Else ' Else Shifter1 = 128 ' Resets shifter values to gather them Shifter2 = 1 End If While Shifter1 <> 0 Shifter1 = Not Shifter1 ' Negates shifters to drive LEDs in Shifter2 = Not Shifter2 ' negated logic Out Pda , Shifter1 ' Drives red LEDs Out Pdc , Shifter2 ' Drives other LEDs Shifter1 = Not Shifter1 ' Restore normal values for shift Shifter2 = Not Shifter2 If Dir = 0 Then ' If direction is to gather LEDs Rotate Shifter1 , Left ' Shift red LED to the left Rotate Shifter2 , Right ' Shift other LED to the right Else ' Else Rotate Shifter1 , Right ' Shift red LED to the right Rotate Shifter2 , Left ' Shift other LED to the left End If Waitms 255 ' Delay to get few shifts per second Wend Dir = Not Dir ' Direction change Loop End ' '*************************** End of Main program ***************************** '