Johannes Philippi

MC9S08DZ60 and Code Warrior + Processor Expert

Discussion created by Johannes Philippi on Jul 12, 2007
Latest reply on Jul 16, 2007 by Alban Rampon
I'm new to the HCS08 (but not new th uCs).
 
1. Where can I find suppert for Processor Expert for the MC9S08DZ60 microcontroller?
 
2. I'm using a DEMO9S08DZ60 demo-board by www.axman.com. Using P&E Multilink for flashing the uC from CodeWarrior.
 
Why doesn't the Timer-Interrupt work in the "True Time Simulator & Real Time Debugger" in the following code? Everything seems to be working normally, except the timer. Never reaching the ISR.
TPM1CNT(L,H) -register is not changing - normally I suppose it should increase (i.e. up-count), but it isn't in the Simulator/Debugger.
I tried to run the programm with real time debugger, and without... no difference, the programm does not work :smileysad:((
 
 
Code:
#include <hidef.h> /* for EnableInterrupts macro */#include "derivative.h" /* include peripheral declarations */ /* type definitions -------------------------------------- */typedef unsigned char UINT8;typedef signed char    SINT8;typedef unsigned int    UINT16;typedef int                   SINT16;typedef unsigned long int UINT32;typedef long int            SINT32; /* define LED's */#define LED2 PTBD_PTBD3#define LED1 PTCD_PTCD5 /* interrupts -------------------------------------------- */interrupt  Vtpm1ovf  void  intT1C1(void) {      LED1 = ~LED1;  //toggle LED1    TPM1SC_TOF;  TPM1SC_TOF = 0; }/* functions --------------------------------------------- */void init_timer (void){   TPM1SC_CPWMS = 0; //up counter   TPM1SC_PS0 = 1;   //prescaler = 128  TPM1SC_PS1 = 1;  TPM1SC_PS2 = 1;  TPM1SC_TOIE = 1;  //enable overflow interrupt  TPM1MODH = 0x00;  TPM1MODL = 0xff;    //top-value for timer= 255, overflows to zero   TPM1SC_CLKSB = 0;  TPM1SC_CLKSA = 1; //select bus clock  -->start timer  //now the timer should run/count, but it isn't  //TPM1CNTH,TPM1CNTL counter value registers} void main(void){   init_timer();   PTBDD_PTBDD3 = 1;  PTCDD_PTCDD5 = 1;    LED1 = 1;     // off; LEDs are active low  LED2 = 1;     // off;    EnableInterrupts; /* enable interrupts */  /* include your code here */   for(;;)  {       __RESET_WATCHDOG(); /* feeds the dog */       LED2 = 0;  //LED2 on   } /* loop forever */  /* please make sure that you never leave main */}

 

 
So why doesn't the timer work?
 
where to find example C-Codes for HCS08 on the net? (for ADC, UART, CAN, Timer, ISR, kind of tutorial for all features. Like there exists for Atmels and Pics they have so huge net-supporting community, for HCS08 there not much support on the net.... :smileysad:  )
 
Thanks,
Johannes

--
Alban Edit: moved, renamed and code formatted for legibility and to increase likelyhood of answer.


Message Edited by Alban on 2007-07-12 02:32 PM

Outcomes