Constant Pointers In Program Memory

Constants In Program Memory Issues Although PIC24 has 3 bytes per instruction, you can only store data in 2 of them. Therefore program memory usage is 3x actaul data size. C30 uses 16 bits for pointers. By default it expects all constants to be in 32K of program memory address space. This is a limitation […]

Read More

Assembler

Notes Bit Numbers Use # in front of the number, so bit 0 is "#0" Special Function Registers You can use SFR's in the assembler directly instead of including via an input or output.  Doing this is faster as the compiler won't move the SFR via W0 and instead will access it directly. Multiple Assembler Statements Use "/n" to […]

Read More

IO

IO Defines //Output define examples #define MY_OUTPUT _LATD0 #define MY_OUTPUT(state) _LATF0 = state //<<<This method better for compatibility with with other compilers #define MY_OUTPUT(state) LATCbits.LATC1 = state //Input define examples #define MY_INPUT _RF2 //Port define examples #define DATA_BUS_IP PORTD #define DATA_BUS_OP(data) LATD = data #define DATA_BUS_TRIS(state) TRISD = state Peripheral Pin Select //—– INPUTS —– […]

Read More