You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old January 28th, 2008, 10:22 AM   #1
djpalaz
Member
Canada

djpalaz is offline
 
Join Date: Jan 2007
Location: Montreal
Posts: 57
Inrcrement/Decrement Button vba (Factory Talk)

Hello,

I'd like to know if anybody has vba code for a button which can increase a number while being held down (sort of like a clock radio button to change the time). If you press for less than 1 second the number increments by one. If you hold it longer than a second it increases at one unit/second. For example if the value was 10 and then you held the button down for 5 seconds the value would be 15.
  Reply With Quote
Old January 28th, 2008, 10:36 AM   #2
surferb
Lifetime Supporting Member
United States

surferb is offline
 
surferb's Avatar
 
Join Date: Jun 2007
Location: Tacoma, WA
Posts: 1,743
Quote:
Originally Posted by djpalaz
Hello,

I'd like to know if anybody has vba code for a button which can increase a number while being held down (sort of like a clock radio button to change the time). If you press for less than 1 second the number increments by one. If you hold it longer than a second it increases at one unit/second. For example if the value was 10 and then you held the button down for 5 seconds the value would be 15.
Probably can be done with a timer where you write code separately for a mousePressed and mouseReleased event. That said, you may want to revisit your UI. That's pretty non-standard with a computer based interface. I know hardware guys are used to that sort of interface when a physical "button" is a switch. PLCs can create a pretty cool such effects.

What are you trying to accomplish? I'm sure there are other, better ways of doing the same thing.
__________________
Nathan Boeger, CISSP-ISSAP, CCVP/CCNA, MCSE, VCP
"Design Simplicity Cures Engineered Complexity"
Sierra Nevada Brewery MES/ERP case study - 5 minute video, My comments
Comment on Not another industrial software Blog
Ignition by Inductive Automation, rethinking SCADA for modern manufacturing 2 minute video
  Reply With Quote
Old January 28th, 2008, 12:44 PM   #3
LadderLogic
Member
United States

LadderLogic is offline
 
LadderLogic's Avatar
 
Join Date: Jun 2003
Location: Chicagolandia
Posts: 1,258
Microsoft UpDown Control (included in Microsoft Windows Common Controls-2 library MSCOMCT2.OCX) almost has this functionality. If you hold either "up" or "down" button with a mouse, the associated value begins to scroll up or down. No time delay though.
__________________
Don't trust, don't fear, don't beg...
  Reply With Quote
Old January 28th, 2008, 03:42 PM   #4
grimreaper_29_uk
Member
United Kingdom

grimreaper_29_uk is offline
 
Join Date: Jan 2008
Location: Horsham, West Sussex
Posts: 5
Red face

I've been using FactoryTalk (RSView SE, CPR7+ (version 4)) for a solid 3 months now - and apart from my personal opinion that I think it's the worst HMI ever spawned from satan, I can also offer this advice;
The functionality the OP requires is built into many of the controls in RSView Studio. There are several types of buttons that all have configurable repeat rates, latching, multi-state positions, etc. Although I haven't performed the exact same configuration, I'm pretty sure it's easily possible with the provided tools.
  Reply With Quote
Old January 28th, 2008, 06:06 PM   #5
surferb
Lifetime Supporting Member
United States

surferb is offline
 
surferb's Avatar
 
Join Date: Jun 2007
Location: Tacoma, WA
Posts: 1,743
Excellent advice. Always much better to use the pre-built tools if they can do the job instead of jumping to code.

What's wrong with RSView SE?

Quote:
Originally Posted by grimreaper_29_uk
I've been using FactoryTalk (RSView SE, CPR7+ (version 4)) for a solid 3 months now - and apart from my personal opinion that I think it's the worst HMI ever spawned from satan, I can also offer this advice;
The functionality the OP requires is built into many of the controls in RSView Studio. There are several types of buttons that all have configurable repeat rates, latching, multi-state positions, etc. Although I haven't performed the exact same configuration, I'm pretty sure it's easily possible with the provided tools.
__________________
Nathan Boeger, CISSP-ISSAP, CCVP/CCNA, MCSE, VCP
"Design Simplicity Cures Engineered Complexity"
Sierra Nevada Brewery MES/ERP case study - 5 minute video, My comments
Comment on Not another industrial software Blog
Ignition by Inductive Automation, rethinking SCADA for modern manufacturing 2 minute video
  Reply With Quote
Old January 29th, 2008, 04:55 AM   #6
grimreaper_29_uk
Member
United Kingdom

grimreaper_29_uk is offline
 
Join Date: Jan 2008
Location: Horsham, West Sussex
Posts: 5
Angry

What's wrong with it?!!?!? What's right with it?!
We're using the older version (v4 / CPR7+) because our systems require 100% uptime/redundancy, and since I haven't played with the latest release, I can't say whether it's good or bad. However, even the European director of RA has admitted that CPR7 is a load of rubbish.
We've had random crashes at random times, tag server processes, vstudio processes and directory server processes simply dying with error message, and a whole host of other issues.

