Jump to content

Recommended Posts

Posted
The easiest way would be to get an ActiveX control that handles the PLC communications. Mitsubishi offers a package called MX-Component that does just that. You just go into a wizard and configure your PLC, assign it a logical station number, and then call the ActiveX and give it that station number.
Posted
Private Sub Timer 1-Timer() Form l. MSComm l. CommPort=1 Form l. MSComm l. Settings="9600,e,7,2" Form l. MSComm l. Port Open=True R$="@ 00RD00000004" RD$=R$+fcs(R$) Form 1. MSComm 1.In Buffer Count=0 Form 1. MSComm 1.Output=RD$+Chr$(13) Do Dummy=Do Everts(1) Loop Until Form 1. MSComm 1. In Buffer Count>=27 Instring$=form1. MSComm 1. Input Label 1(0). caption=MID$(instring$,8,4) Label 1(1). caption=MID$(instring$,12,4) Label 1(2). caption=MID$(instring$,16,4) Label 1(3). caption=MID$(instring$,20,4) From1. MSComm 1. Port Open=Faise End Sub Function fcs(O$) Dim B??I?????FF$ B?=0 ??=Len(O$) For I?= I TO ?? B?=B?×or Asc(Mid(O$?I??1)) Next I? FF$?He×$(B?) 1f Len(FF$)=1 Then FF$="0"+FF$ End If Fcs=FF$+"*" End Function enjoy this
Posted
Hi Calvin, i am using VB 6.0 using FX232-BD Port. Hi Chris, i still have to search for that component if it is available on the web, i hope it would also help. hi hero, i will try your code and will inform you later rgds to all
Posted
hi joven Like panic said, MX component is commercial so you need to buy it, same for OPC server. Back to the basic solution, develop a Visual Basic Aplication! I thing that the VB aplication is simple, but the PLC program can be a litle harder. To use serial communication on Visual Basic you need the MScomm object: Menu, Project->Components->Microsft Comm Control 6.0 I leave an very basic example, for tests use the windows hyperterminal that is even easier. For the PLC program, see the RS function (FNC 80) on the manual.
Posted
Hi Calvin, Thanks for your very important sample. PLC programming is easy for me since I am using it for so long time already. below is my sample PLC program Ladder program: X0 Y0 -----| |-------------------------( ) ------------------------------( END ) X0 - input device (e.g switch) Y0 - output device (e.g lamp ) My VB form will be: Commandbutton for input and Checkbox for output. If I will press the Commandbutton, the lamp (Y0) will activate and Checkbox will be active. Can you give me a sample VB program for the conditions above... Please help...
Posted
i am not sure this will work since input table will be updated before each scan. i would recommend writing to internal memory such as M or D instead of X.
Posted
Unfortunately i don't have an FX232-BD. The only 232 module available is a A1SJ71UC24-R2 with a A1S CPU. In this example the left checkbox controls Y10, the right checkbox monitorize X0. The plc code is only for serial communication, there isn't any relation between X0 and Y10. For the FX series is available a RS function for a easier control of serial communications. Hope this help Serial_sample.zip
Guest Guest_John
Posted
All you have to do is get a ICP-DAS WinCon 8000 with WinCe.Net thats it! no extra code for com ports it is all in one (PAC)
Posted
I’m not sure of what you really want! You want to control the lamp (Y0) with a switch (X0) or with a Command button in Visual Basic. On the PLC side, the serial communication is based in integers (D’s), but you can convert to boolean, see my example. I forgot to say but the code is made on GX IEC Developer 5.0.
Posted
Hi Calvin, I want to control the lamp either by the X0 and CommandButton. X0 is used in remote area, and the CommandButton is used in the Machine PC. I either of the X0 or CommandButton is active, the lamp will turn-ON.
Posted
Well the hard work will be how to send/receive data and not what to do with it But there it is an small example. PC Program: Send command button state to serial port (ON/OFF), with end message code (0A0D) Receive a message with a boolean variable and attribute its value to a checkbox (Lamp) On PLC program: send Y0 to PC, for monitorization receive command button order (ON/OFF) and attribute to M0 Y0=M0 or X0 P. S. In my opinion, checkbox are better than command buttons for this situation, you want that the same button set and reset M0, so you must change the caption to display the correct action.
Posted
Hi Calvin, Thanks a lot but still doesnt work. I have attached a new conditions and i hope this would help now. I will also attached some pdf file which has the mitsubishi protocol format. I couldnt interpret it well and i hope you can help me on how to deal by providing me a simple example and i think i can do the rest. In my conditions: * When the Command1 button is clicked, the M0 of the PLC will be active and energizing the Y0 output of the PLC. * When the Command2 button is clicked, the M1 of the PLC will be active and de-energizing the Y0 output of the PLC. * The listbox will display "Y0 is ON" if Y0 is ative and "Y0 is OFF" if Y0 is inactive. The signal to listbox should be from the PLC. If the VB program could not receive any response from the PLC, MessageBox will display "Communication Error". Everyone in the net are also invited to help...
Posted
This is the extracted FX2N Communication manual which i have found from this net. I need your help to interpret this for me by giving a simple VB program base on my conditions above... FX2n_Communication.pdf

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...