View previous topic :: View next topic |
Author |
Message |
Jan
Joined: 30 Aug 2016 Posts: 5
|
#device PIC12F1840 |
Posted: Tue Aug 30, 2016 5:09 am |
|
|
Hi there,
I'm using a PIC12F1840 and hava a question concerning the #device directive. In the CCS manual the *=x option is described as follows:
*=5: Use 5 bit pointers (for all parts)
*=8: Use 8 bit pointers (14 and 16 bit parts)
*=16 Use 16 bit pointers (for 14 bit parts)
Can you please tell me which option is the right one for my PIC12F1840 and how you found it out? Little explanation would be great.
Thanks a lot,
Jan |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Tue Aug 30, 2016 5:42 am |
|
|
Using larger pointers, makes the code bigger, but gives access to more RAM.
If you look at the data sheet, you will find the program memory for your chip is 4K*14. So this is a 14bit part. So you can use any of the options.
It's down to how much RAM your code needs to access. When you compile, it'll tell you how much ROM & RAM are being used. If you need more RAM, you have to increase the pointer size. If you are not using much RAM, you can reduce the code size, by selecting the smaller option.
Just updated this. Worth adding, that the compiler (on modern versions) automatically defaults to the pointer that is needed to access all the RAM on your chip. You only need to change this if you need to reduce the RAM to save ROM. |
|
|
Jan
Joined: 30 Aug 2016 Posts: 5
|
|
Posted: Wed Aug 31, 2016 12:49 am |
|
|
Hi Ttelmah,
thanks a lot! That was exactly what I wanted to know.
Jan |
|
|
|