' ********************************************************************** ' * File: uk_BASAVR_006.BAS * ' * Version: 1.1 * ' * Date: 26.04.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 006 of BASCOM AVR course. ' It executes simple operations on digital I/O, by using the GMM AM08 on board ' LED. ' The program generates a base timing of one second that changes status to ' activity LED DL1. The base timing is generated by proper WAITMS instruction ' of BASCOM AVR, that generates a variable delay from 1 to 65535 milliseconds. ' ' Added instructions: WAITMS. ' ' 26/04/10: uk_BASAVR_006.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 ' LED DL1 18 12 PB5 , SCK Pindl1 Alias Portb.5 ' Bit with output signal connected to DL1 on GMM AM08 '************************* Constants declaration ******************************* '************************* Variables declaration ******************************* Dim Dl1stat As Bit ' Boolean variable for DL1 LED status '************************ Subroutines declaration ****************************** '****************************** Main program *********************************** Main: Ddrb.5 = 1 ' Initialize signal connected to DL1 as digital output, high Dl1stat = 1 ' Initialize DL1 status as disabled Do ' Begin endless loop Dl1stat = Not Dl1stat ' Invert variable with DL1 status Pindl1 = Dl1stat ' Set DL1 LED with new status ' Perform 1 second delay: uses proper instruction WAITMS Waitms 1000 ' Perform a delay of 1000 milliseconds=1 second Loop ' End endless loop End '*************************** End of main program *******************************