' ********************************************************************** ' * File: uk_BASAVR_001.BAS * ' * Version: 1.1 * ' * Date: 29.03.10 * ' * Development Tools: Bascom-AVR Demo Ver. 1.11.9.1 + * ' + + AVR bootloader grifo(r) Ver. 1.2 * ' * Cards: GMM AM08 + 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 001 of BASCOM AVR course. ' It executes simple operations on digital I/O, by using one push button and ' one LED available on GMM TST3. ' The program acquires the status of red push button T1 and set the same status ' on green LED L3. 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 am08 is mounted on Z1 socket of GMM TST3!! ' ' 29/03/10: uk_BASAVR_001.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 M8DEF.DAT file into the directory where the ' BASCOM AVR is installed and copy it if not present. ' 2) Into the window "Options | Compiler | Chip" set: ' Chip: m8def.dat ' XRAM: None ' HW Stack: 64 ' Soft Stack: 32 ' Framesize: 64 ' XRAM waitstate: disabled ' External Access Enable: disabled '************************* Compiler directives ********************************* $regfile "M8DEF.DAT" ' Definitions file for used microcontroller $romstart = &H0 ' Code start address on FLASH $crystal = 7372800 ' Microcontroller crystal frequency $hwstack = 64 ' Hardware stack space $swstack = 32 ' Software stack space $framesize = 64 ' Frame space $map ' Generate debug information '******************************* Definitions *********************************** ' The resources used by program are connected as described in following table: ' Resource GMM TST3 Z1 pin GMM AM08 pin uP signal ' T1 Button 12 6 PC5 , ADC5 , SCL ' L3 LED 13 7 PC4 , ADC4 , SDA Pint1 Alias Pinc.5 ' Bit with input signal connected to red push button T1 Pinl3 Alias Portc.4 ' Bit with output signal connected to grenn LED L3 '************************* Constants declaration ******************************* '************************* Variables declaration ******************************* Dim T1stat As Bit ' Boolean variable for T1 Button status '************************ Subroutines declaration ****************************** '****************************** Main program *********************************** Main: Ddrc.5 = 0 ' Initialize signal connected to T1 as digital input Ddrc.4 = 1 ' Initialize signal connected to L3 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 Loop ' End endless loop End '*************************** End of main program *******************************