|
|
View previous topic :: View next topic |
Author |
Message |
alen12
Joined: 14 Mar 2014 Posts: 6
|
Modbus RTU to ASCII |
Posted: Fri Mar 14, 2014 8:14 am |
|
|
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
|
|
Posted: Sat Mar 15, 2014 8:18 am |
|
|
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
|
|
Posted: Mon Mar 17, 2014 2:57 am |
|
|
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. |
|
|
|
|
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
|