Irregular I/O Port function

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Irregular I/O Port function

1,383件の閲覧回数
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
ラベル(1)
0 件の賞賛
返信
2 返答(返信)

551件の閲覧回数
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 件の賞賛
返信

551件の閲覧回数
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 件の賞賛
返信