' ********************************************************************** ' ** Program: S1DEB8 - Version : 1.1 - 8 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 program allows to display an incremental counter on port. ' 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 of 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 ' '****************** Dichiarazione delle variabili ********************** ' Dim Stato As Integer ' variable for the proceduret 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 " VISUALIZATION OF THE COUNTER LOOP IN PROGRESS " Print " If switch 1 of the dip switch = off the counter is positive," Print " if switch 1 = on the counter is negative " Print Print " RESET THE CARD FOR EXIT " Print Scritt_port (&HFFFF) ' led of in the start time Lett_pdb = Inp(pdb) ' read the B port Val_pdb = Lett_pdb And 1 ' sensibilize only switch 1 of the dip switch If Val_pdb = 0 Then ' if yuo read 0 variable = 1 Valore = 1 Else Valore = &HFFFF ' if you read 1 variable = FFFFH End If Do Scritt_port (valore) ' write on A-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 switch 1 If Val_pdb = 0 Then ' read the B port status Valore = Valore + 1 ' increase the value Else Valore = Valore - 1 ' decrease the value 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 '