' ********************************************************************** ' ** Program: S1DEB7 - Version : 1.1 - 2 March 1999 ** ' ** Compilator : BASCOM LT, (IDE V.1.20, LIB V.1.27) ** ' ** Card : GPC(r) F2 ** ' ** 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 ** ' ** ** ' ** Developed by: Enea Tassinari ** ' ********************************************************************** ' ' This programm allows to display the two way direction of the Led in ON ' status accordig the position of Switch 1 of the dip switch. ' In order to make an easier visualization of the status lines, it is ' necessary to get a 20 pins flat cable for connecting GPC(r)F2 CN2 ' connector to TIO 16 CN1 connector, or DEB 01 CN15 connector. ' '*********************************************************************** ' '****************** Compiler directive ********************************* ' $romstart = &H8050 ' address start of the code machine $ramstart = &HD000 ' address start of the data area $ramsize = &H2800 ' put to 10K the data area $crystal = 11059200 ' clock frequency of the microcontroller $baud = 9600 ' RS-232 comunication speed $large ' address to 16 bit ' '****************** Constant declaration ******************************* ' Dim Cnt As Const &HFA03 ' register of command end control of the 82c55 Dim Pda As Const &HFA00 ' data register kf A port Dim Pdb As Const &HFA01 ' data register of B port Dim Pdc As Const &HFA02 ' data register of C port ' '****************** Procedure declaration **************************** ' Declare Sub Scritt_port(stato As Integer)' procedure for write on A and C port ' '****************** Variables declaration **************************** ' Dim Temp As Word ' variable for aritmetic operation Dim Stato As Integer ' variable for the procedure scritt_port Dim Valore As Word ' variable for write on the port Dim Bytel As Word ' variable for the procedure Scritt_port Dim Byteh As Word ' variable for the procedure Scritt_port Dim Lett_pdb As Byte ' variable for read the B port Dim Val_pdb As Byte ' variable mask of the B port ' '************************* Program main ******************************* ' Main: Waitms 1 ' delay for signals arrangement Out Cnt , 130 ' program 0 mode, A-C port = output and B port = input Out Pda , 255 ' led off in the start time Out Pdc , 255 ' led off in the start time Print Print " VISUALIZATIN OF THE LED RUN IN PROGRESS " Print " Press any key for exit " Print Print " Change the switch 1 position to inverte the run " Print Scritt_port (&HFFFF) ' led off in the start time Lett_pdb = Inp(pdb) ' read B port status Val_pdb = Lett_pdb And 1 ' sensibilize only switch 1 of the dip switch If Val_pdb = 0 Then ' If you read 0 the variable = 1 Valore = 1 Else Valore = &H8000 ' if you read 1 the variable = 8000H End If Do Temp = &HFFFF - Valore ' the card work in negative logic Scritt_port (temp) ' write on A and C port the contents of the variable Waitms 100 ' delay of 100 ms Lett_pdb = Inp(pdb) ' read the dip switch status Val_pdb = Lett_pdb And 1 ' sensibilize only the switch 1 If Val_pdb = 0 Then ' read the B port status If Valore = &H08000 Then ' light the first led after the last it Valore = 1 ' light the first led Else Rotate Valore , Left ' shift the middle bit End If Else If Valore = 1 Then ' light the last led after the first it Valore = &H8000 ' light the final led Else If Valore = 256 Then ' light the lad that have weight 256, Valore = 128 ' and after light the led that have waight 128 Else Rotate Valore , Right'shift the middle bit in right direction End If End If End If Loop End ' '************************ End main program ***************************** ' ' '**************************** Procedure ******************************** ' ' Procedure for write on A and C port with only integer variable. ' data input:stato = port value ' data output:nothig Sub Scritt_port (stato As Integer) Bytel = Stato And &HFF ' mask the high byte Byteh = Stato And &HFF00 ' mask the low byte Byteh = Byteh / 256 ' shift the high byte in the low byte position Out Pda , Bytel ' write on A port the contents of the varaible bitel Out Pdc , Byteh ' write on the C port the contents of the variable byteh End Sub '