Sign in to follow this  
Followers 0
Nickf

Omron VB

3 posts in this topic

I am using a Omron CQM1 plc and need to interface with a Laptop via Finsgateway and using Compolet. The Manual which is supplied is very sparse on simple examples of VB code. I have got most of the Forms , Text and controls I want to use working but am having difficulties in Writing a Long variable to the plc. ie I want to send the decimal number 1000000 to HR0 HR1 ((2 words ) as a UDINT). Does anyone have any simple code examples or is there a book or training specifically for Omron plc . Regards Nick

Share this post


Link to post
Share on other sites
Compolet Examples @ MrPLC.com You can find lots of helpfull info at this site by checking the "download code" link at the top of the page.

Share this post


Link to post
Share on other sites
Hi This works on my app Private Function fHRSendBCD(RegVal As Long, Reg As Integer) As Integer Dim iLow As Long Dim iHigh As Long Dim iString As String iString = CStr(RegVal) If Len(iString) > 4 Then iHigh = Val(Left(iString, Len(iString) - 4)) Else iHigh = 0 End If If Len(iString) < 5 Then iLow = Val(iString) Else iLow = Val(Right(iString, 4)) End If plcOmron.HR(Reg) = CLng("&h" & iLow) plcOmron.HR(Reg + 1) = CLng("&h" & iHigh) End Function Where plcOmron is the name of the object. Hope this helps Regards Alan Edwards http://www.wolfelectrical.co.uk

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0