I have been doing some programming on a 16 bit pic, a PIC24FJ32GA002.
In many ways it is a huge improvement over all the 8 bit PICs that I have used, but it also has some flaws.
In particular, the RAM is arranged as 8 bit memory, which can be accessed 16 bits at a time, as long as the address is even.
Now when doing data tables, it is usual to calculate offsets and use indirect addressing, but if the address end up as odd, the processor resets. It can be avoided using byte addressing, (8 bit) instead word addressing but of course it takes twice as many operations to handle the data and it really makes the whole 16 bit concept a bit pointless.
Has anyone got any comments or workarounds? I will probably be putting traps for odd addressing all over my code from now on, but I wondered if there were any neat ways of aproaching it.
In many ways it is a huge improvement over all the 8 bit PICs that I have used, but it also has some flaws.
In particular, the RAM is arranged as 8 bit memory, which can be accessed 16 bits at a time, as long as the address is even.
Now when doing data tables, it is usual to calculate offsets and use indirect addressing, but if the address end up as odd, the processor resets. It can be avoided using byte addressing, (8 bit) instead word addressing but of course it takes twice as many operations to handle the data and it really makes the whole 16 bit concept a bit pointless.
Has anyone got any comments or workarounds? I will probably be putting traps for odd addressing all over my code from now on, but I wondered if there were any neat ways of aproaching it.