The biggest problem I've had recently is in trying to get to the bottom of all the configuration issues using Server 2003 and XP, and discovering that 3 RA documents state opposing facts on how to configure a 'standard' system!
  Reply With Quote
Old January 29th, 2008, 09:08 AM   #7
rdrast
Lifetime Supporting Member
United States

rdrast is offline
 
rdrast's Avatar
 
Join Date: Apr 2003
Location: South Carolina Lowcountry
Posts: 5,181
/shrug, whatever.

We use exclusively FT View SE, Release 4 and 5, and haven't had issues that weren't hardware related.

TO the original point, If you are trying to use self-incrementing buttons to communicate to a PLC tag, I'd advise against it. I use an MOP AOI in Logix, which was based on an older MOP subroutine from SLC/PLC days.

Simple reason is with a PLC based routine, you can safely control how many people are trying to modify it at one time. Windows controls, and even VBA is very bad at handling two users on two terminals modifying the same thing.
  Reply With Quote
Old January 29th, 2008, 09:28 AM   #8
surferb
Lifetime Supporting Member
United States

surferb is offline
 
surferb's Avatar
 
Join Date: Jun 2007
Location: Tacoma, WA
Posts: 1,743
Right - besides concurrency, it's nearly impossible to account for lag and other issues, including guarenteeing the safety of your write. Your better bet for a PC based input is for the operator to input an amount that is autonomous. ie, a single 5 second click, or press the button to tell the PLC to move the device to the next preset location, etc.

Quote:
Originally Posted by rdrast
Simple reason is with a PLC based routine, you can safely control how many people are trying to modify it at one time. Windows controls, and even VBA is very bad at handling two users on two terminals modifying the same thing.
__________________
Nathan Boeger, CISSP-ISSAP, CCVP/CCNA, MCSE, VCP
"Design Simplicity Cures Engineered Complexity"
Sierra Nevada Brewery MES/ERP case study - 5 minute video, My comments
Comment on Not another industrial software Blog
Ignition by Inductive Automation, rethinking SCADA for modern manufacturing 2 minute video
  Reply With Quote
Old January 29th, 2008, 03:48 PM   #9
djpalaz
Member
Canada

djpalaz is offline
 
Join Date: Jan 2007
Location: Montreal
Posts: 57
Looks like I could use the ramp button already created in RS View studio but it also looks like you can access it through vba.
  Reply With Quote
Old January 30th, 2008, 02:03 PM   #10
grimreaper_29_uk
Member
United Kingdom

grimreaper_29_uk is offline
 
Join Date: Jan 2008
Location: Horsham, West Sussex
Posts: 5
Lightbulb

Can you write the code for the functionality you want in VBA/VB/any other language which stores the value the operator decides on internally, and then have another button (like an OK or Apply button for instance) which actually writes the value down to the PLC?

(I've got skeleton code to write to RSViewSE tags from VB6 and VB.NET if you need it... )
  Reply With Quote
Old January 31st, 2008, 04:01 PM   #11
djpalaz
Member
Canada

djpalaz is offline
 
Join Date: Jan 2007
Location: Montreal
Posts: 57
I'm not sure what you mean grimreaper by "value the operator decides on internally, and then have another button (like an OK or Apply button for instance) which actually writes the value down to the PLC?"

It looks like there is a ramp function you can execute as a macro ex you could use the following command:

Ramp tag tagvalue -> Ramp {#1.set.sp} +1

You can place this function in the button properties under press and release action as seen in attached bmp

If you click onnce on the button it will increase by 1 if you hold it longer than 0.25sec it will increase by 1 every 0.25sec.

Now id like to use vba to do the same thing since this action will be only restricted to certain users. If the user with no permissions presses the button a pop_up will display. Here is the code that I have been working on:

Private Sub RampButtontest_Press()
On Error GoTo Handler
If Application.CurrentUserHasCode("B") Then
ExecuteCommand "Ramp " & Me.SP.Value & " " & 1
Else
ExecuteCommand "Display POP_NoSecurity /CC"
End If
Exit Sub
Handler:
Application.LogDiagnosticsMessage "VBA Error : " & Me.Name & " - RampButtontest_Press : " & Err.Description
End Sub
Attached Images
File Type: bmp ramp_function.bmp (205.7 KB, 148 views)
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Factory Talk Security Issue val_99 LIVE PLC Questions And Answers 0 January 17th, 2008 09:50 PM
Upgrade to factory talk view se kurt.brinker LIVE PLC Questions And Answers 2 January 11th, 2008 02:37 PM
Previous Page function in Factory Talk View Studio djpalaz LIVE PLC Questions And Answers 14 January 6th, 2008 10:29 PM
Factory Talk View Studio VBA to access HMI or PLC tags djpalaz LIVE PLC Questions And Answers 0 December 14th, 2007 07:57 AM
Factory talk activation RSLogix500, PanelBuilder gbradley LIVE PLC Questions And Answers 4 September 18th, 2007 08:27 AM


All times are GMT -5. The time now is 10:06 AM.


.