MC908GZ60 running LED

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MC908GZ60 running LED

1,792 次查看
Josef
Contributor I
Hello,
I use the MC908GZ60 and CodeWarrior. I want to programm a simple running LED on Port A in C language.
I wrote a code like this:
 
 
char var1 = 0b00000001;
 
 
for(;:smileywink: {
 
 asm("rol      var1");
 PTA = var1;
 wait();     // function with loops for time delay
}
 
When I "make" the project i get following error message:
 
 
Error   : C18700: Unknown Opcode Operand Combination: Opc.:ROL/Dest.:Ext/Source:NoOp.
main.c line 90  
Error   : C18701: Unknown Opcode 19
main.c line 90  
Error   : Compile failed
 
Can anyone tell me what is wrong with my code?
Thanks for your help!
 
sincerly yours
Josef
 
 
 
标签 (1)
0 项奖励
回复
2 回复数

837 次查看
CompilerGuru
NXP Employee
NXP Employee
your var1 variable has an extended (16 bit) address, but rol only works with direct (8 bit) addresses.
So you either allocate var1 in direct memory:
#pragma DATA_SEG SHORT MY_ZEROPAGE
char var1 = 0b00000001;

or you change your code which does the rotate, for example to a load/rola/store
asm {
lda var1;
rola;
sta var1;
}

Daniel
0 项奖励
回复

837 次查看
Josef
Contributor I
Aha, yes with the new code it works.
Thank you for your quick answer!
 
One further little question. Do you know any good documentation for programming HC08 cores?
Which contains informations about the #pragma, interrupts, ... perhaps with little code examples.
The Help menu of CodeWarrior explains only how to define interrup service routines with the processor expert and the descriptions in the Data Sheet are even less
 
 
Josef
0 项奖励
回复