|
|
View previous topic :: View next topic |
Author |
Message |
butterfly
Joined: 04 Jun 2006 Posts: 35
|
how to make look up table |
Posted: Tue Jun 06, 2006 2:49 am |
|
|
�'m new in CCS.
I WANT TO MAKE A LOOKUP TABLE. LIKE THAT ASEMBLY.
Saltprog
BANKSEL SSAYICI
MOVFW SSAYICI
Addwf PCL,F
RETLW 0xFF
RETLW 0xFF
RETLW 0xFF
RETLW 0xFF
RETLW 0xFF
RETLW 0xFF
RETLW 0xFF
RETLW 0xFF
ANY ADVICE YOU CAN GIVE ME?? |
|
|
Ttelmah Guest
|
|
Posted: Tue Jun 06, 2006 4:37 am |
|
|
const int8 val[] = {1,2,3,5,6,7,8};
Then if you access 'val[n]' where 'n' is 0 to 6 in the example given, you get the value requested (you would need '0xff' in each location for the example you show). This generates exactly the version shown in your assembler, for a PIC 12/16 chip (on the 18 chips, the ability to directly access the program memory is used instead, allowing two bytes to be packed per instruction).
Best Wishes |
|
|
butterfly
Joined: 04 Jun 2006 Posts: 35
|
|
Posted: Tue Jun 06, 2006 6:36 am |
|
|
i have write
BYTE CONST TABLE [10]= {9,8,7,6,5,4,3,2,1,0};
that error mesaje happen:
a numaric expression must appear here
i could not understand why?
thanks for help |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Jun 06, 2006 6:48 am |
|
|
Code: | BYTE CONST TABLE [10]= {9,8,7,6,5,4,3,2,1,0}; |
change to
Code: | const BYTE TABLE[10]= {9,8,7,6,5,4,3,2,1,0}; |
|
|
|
Ttelmah Guest
|
|
Posted: Tue Jun 06, 2006 6:49 am |
|
|
There is nothing wrong with the line as typed. It is probably something on the line(s) in front.
Remember this a 'declaration', and wants to be either outside the code, or at the start of a routine.
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|