' ********************************************************************** ' ** Program: gmbiote.BAS - Version : 1.1 - 29 January 2004 ** ' ** Compiler : Bascom AVR IDE - LIB 1.11.7.4 ** ' ** Scheda : GMB HR84 and GMM AM08 ** ' ** Society: 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 ** ' ********************************************************************** ' ' Rel. 1.1 29.01.04 - By Graziano Gaiba ' ' This demo allows to use immediatly TTL I/O digital lines available on CN4. ' According to Mini Module used, the list of lines existing is printed. ' After selecting the line to use it can be managed as input (its status is ' shown continuously on console) or as output (setting it high or low). ' Should the line selected be associated to Real Time Clock, this peripheral ' manages it. ' ' Compiled file is smaller than 2048 bytes, so it can becompliled with free ' demo of BASCOM AVR. ' ' ' !!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ' In menu Options | Compiler | Chip, set: ' ' Chip: M8 ' HW Stack: at least 64 ' Soft Stack: at least 32 ' Framesize: at least 64 ' ' $regfile = "m8def.dat" $crystal = 7372800 $baud = 19200 ' '****************** Constants declatation *********************** ' Const Cret = 13 ' Carriage return Const Nl = 10 ' New line Const Clrscr = 12 ' Clear screen Const Bell = 7 ' Bell ' '****************** Variables declaration ********************** ' ' Generic use Dim R As Byte , C As Byte , V As Byte , T As Byte Dim S As Byte Dim Vbit As Bit ' '********************* Procedures declaration ************************** ' ' No Procedure ' '************************** Main program ****************************** ' Main: Print Chr(clrscr); ' Clear screen Print "Demo 1.1 for GMB HR84 ds 100203" Print Do Print "CN4 features follwong I/O TTL:" Print Print "1) Pin 2" Print "2) Pin 3" Print "3) Pin 5" Print "4) Pin 6" Print Print "Select: "; Do V = Inkey() Loop Until V <> 0 Print Chr(v) Print Do Print "Input/Output (I/O)? " ; R = Waitkey() R.5 = 1 ' Changes in lowercase Loop Until R = "i" Or R = "o" Print Chr(r) If R = "i" Then Ddrb = Ddrb And &HC5 ' Sets all bit as input Print "Press a key to exit" Print "Pin status:" Do If V = "1" Then Vbit = Pinb.5 ' Pin 2 of CN4 End If If V = "2" Then Vbit = Pinb.3 ' Pin 3 of CN4 End If If V = "3" Then Vbit = Pinb.4 ' Pin 5 of CN4 End If If V = "4" Then Vbit = Pinb.1 ' Pin 6 of CN4 End If Print Vbit ; Chr(13); Waitms 200 S = Inkey() Loop Until S <> 0 Else Ddrb = Ddrb Or &H3A ' Sets all bit as output Do Print "Pin status (0/1; 2 exit): "; C = Waitkey() Print Chr(c) C = C - "0" ' Converts in number If C <> 2 Then Vbit = C.0 If V = "1" Then Portb.5 = Vbit ' Pin 2 of CN4 End If If V = "2" Then Portb.3 = Vbit ' Pin 3 of CN4 End If If V = "3" Then Portb.4 = Vbit ' Pin 5 of CN4 End If If V = "4" Then Portb.1 = Vbit ' Pin 6 of CN4 End If End If Loop Until C = 2 End If Loop End ' '************************ Program end *************************** '