I have been working on a CAN file that I can include for a PIC18F46K80 that has an internal ECAN module. The SFR registers for this function total to approximately 278 registers! Fortunately, many of them repeat their function. Since I don't want to hardcode all these registers, I have been looking for a way to address them like an array. In the main code you have a variable that determines which block of registers you are sending the data to. It was suggested to me to use the EXT function and offsets to accomplish this.
I think I can then point at the next address by using CAN_Buffer+1 = .......Code:@CAN_Buffer = B2D0 'load CAN_Buffer with the address of B2D0 CAN_Buffer VAR BYTE EXT 'tell PBP it is byte sized but doesn't need to assign space
Now the catch. In the 18f46k80 and probably others, the SFR's cross bank segments. Do I have to declare the bank to use the EXT function? I have the CAN bus speed selection worked out but now want to be able to point at the various buffer spaces. Any ideas?
Thanks


Reply With Quote

Bookmarks