How to send commands from pc to ADAM-4520

Offered without comment because I didn't write it.

Code:
Private Sub btnReceive_Click()
txtReply.Text = MSComm1.Input
End Sub

Private Sub btnSend_Click()
OutCom = txtCommand.Text
MSComm1.Output = OutCom + vbCr
End Sub

Private Sub UserForm_Initialize()
On Error GoTo 10
    MSComm1.InBufferSize = 16384
    MSComm1.InputMode = comInputModeText
    MSComm1.OutBufferSize = 16384
    MSComm1.CommPort = 1
    MSComm1.PortOpen = True
    MSComm1.Settings = "9600,N,8,1"
10: lblMessage.Caption = Error
End Sub


Would you be able to provide the link where you found this code from. I want to confirm some bit as I had errors in my code I managed to fix them but just to see.

Errors were:
comInputModeText needs to comInputMode.Text, then add a textbox with name omInputMode to the form

MSComm1 needs to be declared as an object

lblMessage.Caption = Error Wasn't sure how to fix but I assume this is let the user know something went wrong. So I changed this to MessageBox.show("Error").

OutComm needs to be declared. I declared it as String
 
The xls attachment what is this for? didn't understand when you said attach an XLS with a form.

I had a look at the picture of the form. To my understanding as shown above, I assume there needs to be another textbox, unless comInputMode is a label that's invisible on the form or I got that completely wrong. Hmmm.
 
Last edited:
It is a member of the mscommlib.

I was able to prepend the whole path and it still runs:
Code:
MSComm1.InputMode = MSCommLib.InputModeConstants.comInputModeText

2015-09-10_10-23-31.jpg
 
Last edited:
did you not declare an object.

So what I did was Dim MSComm1 As MSCOmm = CreateObject("MSCOMMLib.MSCOmm")


Also what about OutComm being declared?

Is this wrong than?
 
This is stretching my memory of old VB (been dead for a decade). (I didn't create this xls, it was probably written in the early 2000's)

The object lives on the form, the graphical part.

In old VB, the code would auto create any variable that were not purposefully instantiated; unless the whole form has a Option Explicit and then it will throw an error during compiling.
 
I just wanted confirmation that the following that I have done is correct.


connect ADAM-4520 to ADAM-4024 using the Data+/- terminals?


SY3220-5L
SMC-type-solenoid-valve-SY3220-5LZD-M5-DC24V-solenoid-valve.jpg


connect both terminals (left and right) of the SY3220-5L to ADAM-4024 using the Vout channels? Not sure about as couldn't get find any info of this on the internet. But I assume to control SY3220-5L, there terminals needs to come form the ADAM-4024. However, It has 24VDC written at both ends, so not sure if it's needs it's own power source. Overall, what I need is actually a document stating what the terminals of the SY3220-5L needs to be connected to.

ITV2030-312BS3
mqotS51osEKnVaQ4Luzi-1w.jpg


The power source used supplies 24 to 25VDC would this appropriate for ITV2030-312BS3? The power rating on it is 24VDC so not fully sure

This would be connected to a 24VDC and two terminals (one Vout for input and another Vout for output) of ADAM-4024?

Could someone please confirm this is right? The information that I was getting was from different sites. So not sure if this is correct.

Thank You
 
Last edited:

Similar Topics

Hi Guys, Got an interesting question, has anybody tried to use a PLC to re-configure a router? I have done so using SNMP (relatively...
Replies
4
Views
1,595
Hello: Just posted a similar inquiry with regards to Rockwell HART master. Trying to figure out whether the Siemens offering is better. I need to...
Replies
14
Views
4,781
https://literature.rockwellautomation.com/idc/groups/literature/documents/um/1794-um063_-en-p.pdf Hello. Trying to figure out if it would be...
Replies
1
Views
1,802
What is the best way to send multiple serial ASCII commands from a Compactlogix PLC to another piece of equipment? The issue is that the equipment...
Replies
2
Views
1,798
Hi all. I want to print QR codes from a Beckhoff PLC and I am considering to purchase the ZD42oT zebra printer. I have never used ZPL commands...
Replies
0
Views
1,504
Back
Top Bottom