View previous topic :: View next topic |
Author |
Message |
Mojtababm
Joined: 19 Nov 2017 Posts: 1
|
problem with modbus_phy_layer.h lib |
Posted: Sun Nov 19, 2017 2:18 am |
|
|
I have an error in driver modbus:
*** Error 128 "C:\Program Files (x86)\PICC\Drivers\modbus_phy_layer.h" Line 78(14,18): A #DEVICE required before this line
This is my first code:
Code: |
#include <modbus.h>
#define MODBUS_BUS SERIAL
#define MODBUS_TYPE MODBUS_TYPE_MASTER
#define MODBUS_SERIAL_TYPE MODBUS_RTU
#define MODBUS_SERIAL_INT_SOURCE MODBUS_INT_RDA
#define MODBUS_SERIAL_ENABLE_PIN PIN_C6
#define MODBUS_SERIAL_RX_ENABLE PIN_C7
#define MODBUS_SERIAL_BAUD 9600
#include "modbus.c"
#define LCD_ENABLE_PIN PIN_B0
#define LCD_RS_PIN PIN_B1
#define LCD_RW_PIN PIN_B2
#define LCD_DATA4 PIN_B4
#define LCD_DATA5 PIN_B5
#define LCD_DATA6 PIN_B6
#define LCD_DATA7 PIN_B7
#include <lcd.c>
void main()
{
modbus_init();
lcd_init();
while(TRUE)
{
}
}
|
This problem is in default drivers.
pls help |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9229 Location: Greensville,Ontario
|
|
Posted: Sun Nov 19, 2017 8:19 am |
|
|
No, the default drivers do work fine... every CCS supplied driver and example program has worked for the past 20+ years.
YOUR program is NOT fine.....
Hint: check any CCS supplied example program....
Observe what is ALWAYS the first line of their program...
Hint: WHAT PIC computer have you told the compiler, in your code, that you are using ?
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19516
|
|
Posted: Sun Nov 19, 2017 12:37 pm |
|
|
The order is completely wrong Just look at the example.
modbus.c _loads modbus.h_.
You need the processor include, fuses, clock settings, then the modbus defines, and then just include modbus.c
This is exactly what the example shows. |
|
|
|