/* **********PWMod.c***************** Pulse Width Modulation using Output Compare for the MC68HC11EVB PA6-3 outputs connected to 4 motors This example accompanies the book "Embedded Microcomputer Systems: Real Time Interfacing", Brooks-Cole, copyright (c) 2000, Jonathan W. Valvano 7/6/99 Interface between the TExaS simulator running a MC68HC11 EVB with ICC11 freeware compiler TExaS Copyright 1999 by Jonathan W. Valvano for more information about ICC11 see http://www.imagecraft.com You may use this file without restrictions */ #include "HC11.h" void main(void){ PACTL=0x80; /* PA7 is ouput */ /* PA6,PA5 clear on OC1 */ TCTL1=0xAF; /* PA4,PA3 set on OC1 */ TMSK2=0x00; /* 500ns TCNT */ OC1M=0x78; /* OC1 activates PA6-3 */ /* OC1 sets PA6,PA5 */ OC1D=0x60; /* OC1 clears PA4,PA3 */ TOC1=0xFFFF; /* period 32ms on all waves */ /* (20*65535)/100 */ TOC2=0x3333; /* 20% on OC2/PA6 */ /* (40*65535)/100 */ TOC3=0x6666; /* 40% on OC3/PA5 */ /* (60*65535)/100 */ TOC4=0x9999; /* 60% on OC4/PA4 */ /* (80*65535)/100 */ TOC5=0xCCCC; /* 80% on OC5/PA3 */ while(1){} }; void resetVectors(void){ /* not really a function, but this must be last */ asm(" org $FFFE"); asm(" FDB __start"); asm(" org $FC00"); /* puts rts in a harmless place */ /* string constants also placed here */ /* the value FC00 means you can have up to 1000 characters of strings */ }