12 hour Digital clock or 24 hour digital clock
Budget: $30 – $250 USD
Need this in 1 day
This is the board that must be used
Dragon12-Plus-USB Trainer
For Freescale HCS12 microcontroller family
Digital clock
Use the lights to display the time in binary or some encoded fashion OR use the LCD to display the time You have the option to:
Choose a Pre-Selected Project from the Sample Project list in the Course Information section.
Choose your own project to be completed using Dragon12-Light Board DVB-023DB.
The Twelve Hours Digital clock (HH:MM: SS, AM/PM) will:
Use the lights to display the time in binary or some encoded fashion OR use the LCD to display the timer in the format of HH:MM: SS; AM or PM
im using CodeWarrior and i am trying to use this in C program
PLEASE use this and format it as such
//*****************************************************************
// Include derivative-specific definitions
//*****************************************************************
//The microcontroller chip used by Dragon12-plus2 board
#include <mc9s12dg256.h> /* derivative information */
//*****************************************************************
// Gloable Variables
//*****************************************************************
//*****************************************************************
// Function Prototype
//*****************************************************************
void InitSwitches(void);
void InitLEDs(void);
void DelayTime(unsigned int,unsigned int);
//*****************************************************************
// Main program section
//*****************************************************************
void main(void)
{
/* put your own code here */
InitSwitches();
InitLEDs();
//do this forever
for (;;)
{
unsigned char x;
x = PTH; //get data from DIP Switches via. PTH
DelayTime(1, 4000); //optional, delay some time
PORTB = x; //and send it to PORTB LEDs
DelayTime(1, 4000); //optional
}
}
//*****************************************************************
// Function: InitSwitches
//*****************************************************************
void InitSwitches(void)
{
DDRH = 0x0; //make port PTH an input port for reading DIP switches
}
//*****************************************************************
// Function: InitLEDs
//*****************************************************************
void InitLEDs(void)
{
//LEDs are connected to PORTB on Dragon12-plus2
DDRB = 0xFF; //make PORTB an output for LEDs
//PTJ1 controls the LEDs connected to PORTB on Dragon12
DDRJ = 0xFF; //make port PTJ an output port
PTJ=0x0; //make PTJ1 low to enable LEDs
//PTP0, PTP1, PTP2 and PTP3 of port PTP control the 4 units of the seven seg. display
//GRB LED is controlled by PP4-PP6: PP4=1, red; PP5=1, blue; PP6=1, green
DDRP = 0xFF; //make port PTP an output port
PTP = 0x4F; //make PTP0-PTP3 high to disable the seven seg. dispaly
//and make PTP6 high to turn on green RGB LED
}
//*****************************************************************
// Function: DelayTime
//*****************************************************************
//provide milli seconds delay
void DelayTime(unsigned int i_limit, unsigned int j_limit)
{
unsigned int i;
unsigned int j;
for(i=0;i<i_limit;i++) {
for(j=0;j<j_limit;j++) {
//do nothing
}
}
}
//*****************************************************************
// Interrupt Service Routines
//*****************************************************************
This is the board that must be used
Dragon12-Plus-USB Trainer
For Freescale HCS12 microcontroller family
Digital clock
Use the lights to display the time in binary or some encoded fashion OR use the LCD to display the time You have the option to:
Choose a Pre-Selected Project from the Sample Project list in the Course Information section.
Choose your own project to be completed using Dragon12-Light Board DVB-023DB.
The Twelve Hours Digital clock (HH:MM: SS, AM/PM) will:
Use the lights to display the time in binary or some encoded fashion OR use the LCD to display the timer in the format of HH:MM: SS; AM or PM
im using CodeWarrior and i am trying to use this in C program
PLEASE use this and format it as such
//*****************************************************************
// Include derivative-specific definitions
//*****************************************************************
//The microcontroller chip used by Dragon12-plus2 board
#include <mc9s12dg256.h> /* derivative information */
//*****************************************************************
// Gloable Variables
//*****************************************************************
//*****************************************************************
// Function Prototype
//*****************************************************************
void InitSwitches(void);
void InitLEDs(void);
void DelayTime(unsigned int,unsigned int);
//*****************************************************************
// Main program section
//*****************************************************************
void main(void)
{
/* put your own code here */
InitSwitches();
InitLEDs();
//do this forever
for (;;)
{
unsigned char x;
x = PTH; //get data from DIP Switches via. PTH
DelayTime(1, 4000); //optional, delay some time
PORTB = x; //and send it to PORTB LEDs
DelayTime(1, 4000); //optional
}
}
//*****************************************************************
// Function: InitSwitches
//*****************************************************************
void InitSwitches(void)
{
DDRH = 0x0; //make port PTH an input port for reading DIP switches
}
//*****************************************************************
// Function: InitLEDs
//*****************************************************************
void InitLEDs(void)
{
//LEDs are connected to PORTB on Dragon12-plus2
DDRB = 0xFF; //make PORTB an output for LEDs
//PTJ1 controls the LEDs connected to PORTB on Dragon12
DDRJ = 0xFF; //make port PTJ an output port
PTJ=0x0; //make PTJ1 low to enable LEDs
//PTP0, PTP1, PTP2 and PTP3 of port PTP control the 4 units of the seven seg. display
//GRB LED is controlled by PP4-PP6: PP4=1, red; PP5=1, blue; PP6=1, green
DDRP = 0xFF; //make port PTP an output port
PTP = 0x4F; //make PTP0-PTP3 high to disable the seven seg. dispaly
//and make PTP6 high to turn on green RGB LED
}
//*****************************************************************
// Function: DelayTime
//*****************************************************************
//provide milli seconds delay
void DelayTime(unsigned int i_limit, unsigned int j_limit)
{
unsigned int i;
unsigned int j;
for(i=0;i<i_limit;i++) {
for(j=0;j<j_limit;j++) {
//do nothing
}
}
}
//*****************************************************************
// Interrupt Service Routines
//*****************************************************************