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 March 6th, 2018, 05:25 PM   #1
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
Micro 820 structured text real/multiply/time

Hello all,

I am wanting to convert a real value from a panel view to minutes,
I can get it to work in ladder logic but I am hoping to demonstrate function block to students.

hoping for a sample instruction.
Thanks in advance.
  Reply With Quote
Old March 6th, 2018, 08:50 PM   #2
Geoff White
Member
Australia

Geoff White is offline
 
Join Date: Oct 2005
Location: Brisbane
Posts: 283
Welcome to the forum.

The first step is to describe what you are trying to do in such a way that we can understand it without guessing.
  Reply With Quote
Old March 6th, 2018, 09:02 PM   #3
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
I am sending a "real" value from my panel view into the PLC to be able to adjust the the time a pump cycles.


I have achieved this function it ladder logic, with the exception of the time still being in milliseconds. I forgot structure text long ago(Don't use it you lose it).
I am hoping to get an example of the text to convert a "real" integer into seconds(* 1000) then to min(*60) then convert that to a global variable to assign to a timer set value.
Thanks for the reply!
  Reply With Quote
Old March 6th, 2018, 09:13 PM   #4
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
That real value coming in from the panel view is a global variable as well.
  Reply With Quote
Old March 6th, 2018, 09:46 PM   #5
Geoff White
Member
Australia

Geoff White is offline
 
Join Date: Oct 2005
Location: Brisbane
Posts: 283
"Real" to me means non-integer or floating point. Are you talking about engineering units? The timer preset will be in ms. What units are you using on the HMI?
The conversion you specified is backwards for minutes to ms. Wouldn't you just multiply by 60000? Convert to DINT with ANY_TO_DINT.

Last edited by Geoff White; March 6th, 2018 at 09:59 PM.
  Reply With Quote
Old March 6th, 2018, 09:48 PM   #6
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
I'll need to check on that first thing in the morning.
  Reply With Quote
Old March 7th, 2018, 08:06 AM   #7
damica1
Member
United States

damica1 is offline
 
Join Date: Aug 2015
Location: Illinois
Posts: 595
Geoff White is suggesting what I also think would be your best solution. Convert real to "Dint" then use the function block "Dint to Time" which can be downloaded from "Rockwell's" support site?

The "Dint to Time" has an example of how to use this function block by "Structured Text" if I remember correctly!
__________________
David M. Camp

Marshall Electric / https://mei-tech.com/monitor-and-control

Please Download from our download section "Monitor and Control" .pdf.
  Reply With Quote
Old March 7th, 2018, 11:49 AM   #8
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
Ok guys, sorry for the wait.
I am going to screenshot a couple of things that I think will help you guys see what I am talking about!
The pump control screen is where I want to be able to adjust the time for how long the pump stays on, and how long between cycles.
The global variable screenshot is how I am sending the value from my HMI to the PLC.
The ladder conversion is how I was able to get what I am calling real (data type?) data to convert into a time value to assign to my timer.
I hope this clears it up a little.

I also feel like a dummy for not thinking about multiplying by 60000 instead of 1000 then by 60....
Attached Images
File Type: jpg pump control screen.JPG (37.0 KB, 15 views)
File Type: jpg global_v.jpg (28.4 KB, 15 views)
File Type: jpg ladder conversion.jpg (33.5 KB, 15 views)
  Reply With Quote
Old March 7th, 2018, 05:12 PM   #9
janner_10
Supporting Member
United Kingdom

janner_10 is offline
 
Join Date: Dec 2014
Location: Tewkesbury
Posts: 667
Unless I misunderstand. Convert Screen Input to mS then convert to time!

  Reply With Quote
Old March 8th, 2018, 01:39 AM   #10
janner_10
Supporting Member
United Kingdom

janner_10 is offline
 
Join Date: Dec 2014
Location: Tewkesbury
Posts: 667
Silly Tag names above - should of course be minutes!
  Reply With Quote
Old March 8th, 2018, 02:01 PM   #11
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
did you need to declare "MytimeconvHours" as a tag? of so what data type should it be?
  Reply With Quote
Old March 8th, 2018, 02:31 PM   #12
janner_10
Supporting Member
United Kingdom

janner_10 is offline
 
Join Date: Dec 2014
Location: Tewkesbury
Posts: 667
Yes, it's a DINT.

You can scale the tag in the panelview, and just use that in the ANY_TO_TIME directly.

But IMO, it makes it more obvious what you are doing if it's right there in the code. I prefer all the maths in the PLC where it is in plain sight, but horses for courses.
  Reply With Quote
Old March 8th, 2018, 04:34 PM   #13
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
Thanks so much for the help.
I have entered what I think to be the exact instruction and tried to download but got the attached error messages? please advise
I have attached screenshots of my tags for verification.
Attached Images
File Type: jpg error list.jpg (51.7 KB, 9 views)
File Type: jpg newtag_dint.JPG (27.9 KB, 7 views)
File Type: jpg timersetpoint tag.JPG (23.3 KB, 6 views)
  Reply With Quote
Old March 9th, 2018, 10:52 AM   #14
Bryan_Mitchell
Member
United States

Bryan_Mitchell is offline
 
Join Date: Mar 2018
Location: Rapid city
Posts: 9
Can I provide more details?
  Reply With Quote
Old March 9th, 2018, 06:09 PM   #15
janner_10
Supporting Member
United Kingdom

janner_10 is offline
 
Join Date: Dec 2014
Location: Tewkesbury
Posts: 667
Hello Brian

Here's how I got it to work:



  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
MSG Instruction via Structured Text jfd7851 LIVE PLC Questions And Answers 5 August 10th, 2016 11:15 AM
Structured text in factorytalk view studio? Crailberry LIVE PLC Questions And Answers 1 July 2nd, 2016 04:05 PM
Debouncing Timer on Micro 830 in Structured Text spatricks LIVE PLC Questions And Answers 11 January 14th, 2013 02:51 PM
Structured Text & RSLogix - good reference books & docs? ChrisOfMaryland LIVE PLC Questions And Answers 4 November 4th, 2009 01:10 PM
Structured Text for automating experiments? I'm new... ChrisOfMaryland LIVE PLC Questions And Answers 1 November 4th, 2009 12:40 PM


All times are GMT -5. The time now is 09:27 PM.


.