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 RTU to ASCII

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



Joined: 14 Mar 2014
Posts: 6

View user's profile Send private message

Modbus RTU to ASCII
PostPosted: Fri Mar 14, 2014 8:14 am     Reply with quote

I am working on a project to read a RTU Modbus sensor and sent it through another port as ASCII, I read through CCS library and find Modbus master RTU from CCS compiler but I don't know how use two ports, one for coming in RTU and another going out ASCII
temtronic



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

View user's profile Send private message

PostPosted: Sat Mar 15, 2014 8:18 am     Reply with quote

first step...choose a PIC with two serial ports ! Something like the PIC18F46K22.
2nd step. cut code for a '1Hz flashing LED' program, to confirm your PIC is wired correctly,fuse are right, etc.
3rd step. cut code for 'Hello World' program, to confirm you can access both hardware UARTs, talk to PC, etc.
4th step,cut code to 'interface' to the MODBUS sensor....
5th step, cut code to take sensor data and send as ASCII to whatever.

5 steps..5 days...done ?

There's lots of information here on this forum, just use the 'search' feature to access them.CCS provides examples in the examples folder as well.


hth
jay
RF_Developer



Joined: 07 Feb 2011
Posts: 839

View user's profile Send private message

PostPosted: Mon Mar 17, 2014 2:57 am     Reply with quote

Are you trying to make a Modbus RTU to Modbus ASCII bridge? if so, the CCS Modbus code will have to be extensively modified to support two Modbus channels. The Modbus code assumes its the only Modbus node running on a PIC: it has no multi-port capability built-in. It will support both ASCII and RTU mode, but only by conditional compilation: it cannot switch, nor support both, on the fly at run time.

Also, since RTU uses timers, you're going to have to be very careful to make sure the ASCII code doesn't mess up the RTU timing. It might even be simpler to go for a two PIC solution with some intermediate transfer medium, e.g. non-modbus serial, in between. The CCS modbus code will quite happily run side-by-side with another serial port, just not with another Modbus port.
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