//Toggling PORTT0 to sound the buzzer for Freescale Student Project Board Using HCS12 MCU Module //On Student Project Board, PT0 of PORTT is connected to buzzer/speaker permanently. It is accessed by BZ jumper. //MAKE SURE jumper for BZ (buzzer) is set. BZ JUMPER is part of group of jumpers called UFEA right next to the Buzzer itself //This program toggles PT0 to sound the buzzer. Change the delay size to get a different sound //See Chapter 7 of Mazidi & Causey HCS12 textbook for bit manipulation in C programs. //In CodeWarrior,Make sure you are in TBDML Mode before downloading //Press F7 (to Make), then F5(Debug) to downLOAD,and F5 once more to start the program execution #include /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ void MSDelay(unsigned int); void main(void) { /* put your own code here */ DDRT = DDRT | 0b00000001; // PTT0 as output for (;;) { PTT = PTT | 0b00000001; //make PT0=1 MSDelay(100); //change the delay size to see what happens PTT = PTT & 0b11111110; //Make PT0=0 MSDelay(100); //change delay size.... } } void MSDelay(unsigned int itime) //msec delay { unsigned int i; unsigned int j; for(i=0;i