Page 1 of 1

PIC18F25K42 UART issue

Posted: Wed Oct 14, 2020 12:27 pm
by mit2003
Hi Friends,

I am new to embedded programing.

I tried to develop and implement a simple task with PIC18F25K42 and PIC45K42.

Input1: Switch Output1: generally LED off and blinks if SW_ON. Actual LED status update through UART1.

Input2: Pot Output2: Periodically measures voltage and update value through UART2.


I got simulation result without any issues. But while i tried to compile to HEX, i got warnings and errors which i can't able to understand. Kindly let me know either the mistake i did or steps need to be follow for generating HEX file for implementation.

Note: HEX file successfully created without UART.


Error Message:
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
398: TXSTAbits.BRGH = 1;
^ (192) undefined identifier "TXSTAbits"
^ (196) struct/union required
401: SPBRG = (((4000000 / (9600)) - 8) / 16);
^ (192) undefined identifier "SPBRG"
402: RCSTA = 0;
^ (192) undefined identifier "RCSTA"
413: RCSTAbits.SPEN = 1;
^ (192) undefined identifier "RCSTAbits"
^ (196) struct/union required
416: TXSTAbits.TXEN = 1;
^ (196) struct/union required
419: RCSTAbits.CREN = 1;
^ (196) struct/union required
427: PIE1bits.RCIE = 0;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S151
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Uninit_1()
698: RCSTA = 0;
^ (192) undefined identifier "RCSTA"
699: TXSTA = 0;
^ (192) undefined identifier "TXSTA"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Send_1()
778: TXREG = nChar;
^ (192) undefined identifier "TXREG"
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Receive_1()
891: regcheck = (PIR1bits.RCIF);
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
volatile union S178 -> unsigned char
^ (181) non-scalar types can't be converted to other types
939: regcheck = (RCSTAbits.FERR);
^ (192) undefined identifier "RCSTAbits"
^ (196) struct/union required
942: dummy = RCREG;
^ (192) undefined identifier "RCREG"
949: regcheck = (RCSTAbits.OERR);
^ (196) struct/union required
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: 952: too many errors (21)
(908) exit status = 1
(908) exit status = 1

Error returned from [xc8.exe]

C:\Program Files (x86)\Flowcode\Common\Compilers\pic\batch\pic_xc8_comp.bat reported error code 1


Thanks in advance Hand.

Re: PIC18F25K42 UART issue

Posted: Wed Oct 14, 2020 12:44 pm
by Benj
Hello,

Your program is compiling ok for me with the K42 device, please can you use the Help -> Check for updates menu to make sure you are using the latest versions of the libraries.

Re: PIC18F25K42 UART issue

Posted: Thu Oct 15, 2020 5:26 am
by mit2003
Thanks Benj,

I will check and update the status.

Re: PIC18F25K42 UART issue

Posted: Thu Oct 15, 2020 6:49 am
by mit2003
Hi Benj,
Right now compiling without any error message.

Thanks a lot.