/* ** ################################################################### ** ** Filename : FreescaleCMT.C ** ** Project : FreescaleCMT ** ** Processor : MC9S08RE16_44 ** ** Version : Driver 01.02 ** ** Compiler : Metrowerks HCS08 C Compiler ** ** Date/Time : 14.03.2003, 17:29 ** ** Abstract : ** ** Main module. ** Here is to be placed user's code. ** ** Settings : ** ** ** Contents : ** ** No public methods ** ** ** Copyright: 1997 - 2009 Freescale Semiconductor, Inc. All Rights Reserved. ** ** ** ** http : www.freescale.com ** mail : support@freescale.com ** ** ################################################################### */ /* MODULE FreescaleCMT */ /* Including used modules for compilling procedure */ #include "Cpu.h" #include "Events.h" #include "CM1.h" /* Include shared modules, which are used for whole project */ #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" volatile byte OnEnd; /* The OnEnd event flag */ void SendBytePWM(byte Data) /* Sends a byte by PWM modulated signal */ { byte i; OnEnd=0; if(Data & 0x01) { (void)CM1_SetSpaceWidthMode(1); /* LSB=1 */ } else { (void)CM1_SetSpaceWidthMode(0); /* LSB=0 */ } (void)CM1_Enable(); /* Enable the signal output */ for(i=7;i!=0;i--){ /* Send the rest of the byte - 7 bits */ Data = Data >> 1; /* Right shift the data */ while(!OnEnd) ; /* Wait for OnEnd event - end of modulation cycle */ OnEnd = 0; /* Clear the event flag */ if(Data & 0x01) { (void)CM1_SetSpaceWidthMode(1); /* bit=1 */ } else { (void)CM1_SetSpaceWidthMode(0); /* bit=0 */ } } while(!OnEnd) ; /* Wait for OnEnd event - end of modulation cycle */ (void)CM1_Disable(); /* Disable the signal output */ } void main(void) { /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /*Write your code here*/ SendBytePWM(0xa9); /* Send 0xa9 as a data */ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/ /* END FreescaleCMT */ /* ** ################################################################### ** ** This file was created by Processor Expert 03.16 for ** the Freescale HCS08 series of microcontrollers. ** ** ################################################################### */