At 09:32 AM 4/14/99 -0500, you wrote:
{Quote hidden}>Darlene wrote:
>-----Original Message-----
>From: Darlene Magnusson <
.....darleneKILLspam
@spam@ZIRCON.COM>
>>First, I tried :
>>#byte PCL =2
>>
>>#asm
>>movf bit,W
>>addwf PCL,F
>>...
>>#endasm
>>
>>I got:
>>Error: expression must evaluate to a constant
>
>
>Usually I find that error when I have not defined a variable. When I tried
>this code, CCS returned "UNDEFINED ERROR" and then MPLAB crashed!
>
>Are you defining BIT as an integer variable ( int bit; ), or as a bit
>location (#DEFINE bit 5) ? If bit is not an integer variable, all hell
>might break loose.
>
bit is declared as an integer (int bit;) , sorry I left that line out.
{Quote hidden}>>
>>Then I tried:
>>#byte PCL=2
>>
>>#asm
>>movplw
>>addwf bit,W
>>movwf PCL
>>...
>>#endasm
>>
>>I got:
>>Error: undefined identifier
>
>Still sounds like a variable not defined. I still can't figure out what the
>movplw is supposed to do. Forget inline assembly and use standard C.
>
>A standard C syntax way of making a lookup table is this: (and it works in
>CCS!) This is copied directly from one of my programs that really does
>compile, BTW.
>
>int time;
>int index = [ some number between 0 and 32]
>
>static const int lookup[33] = { 9, 10, 11, 12, 13, 13, 14,
>15, 16, 16, 17, 18, 19, 20, 21, 22,
> 23, 23, 24, 25, 26, 27, 28, 29, 29, 29, 30, 31,
>31, 31, 31, 31, 31 };
>
>time = lookup[index];
>
Thank you for the suggestion but I don't think this type of table won't work
for my application, my table is more like a switch statement (ie. if bit is
equal to 5, set the 5th bit). I was trying to find the most efficient way of
doing this.