After-10 - DEMO9S08QG8 IRQ-controlled Led flasher#include for EnableInterrupts macro#include"derivative.h include peripheral

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// DEMO9S08QG8 IRQ-controlled Led flasher #include <hidef.h> /* for EnableInterrupts macro */ #include "derivative.h" /* include peripheral declarations */ #include "M68DEMO908GB60.h" unsigned char blinking=0; // This is the IRQ interrupt servicing routine void interrupt VectorNumber_Virq IRQ_isr() { IRQSC_IRQACK = 1; // acknowledge IRQ interrupt (clear IRQF) // IRQ interrupt is disabled below to avoid bouncing noise: IRQSC_IRQIE = 0; // disable IRQ interrupt blinking = !blinking; // change blinking state } void main(void) { unsigned int temp; PTADD = 0; //set port A for input (switches) PTAPE = 0xf0; //set the Pull-Up-Enable for port A PTFDD = 0x0f; //set port F for output (LEDs 1 through 4) PTFD = 0xff; // ALL LEDs OFF LED4 = ON; // LED4 ON IRQSC = bIRQPE | bIRQIE; // IRQ pin enabled, IRQ interrupt enabled // default falling edge detection // IRQSC = bIRQPE | bIRQIE | bIRQEDG // IRQ pin enabled, inter enable, rising edge EnableInterrupts; // enable interrupts (CCR:I = 0) while (1) { __RESET_WATCHDOG(); /* feeds the dog */
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/07/2009 for the course CPEG 222 taught by Professor Robb,b during the Fall '08 term at University of Delaware.

Page1 / 12

After-10 - DEMO9S08QG8 IRQ-controlled Led flasher#include for EnableInterrupts macro#include"derivative.h include peripheral

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online