Josef Zinner

Irregular I/O Port function

Discussion created by Josef Zinner on Oct 31, 2006
Latest reply on Nov 13, 2006 by Josef Zinner
Hello,
I use the MC908GZ60 and the CodeWarrior IDE version 5.7.0
I just want all Ports A...G define as output. And switch them to 1.
 
Therfore I wrote this code:
 
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
 
void main(void) {
 EnableInterrupts; /* enable interrupts */
 /* include your code here */
 
 PTA = 0xFF;  
 PTB = 0xFF;
 PTC = 0xFF;
 PTD = 0xFF;
 PTE = 0xFF;
 PTF = 0xFF;
 PTG = 0xFF;                              
 
 DDRA = 0xFF;
 DDRB = 0xFF;
 DDRC = 0xFF;
 DDRD = 0xFF;
 DDRE = 0xFF;
 DDRF = 0xFF;
 DDRG = 0xFF;
 for(;:smileywink: {
   __RESET_WATCHDOG(); /* feeds the dog */
 } /* loop forever */
 /* please make sure that you never leave main */
}
But it doesnt work.
If i do single steps until line "DDRA = 0xFF;" nothing happens in Data1 window. The next step changes _PTA and _PTE into 63 (0b00111111) 
Why this?
If i insert after the line DDRG = 0xFF; 
this: PTA = 0xFF;
PTA changes into 255.
 
Thanks for all answers!
 
josef

Outcomes