Help regarding compilation error and existing mistakes in my MODBUS programming
Posted: Wed Apr 14, 2021 8:05 am
Hi friends,
Looking for help regarding compilation error and idea / existing mistakes in MODBUS programming.
Thanks in advance.
I am trying to test Master slave communication for past one month. Tried with UART (RS232) but failed and Working with RS485 Multinode method but not reliable.
Realized MODBUS (RS485 - RTU) is the best choice. I google many articles but not get clear idea about MODBUS terminology.
Only "ModbusDemo" can be open, unfortunately can't open "ModBus_Master_Example", "ModBus_Slave_Example", "ModbusMasterDemo" and "ModBusSlaveDemo". If those sample files are accessible, i may get more clarity.
MODBUS Master file created based on "ModbusDemo" and compiled sucessfully.
MODBUS slave file created with the help of online articles (May be did mistakes) and tried to compile but Failed. I can't able to try further and looking for help. I attached Master, SLAVE_1 and SLAVE_2 Files (Just trying to transfer 16 nos of 16 bit data) (PIC18F46K42 with RS485 breakout board) Below one is Error message
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
551: INTCONbits.PEIE = 1;
^ (192) undefined identifier "INTCONbits"
^ (196) struct/union required
552: INTCONbits.GIE = 1;
^ (196) struct/union required
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Uninit_1()
908: 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_UpdateBaud_1()
1564: PIE1bits.RCIE = 1;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S151
1565: INTCONbits.PEIE = 1;
^ (192) undefined identifier "INTCONbits"
^ (196) struct/union required
1566: INTCONbits.GIE = 1;
^ (196) struct/union required
Modbus_SLAVE_2.c: default_isr()
9584: if ((PIR1bits.RCIF) && (PIE1bits.RCIE))
^ (255) not a member of the struct/union ""
^ (255) not a member of the struct/union ""
(199) logical type required ^
(199) logical type required ^
9591: PIR1bits.RCIF = 0;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S178
(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
FINISHED
Most probably, i may did mistakes. Kindly help me to fix this issue and complete Modbus Testing successfully.
My special thanks to Martin who is my inspiration.
Looking for help regarding compilation error and idea / existing mistakes in MODBUS programming.
Thanks in advance.
I am trying to test Master slave communication for past one month. Tried with UART (RS232) but failed and Working with RS485 Multinode method but not reliable.
Realized MODBUS (RS485 - RTU) is the best choice. I google many articles but not get clear idea about MODBUS terminology.
Only "ModbusDemo" can be open, unfortunately can't open "ModBus_Master_Example", "ModBus_Slave_Example", "ModbusMasterDemo" and "ModBusSlaveDemo". If those sample files are accessible, i may get more clarity.
MODBUS Master file created based on "ModbusDemo" and compiled sucessfully.
MODBUS slave file created with the help of online articles (May be did mistakes) and tried to compile but Failed. I can't able to try further and looking for help. I attached Master, SLAVE_1 and SLAVE_2 Files (Just trying to transfer 16 nos of 16 bit data) (PIC18F46K42 with RS485 breakout board) Below one is Error message
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Init_1()
551: INTCONbits.PEIE = 1;
^ (192) undefined identifier "INTCONbits"
^ (196) struct/union required
552: INTCONbits.GIE = 1;
^ (196) struct/union required
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC\PIC_CAL_UART.c: FC_CAL_UART_Uninit_1()
908: 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_UpdateBaud_1()
1564: PIE1bits.RCIE = 1;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S151
1565: INTCONbits.PEIE = 1;
^ (192) undefined identifier "INTCONbits"
^ (196) struct/union required
1566: INTCONbits.GIE = 1;
^ (196) struct/union required
Modbus_SLAVE_2.c: default_isr()
9584: if ((PIR1bits.RCIF) && (PIE1bits.RCIE))
^ (255) not a member of the struct/union ""
^ (255) not a member of the struct/union ""
(199) logical type required ^
(199) logical type required ^
9591: PIR1bits.RCIF = 0;
^ (255) not a member of the struct/union ""
^ (182) illegal conversion between types
int -> volatile union S178
(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
FINISHED
Most probably, i may did mistakes. Kindly help me to fix this issue and complete Modbus Testing successfully.
My special thanks to Martin who is my inspiration.