CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

problem with modbus_phy_layer.h lib

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Mojtababm



Joined: 19 Nov 2017
Posts: 1

View user's profile Send private message

problem with modbus_phy_layer.h lib
PostPosted: Sun Nov 19, 2017 2:18 am     Reply with quote

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 Shocked
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 19, 2017 8:19 am     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Sun Nov 19, 2017 12:37 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group