Jump to content

18F45K50 Portd And Porte Issues


Recommended Posts



When I compile the following I get errors relating to unknown registers on the 18F45K50 device.


trise = 0x00;


LKPSU_Firmware.c(2716:25): error: unknown identifier 'trise'
LKPSU_Firmware.c(2716:25): error: invalid operand 'trise'

commands to portd also generate errors but not as straightforward. the FC_CAL function is my abstraction function which works well on other devices.


LKPSU_Firmware.c(6126:12): error: invalid operand 'FC_CAL_Port_In_DDR__x((&FCP_PORT_D), (&FCP_TRIS_D), ( 0x1), ( 0x0))'
LKPSU_Firmware.c(6126:8): error: failed to generate expression
LKPSU_Firmware.c(6163:43): error: invalid identifier

Is there any way I can fix this? I have promised firmware to the Chinese for December the 25th and have it all done and ready to go except it won't currently compile on this device!


Link to comment
Share on other sites

Managed to make it work correctly by changing this in the BoostCPic18.h file. Might be other things lurking!


#ifdef _PIC18F45K50
- #include <PIC18F24K50.h>
+ #include <PIC18F45K50.h>
#endif // _PIC18F45K50



And this change in the PIC18F45K50.h file.


volatile char ccp2con @CCP2CON;
+volatile char trise @TRISE;
+volatile char trisd @TRISD;
volatile char trisc @TRISC;


volatile char ctmuconl @CTMUCONL;
+volatile char late @LATE;
+volatile char latd @LATD;
volatile char latc @LATC;


volatile char porte @PORTE;
+volatile char portd @PORTD;
volatile char portc @PORTC;



- indicates a line removed and + indicates a line added

Link to comment
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...