Hi All, Am trying to re-write a code in PLM51 to embedded C. There is a statement in PLM51 as below.
DECLARE TASK(17) STRUCTURE(PNTR BYTE,STATUS BYTE,DELAY WORD); DECLARE DELAY_HEAD BYTE AT (.TASK(0).PNTR); //ERROR LINE//
What i have understood from this is-- DELAY_HEAD is a byte variable which resides at the same location as that of TASK(0).PNTR.(From the PLM51 manual)
I have rewritten the same into C as below.
struct tsk { unsigned char PNTR ; unsigned char STATUS; unsigned int DELAY; }TASK[17]; unsigned char DELAY_HEAD _at_ &TASK[0].PNTR ;
But its giving error 221:non-constant case/dim expression. Plss help..!!
Hi, I shall check with the case of the variables.I shall try with unions too. I have rewritten those statements as below:
struct tsk *tskptr = &TASK[0].PNTR; unsigned char DELAY_HEAD = tskptr->PNTR;
This is giving error:247
I have to use the variable(delay_head)itself because its used in too many places and would be confusing to access the TASK[0].PNTR directly..
Pls tell me what to do...!!!
Thanks..!!
Or have the C program just access task[0].pntr instead of delay_head.
By the way - note that when porting your PLM51 code to C, i _strongly_ urge you to switch case for your variables. All-capital letters are normally reserved for preprocessor symbols, and another developer who sees code with huge amounts of upper-case symbol names will get a heart attack while desperately trying to look up what your symbols "expands" to.
Please pay attention to the instructions for posting source code:
www.danlhenry.com/.../keil_code.png
How about using a union ?
View all questions in Keil forum