//Displaying numbers on all 7-Seg LEDs of Dragon12+ Trainer Board //with HCS12 Serial Monitor Program installed. This code is for CodeWarrior IDE //On Dragon12+ board we have 4-digit common cathode 7-Seg LEDs //PORTB drives 7-Seg LEDs (anode) See Page 24 of Dragon12+ User's Manual //and PTP0-PTP3 provide grounds (cathode) to 7-Seg LEDs #include /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ void MSDelay(unsigned int); void main(void) { /* put your own code here */ DDRB = 0xFF; //PORTB output DDRP = 0xFF; //PORTP output for(;;) { PORTB = 0x5B; //number 2 PTP = 0x0E; //on the most left digit of 7-Seg MSDelay(1); //Increase the delay to 100ms on all 4 to see what heppens PORTB = 0x3F; PTP = 0x0D; MSDelay(1); PORTB = 0x06; PTP = 0x0B; MSDelay(1); PORTB = 0x7F; //number 8 PTP = 0x07; //on the most right digit of 7-Seg MSDelay(1); } } void MSDelay(unsigned int itime) //millisec delay { unsigned int i; unsigned int j; for(i=0;i