PLC to VB - How to handle PLC data With VB

A

Thread Starter

Anonymous

Sys Config = PLC 32+ Inputs & Outputs + VB6 HMI

I have a driver to establish com with the PLC via VB, and I am able read inputs & outputs in to VB w/o any issues.

I read single bits and update On/Off indicators on the GUI. This to me seems like not the most efficient way to go. Especially when I want to poll the plc every 1 to 2 seconds.

#1) What is the preferred method of doing this?

Do I read the data in words and then do a bitwise operation in VB and assign results to my HMI display controls?

#2) Would this (Bitwise OP) slowdown my VB program considerably? Especially if I want to poll the PLC every 1 or 2 seconds?

I/Os in the PLC may grow past 256 in the future. So I am trying to learn the best way to do this and see what approaches the GURUs use and recommend.

Your help will be much appreciated!

-Bitwise & Byte foolish.
 
You should create a table in VB. Perhaps using ado recordset (as this gives you more possiblities). This table is your virtual PLC and you need to populate it with the required data from your PLC

Now poll the PLC every second or so as desired but read a block of data each time. As communications takes a long time, you need to get all or most of the data in one go. Once you have the reply, populate the table using words as you might not need to look at bits/bytes each time.

Now you have a virtual PLC in memory, so you can read the table as required, instead of the PLC.

The only problem that you now have to handle is the write requests to the PLC. This will have to be done on an individual item basis. This is not a problem as it only has to be a fast as the user input.

Good luck.
 
It's a AB logix series PLC. I want to figure this out regardless of PLC type. Meaning how to efficiently get data and update the controls on my VB program.

Thanks
 
Thanks BrianJ,
That was very helpfull. I was thinking about bringing in PLC data in to a VB array in memory. I do not need to save or log this data at this time. So I am thinking handling them in memory might be the way to go for fast HMI updates.


Thanks Again for your help.
Regards
 
No1:
I want to Know How To handle PLC Data To VB.
I Have LG PLC Master K 80 Series (K7M_DR60s).
I want To Know Only only (For Example) One Bit of My PLC When On Any Thing IN VB On For Example Lamp, Image Any Type On.

No2:
And In PLC data Register For Example D120 Is Value 146 in PLC: I want This Value Appear In VB Text Value IN VB Form.
please you tell me what i Do.

I am Not Very good In VB But I can Do If You Some Help Me.
You Send Me A sample Project But For LG PLC.
I Am very thankfull To you.
Please please please please.
 
B

Brian E Boothe

That automationLS website seems to host a pretty Cost effective Controller. how does it Par with the Micrologix 1100??
 
C

Curt Wuollet

Yes, it is a refreshing attitude, free software and PLCs at prices more towards what a mass produced device of this complexity should sell for. The cost to start is drastically less than even Automation Direct. And they seem to get it, they even proclaim that you can build your own cables. No more $80 3 wire cables with bogus connectors. Software has been a problem for most eastern entries, so it remains to be seen if they have a pleasant environment. If they offered Linux tools, I'd be on board already. But I'll have to wait until I get to work or some other place with Windows to check it out. Perhaps they will be open to Linux tools. That would complete a world winning business model.

Regards cww
 
hi, i just read your article and i have some (i mean a lot of) problems to communicate pc and plc. and i'm using omron plc CQM1. can u tell me where i can get the answer for my problem?

thank you,
damianus
 
A

aditya_kurnia

Hmmm...

There are so much link related about your question.

My lovely link is below.
http://www.elektroindonesia.com/elektro/tel29.html

But sorry that is in Indonesian.

But, there is a note from that author. The author using reference from list below.
--C200HS Programmable Controller Operation Manual, Omron, August 1994
--Sysmac C200H/C500/C500F/C1000H/C2000H/C2000 Host Link Unit Operation Manual, Omron,1994
--Visual Basic Online Help
--and other reference in Indonesian

You can visit link above for seeing the code.

Or you can find it by yourself by typing one of keyword:
- "frame check sequence" plc
- "host link command" plc
- vb plc
- etc...
 
Each PLC manufacturer has a communications protocol for its port. In Allen Bradley's case, the most common RS232 protocol is its DF1 protocol.

Your software needs to establish its communication packets according to this protocol to retrieve info or send info to the PLC. The DF1 protocol details are publicly available as a pdf document from the Allen Bradley KnowledgeBase on their website. Their DH485 or DH+ protocols are unfortunately not available for free.

Other PLC manufacturers use different protocols, such as ModBus for GE FANUC PLCs. You won't have
a universal method to tlak to any PLC, you have to use their specific packet protocol otherwise the PLC will reject the message.
 
B
Horner Electric in Indianapolis builds PLC's. They have a free OPC server (and programming software) that has examples of transfering data to and from their PLC and a computer running VB and other programs using an RS232 serial link. I have used both VB and Excell's VB macros to transfer the required.
 
Did you ever get the Omron PLC to work? If so any info you can provide would be great. We are looking into possibly using Omron PLC.
 
hai...
i used nais plc fp0r. how i want to read data from plc to VB? i don't know where to get the memory address for my plc. i hope you can help me... thanks...
 
hai...
you can used MSCOMM32<pre>
Private Sub Form_Load()
Text1.Text = ""
With MSComm1
.CommPort = "1"
.Settings = "38400,n,8,1"
End With
End Sub

Private Sub Command1_Click()
MSComm1.PortOpen = True
End Sub

Private Sub Command2_Click()
MSComm1.Output = " Please send you frame "
End Sub

Private Sub Command3_Click()
Text1.Text = Text1.Text + MSComm1.Input
End Sub</pre>
enjoy
 
Top