/************************************************************* * jl16-1.c - Demonstrate simple I/O functions of MC68HC908JL16 * * Port A, bit 1 - input from switch (0 = pressed, 1 = not pressed) * Port A, bit 0 - output to LED anode (1 = LED on, 0 = LED off) * * When the switch is pressed, the LED comes on * * Revision History * Date Author Description * A. Weber Initial Release * 09/05/05 A. Weber Modified for JL8 processor * 01/13/06 A. Weber Modified for CodeWarrior 5.0 * 08/25/06 A. Weber Modified for JL16 processor * 05/08/07 A. Weber Some editing changes for clarification * 04/22/08 A. Weber Added "one" variable to make warning go away * 07/09/12 A. Weber Removed code to set security bytes * 05/29/13 A. Weber Renamed CWJL-1.c to jl16-1.c *************************************************************/ #include /* for EnableInterrupts macro */ #include "derivative.h" /* include peripheral declarations */ void main(void) { unsigned char one = 1; // EnableInterrupts; /* enable interrupts */ /* include your code here */ CONFIG1_COPD = 1; // disable COP reset PTAPUE_PTAPUE1 = 1; // Enable pull-up for switch on PTA1 DDRA_DDRA0 = 1; // Set PTA bit 0 for output while (one) { // Loop forever if (PTA_PTA1) PTA_PTA0 = 0; else PTA_PTA0 = 1; } /* please make sure that you never leave this function */ }