GuoSheng Yang

Problem with 9S08DZ60 PWM output

Discussion created by GuoSheng Yang on Jan 25, 2007
Latest reply on Jan 25, 2007 by Frank Volker

See the below, This program code of PWM can run EVB9S08DZ60 but we don't generat PWM .
Could you help me check it ?  Could you send me a source code of PWM about EVB9S08DZ60 ?

Thank you very much for you help!

 

#include <hidef.h>
#include "derivative.h" /* include peripheral declarations */

#define   PUSH_PTA4 0
#define   PUSH_PTA5 1
#define   PUSH_PTA6 2
#define   PUSH_PTA7 3

char push;
/////////////////////////////////////////////////////////////////////////////////////////
// PeriphInit
// --------------------------------------------------------------------------------------
// Initializes various registers and peripherals
/////////////////////////////////////////////////////////////////////////////////////////
void PeriphInit(void)
{
   
 // Clear COP Watchdog timeout
 SOPT1 = 0x00;
 
 // Select FBE MCG mode (IREFS=0, CLKS=10)
 MCGC1 = 0xB8;
 // LP=0 and selects external high frequency crystal clock                   
 MCGC2 = 0x36;
 // PLLS=0
 MCGC3 = 0x00;
 // Wait until the initialization cycle of the external crystal clock is completed
 while(!(MCGSC&0x02))
   ;   
 
 //Select fBUS/2 as ADC clock source, clock divide 2 and 8 bit conversion mode
 ADCFG = 0x21;
 
 // Configure PTD port as output and power off LEDs
 PTDD = 0xFF; 
 PTDDD = 0xFF;

 // Enable AD1 and AD2 pins
 APCTL1 = 0x06;
 
 // Enable PTB input pull-downs
 PTBDD = 0x00;
 PTBPS = 0xFF;
 PTBES = 0xFF;
 PTBPE = 0xFF;
 
 
 //tpm1 configure
 TPM1MODH = 0x00;
 TPM1MODL = 0x50;
 TPM1SC = 0x0f;
 
 
 TPM1C0VH = 0x00;
 TPM1C0VL = 0x14;
 TPM1C0SC = 0x14;
 
 //TPM1C0VH = 0x00;
 //TPM1C0VL = 0x14;
 //TPM1C0SC = 0x5a;
 // Enable PTA4, PTA5, PTA6 and PTA7 input pull-ups
 PTAPE = 0xF0;
 
}

/////////////////////////////////////////////////////////////////////////////////////////
// MAIN
/////////////////////////////////////////////////////////////////////////////////////////
void main (void)
{


 
 PeriphInit();
 EnableInterrupts;
 
 push = PUSH_PTA4;
 for(;:smileywink:
 {
   
   
 }   

}

- Mod Corrected Subject line -

Message Edited by Alban on 2007-01-25 01:49 PM

Outcomes