/* ********************************************************************** * File: Hello_uk.c - Rel. 1.1 Compiler: uC/51 V. 1.20.04 * * GRIFO(R) via Dell'Artigiano 8/6 40016 S. Giorgio di Piano (BO) * * Hardware: CAN GM1.20 * * Tel. +39 051 892052 Fax. +39 051 893661 * * http://www.grifo.com http://www.grifo.it * * by Graziano Gaiba 31.01.06 * ********************************************************************** 31/01/06: Hello_uk.C - Rel 1.1 - By Graziano Gaiba Program preloaded im mini modules. Makes the on-board LEDs blink. Note To avoid problems do not use complex operations on a single source line, especially inside procedures by using their parameters or their local variables. */ /*************** Header, constant, data structure, etc. ********************/ #include "canary.h" //#define FQZ 14745600 // F quartz in Hz of CAN GM1 #define FQZ 20000000 // F quartz in Hz of CAN GM1.20MHz /**************************************************************************** General purpose functions and card hw sections management functions ****************************************************************************/ void delay(unsigned int rit) /* Executes a software delay of del milliseconds, calibrated on a 14.7456 MHz or 20 MHz CPU Clock */ { unsigned int r,rit1ms; if(FQZ==14745600) rit1ms=100; // Experimental value for 1 msec. delay using 80c32 else rit1ms=136; do { for (r=0 ; r0); } void init_cpu(void) /* Perform some specific initialization of CPU SFRs, necessary for following operations. */ { CKCON=0x00; // Set X1 clock mode = standard mode AUXR=0x0C; // Selects ERAM on external data area EECON=0x00; // Disables internal EEPROM } /**************************************************************************** Main program ****************************************************************************/ void main(void) { init_cpu(); // Initializes the used CPU // Set the TTL signals connected to LEDs as outputs P2_6=1; P2_7=1; for(;;) { P2_6=0; // Turn on LD1 P2_7=1; // Turn off LD2 delay(200); // Pause for 200 milliseconds P2_6=1; // Turn off LD1 P2_7=0; // Turn on LD2 delay(200); // Pause for 200 milliseconds } }