View previous topic :: View next topic |
Author |
Message |
Dorjoo17
Joined: 10 Aug 2019 Posts: 4 Location: Mongolia
|
Hello Modbus RTU Error 100 and Error 12 |
Posted: Wed Aug 14, 2019 10:33 pm |
|
|
Pls. Help me !!!!!!!
This is a Pic CCS project for Modbus RTU Master Slave communication. The beginning is where I am looking for sample program for PIC CCS of Modbus RTU communication. And then I found a sample project in
github.com, Here: https://github.com/worrajak/PICmodbus/blob/master/ModBus.DSN.
This is a PIC CCS compiler project for modbus RTU communication built with C language, by Worrajak.
Some problem is i have five errors:
Here:
* Error 100 "C:\Program Files\PICC\Drivers\modbus_phy_layer_rtu.c" Line 77(8,154): USE parameter value is out of range Not a number: PIN_B1
* Error 12 "C:\Program Files\PICC\Drivers\modbus_phy_layer_rtu.c" Line 273(13,26): Undefined identifier MODBUS_SERIAL
* Error 12 "C:\Program Files\PICC\Drivers\modbus_phy_layer_rtu.c" Line 355(12,25): Undefined identifier MODBUS_SERIAL
* Error 12 "C:\Program Files\PICC\Drivers\modbus_app_layer.c" Line 33(15,40): Undefined identifier PIN_B2
* Error 12 "C:\Users\Dorjoo\Downloads\PICmodbus-master\PICmodbus-master\lcd.c" Line 62(14,15): Undefined identifier -- set_tris_d
This project is here: https://github.com/worrajak/PICmodbus/blob/master/ModBus.DSN |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Wed Aug 14, 2019 11:30 pm |
|
|
Your top link doesn't work.
However at least two of the errors suggest you are building for a
different chip. The original was built for something with a lot of pins,
while you are building for one with less. So your chip doesn't have a
port_d...
On anything like this, all the settings have to be changed to match
whatever chip you are compiling for. In this case getting to line 77,
implies you are using software serial rather than a UART (so you
have MODBUS_SERIAL_INT_SOURCE set to MODBUS_INT_EXT).
If so you need MODBUS_SERIAL_RX_PIN (and TX_PIN) #defined
to suitable pins on your PIC.
The second and third errors are because of the first (the port has not
opened so does not exist). |
|
|
Dorjoo17
Joined: 10 Aug 2019 Posts: 4 Location: Mongolia
|
|
Posted: Sun Nov 03, 2019 9:41 am |
|
|
Hello Ttelmah.
Sorry for late reply. Today is show your comment
This project link: https://github.com/worrajak/PICmodbus
It is possible this different CCS compiler version?
Last edited by Dorjoo17 on Sun Nov 03, 2019 9:49 am; edited 1 time in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Nov 03, 2019 9:47 am |
|
|
Quick answer...
Probably not a compiler issue. Your link shows code designed for 18F458 and 16F690.
Have to ask are you using both of those PICs ? If not, you'll have to change your programs to whatever PICs you're using.
Sorry, I don't use MODBUS, others do and may be able to help, but we'd have to know which PICs you're using.
Jay |
|
|
Dorjoo17
Joined: 10 Aug 2019 Posts: 4 Location: Mongolia
|
Thank you |
Posted: Sun Nov 03, 2019 9:55 am |
|
|
I used both pic's because Modbus master and slave. Master is 18f458 and slave is 16f690. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sun Nov 03, 2019 10:52 am |
|
|
I've just taken the modbus master code there, and compiled it.
Compiled fine with the current compiler. So then tried older versions.
Went right back to 5.027, and it compiled fine with every version I tried.
Then tried the slave code and it too is fine.
Key is that the master will give the error you are describing, if you build it
for the wrong chip. If you try to build the master for a PIC16 it'll give
exactly the error you show. Build it for the PIC18, and it compiles fine.
The slave compiles fine for the PIC16. Check you are setting the chip
correctly in the IDE window (assuming you are using the IDE). |
|
|
Dorjoo17
Joined: 10 Aug 2019 Posts: 4 Location: Mongolia
|
|
Posted: Sun Nov 03, 2019 6:03 pm |
|
|
Thank you |
|
|
|