' ********************************************************************** ' * File: uk_BAS51_003.BAS * ' * Version: 1.1 * ' * Date: 12.04.10 * ' * Development Tools: Bascom 8051 COMP.,IDE 2.0.14.0 + FLIP 2.4.6 * ' * Cards: GMM 5115 + GMM TST3 * ' * Developed by: GRIFO(r) Italian Technology * ' * via Dell'Artigiano 8/6 * ' * 40016 S. Giorgio di Piano (BO) * ' * Tel. +39 051 892052 Fax. +39 051 893661 * ' * http://www.grifo.com http://www.grifo.it * ' * Author: Gianluca Angelini * ' ********************************************************************** ' Example program 003 of BASCOM 8051 course. ' It executes simple operations on digital I/O, by using one push button, one ' LED and the buzzer available on GMM TST3. ' The program acquires the status of red push button T1 and set the same status ' either on green LED L3 and on auto oscillator buzzer BZ1. Even the red LED L2 ' reports the status of T1 button, but this is an hardware management, not ' software. ' The program works only when the GMM 5115 is mounted on Z1 socket of GMM TST3!! ' ' 11/04/10: uk_BAS51_003.BAS - Ver 1.1 - By G.A. ' First version. ' ' '**************************** IDE Configurations ******************************* ' NOTE: in order to coorectly use this demo program, please execute the following ' steps: ' 1) Check the availability of 89C5115.DAT file into the directory where the ' BASCOM 8051 is installed and copy it if not present. ' 2) Into the window "Options | Compiler | Misc" set: ' Register File = 89C5115.DAT ' Byte End(Hex) = A0 ' Size warning = selected at 16384 (=4000H) '************************* Compiler directives ********************************* $regfile "89C5115.DAT" ' Definitions file for used microcontroller $romstart = &H0 ' Code start address on FLASH $iramstart = &H0 ' Data start address on internal RAM $ramstart = &H0 ' Data start address on external RAM $ramsize = &H100 ' External RAM size $crystal = 14745600 ' Microcontroller crystal frequency $large ' Code size > 2K $map ' Generate debug information '******************************* Definitions *********************************** ' The resources used by program are connected as described in following table: ' !!! Note: On GMM TST3 the following jumpers must be properly configured: ' J2 in 2-3 ; J8 in 2-3 ' ' Resource GMM TST3 Z1 pin GMM 5115 pin uP signal ' T1 Button 12 6 P2.1 ' LED L3 13 7 P2.0 ' Buzzer BZ1 15 9 P4.1 Pint1 Alias P2.1 ' Signal connected to red push button T1 Pinl3 Alias P2.0 ' Signal connected to green LED L3 Pinbz1 Alias P4.1 ' Signal connected to buzzer BZ1 '************************* Constants declaration ******************************* '************************* Variables declaration ******************************* Dim T1stat As Bit ' Boolean variable for T1 Button status '************************ Subroutines declaration ****************************** '****************************** Main program *********************************** Main: Pint1 = 1 ' Initialize signal connected to T1 as digital input T1stat = Pint1 Pinl3 = 1 ' Initialize signal connected to L3 as digital output, high Pinbz1 = 1 ' Initialize signal connected to BZ1 as digital output, high Do ' Begin endless loop T1stat = Pint1 ' Acquire and save T1 Button status Pinl3 = T1stat ' Set L3 LED with Button saved status Pinbz1 = T1stat ' Set BZ1 buzzer with Button saved status Loop ' End endless loop End '*************************** End of main program *******************************