Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- From: "albertleng" <albertleng@xxxxxxxxx>
- Date: 22 Aug 2006 18:54:43 -0700
Dave Slee wrote:
<albertleng@xxxxxxxxx> wrote in message
news:1155798448.552750.278310@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
My VB project is to act as a Modbus Slave that receives data from a
Fire Alarm and will response to requests/polls from a Modbus Master
which issues a 04 Read Input Registers commands to the project. The
data from Fire Alarm is continuous while the requests/polls from the
Modbus Master are periodical.
I'm doing this for employment. Since the timeframe given is very short
and my company is cost-conscious, i dont think i can switch my
programming platform other than VB. That means i still have to stick to
using VB for this.
OK. VB6 or .net? If your background is computer science, you will probably
get along better with .net, but for a quick and dirty hack VB6 is probably
easier to start with.
You say the company is cost concious. I think we all know what you mean! I
would still suggest that you persuade the dark forces of finance to shell
out for some development assistance for you. At the very least get an
ActiveX or OCX for a MODBUS slave otherwiuse you will spend weeks of work
understanding and interpreting standards to write a standard block of code
that you can download a trial of today and buy tomorrow. I googled and
picked one at random that seemed to have good documentation:
http://www.win-tech.com/html/demos.htm
Mbsv7OCX.zip (206K)
Read the documentation that comes with the control. You can see how many API
calls that are supported and the depth of the structure of the whole thing.
This is more than half of your project! Now you can see why these components
cost from $0 to $1000 each - you save days of work. I don't know about your
line of business, but if I spend $1000 and save between 1 and 2 days of
time, I got a bargain. Ask yourself what sort of support and assistance you
are going to get for $0 too. The control above costs $300 - bet you can't
code that in a day!
Another poster on this group suggested a different control - probably very
good - so bend his arm to give you a free trial and report back to us
telling you about your experience. Don't forget that if the code turns out
to be good, buy it and thank the vendor. As someone who is setting out on
the road of becoming a software author, you will appreciate that its good to
get paid too!
I'm writing a functional specifications now before i jump into writing
codes. That will be better.
Perhaps you can give me some more advice for this project like
functions to use, data types, timing and so on since this is my first
VB project. I may post questions from time to time.
Take a look at the documentation on the above control. That will give you a
mighty leg up on the project.
The other side of the project might cause you some fun and games. One of the
things wrapped up in the MODBUS ActiveX controls is all of the serial port
handling, which can be very tricky if you are new to either VB or serial
comms. You will no doubt go down the road of using the MSCOMM control in VB.
It all *looks* very simple when things go right. But the world is a complex
place, so you have to figure out what to do if your serial message is
corrupt. For example, what happens if you come in half-way through a
message? Are the fire alarm messages fixed length or are they delimited by
say a [CR][LF]? Is there a checksum? What happens if the fire alarm is not
connected? Do you set a value in a register that says "Fire Alarm
Communications Fault". How long do you wait for a new message? All this
stuff goes in your functional specification - don't worry yet about how to
fix it.
There are alternatives to the MSCOMM control and in .net 2.0 you will find
that there is a similar control for serial ports.
There is lots and lots of help on all of the above out on the Web. There are
some other newsgroups that can probably help you with the programming part
of this project - sci.engr.control is a good place for specifics like MODBUS
and control in the real world. Other groups that might help could be:
microsoft.public.vb.*
Best of luck...
Dave Slee
Riding Mill Energy Contracts Ltd.
Thanks.
I tried to simulate Master and Slave in my PC with ModScan and ModSlave
from win-tech. They worked well where Slave could response to the polls
by ModScan without any error.
Since my PC has no RS485 ports, i used a RS232 to RS485 converter but
this time, the Slave could receive the polls from the Master but the
Master kept showing "Invalid response from Slave" and "Message Time
Out". Fyi, i connected the A+ and B- to pin 2 and pin 3 respectively
and i twisted them to try also. Also, GND to GND also. But it still
didnt work.
.
- Follow-Ups:
- Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- From: Dave Slee
- Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- References:
- Conversion of RS232 serial data from Fire Alarm to MODBUS
- From: albertleng
- Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- From: Dave Slee
- Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- From: albertleng
- Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- From: Dave Slee
- Conversion of RS232 serial data from Fire Alarm to MODBUS
- Prev by Date: Re: Safety Shutdown Systems: Design, Analysis, and Justification by Paul Gruhn & Harry L. Cheddie
- Next by Date: Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- Previous by thread: Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- Next by thread: Re: Conversion of RS232 serial data from Fire Alarm to MODBUS
- Index(es):
Relevant Pages
|