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

Modbus protocol creating trouble for 16f628A chip

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



Joined: 23 Aug 2007
Posts: 14

View user's profile Send private message

Modbus protocol creating trouble for 16f628A chip
PostPosted: Thu Sep 27, 2007 12:47 am     Reply with quote

I have used the 16f877A chip for modbus protocol by using ccs driver modbus.c, it works fine!
Bur when i used 16f628A chip for that purpose the serial port is creating problem. What should i change in the driver to be applicable for 16f628A chip.
Any help will be appreciable.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 27, 2007 11:29 am     Reply with quote

Post the pins that you are using in these #define statements.
Code:

#define MODBUS_SERIAL_RX_PIN
#define MODBUS_SERIAL_TX_PIN
#define MODBUS_SERIAL_ENABLE_PIN
#define MODBUS_SERIAL_RX_ENABLE
 


Post your compiler version.
buneri



Joined: 23 Aug 2007
Posts: 14

View user's profile Send private message

Modbus 16f628A
PostPosted: Thu Sep 27, 2007 10:52 pm     Reply with quote

Thx for reply!

Compiler Version PCWH 4.020
I m trying for RS232

#define USE_WITH_PC 1

#include <16f628A.h>
#device *=16
#fuses HS,NOLVP, NOBROWNOUT, NOPROTECT, PUT
#use delay(clock=20M)

#define MODBUS_TYPE MODBUS_TYPE_SLAVE
#define MODBUS_SERIAL_RX_BUFFER_SIZE 64
#define MODBUS_SERIAL_BAUD 9600

#ifndef USE_WITH_PC
#define MODBUS_SERIAL_INT_SOURCE MODBUS_INT_RDA
#define MODBUS_SERIAL_TX_PIN PIN_B0 // Data transmit pin
#define MODBUS_SERIAL_RX_PIN PIN_B1 // Data receive pin

//The following should be defined for RS485 communication
#define MODBUS_SERIAL_ENABLE_PIN PIN_C1 // Controls DE pin for RS485
#define MODBUS_SERIAL_RX_ENABLE PIN_C2 // Controls RE pin for RS485

#else
#define MODBUS_SERIAL_INT_SOURCE MODBUS_INT_RDA
#endif
adrian



Joined: 08 Sep 2003
Posts: 92
Location: Glasgow, UK

View user's profile Send private message

Re: Modbus 16f628A
PostPosted: Fri Sep 28, 2007 5:36 am     Reply with quote

buneri wrote:

#define MODBUS_SERIAL_INT_SOURCE MODBUS_INT_RDA
#define MODBUS_SERIAL_TX_PIN PIN_B0 // Data transmit pin
#define MODBUS_SERIAL_RX_PIN PIN_B1 // Data receive pin


Tx is on the wrong pin to use the hardware USART - it should be on B2. Because you have specified the wrong pin, the software USART is configured.
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