340_Lab1_Cfile

340_Lab1_Cfile - #pragma LINK_INFO DERIVATIVE...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// 340_lab1_1 - Part A - tested 6-6-2009 kj // Wytec evb-plus demo board - 24 MHz; Codewarrior 5.9.0 // Inputs DIP-switch states (Port H) and outputs to LEDs (Port B) // Must set all DIP-switches in "UP" (ungrounded input) position. .. // . ..before activating hardware RESET to avoid shorted-port alarm #include <hidef.h> /* common defines and macros */ #include <mc9s12dg256.h> /* derivative information */
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: #pragma LINK_INFO DERIVATIVE "mc9s12dg256b" void main(void){ char c; DDRB = 0xff; // Ports B = output DDRH = 0x00; // Ports H = input DDRJ = 2; // In order to use Wytec LEDs set PJ1 = output. .. PTJ = 0; // . .. and reset PJ1 to 0 while(1){ // while(1) creates an endless program loop. c = PTH*3; // read DIP switches PORTB = c; // output to LEDs } }...
View Full Document

This document was uploaded on 04/19/2011.

Ask a homework question - tutors are online