Irregular I/O Port function

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Irregular I/O Port function

1,172 Views
Josef
Contributor I
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
Labels (1)
0 Kudos
2 Replies

340 Views
nucklear
Contributor I
The programming or developing tool uses some lines (PTA0, PTA1, PTB0, PTB1 and PTB4) to enter monitor mode. That's why you can't debug and use those lines at the same time. If you run in stand alone mode, those lines will be available.
 
I experienced your same problem when running a simulation in CodeWarrior, but when tested on real hardware in stand-alone mode, it worked just fine.
 
Hope this helps
 
:smileyhappy:
0 Kudos

340 Views
Josef
Contributor I
Thank you for your answer!
I will get my board in a few days and then i will test it on the real hardware.
I hope it works right there!
 
0 Kudos