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
Unread July 14th, 2019, 01:06 PM   #16
alexbeatle
Member
United States

alexbeatle is offline
 
Join Date: Feb 2010
Location: San Francisco
Posts: 136
As mentioned earlier, I use UDT (1 string + 1 bool) for the FIFO.
The are set\reset from the HMI. Any suggestion on how to setup in plc such that only one bool out of the array can be set at the time? I.e. if one bool already set - disallow setting another, or reset the previous one and set the next.
The trouble I'm facing is that with the FFL and FFU instructions those bools are shifting as well (as I want them to), but I want to ensure only one is set at the time.
  Reply With Quote
Unread July 14th, 2019, 05:54 PM   #17
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 1,035
I am assuming that you are only adding to the array is with the FFL
If that’s the case then before you trigger the Load do a file search on the array and set a bool to true if any of the array elements are true
Then either don’t load the FIFO ir just set the bool in load tag to false
I would need more details on your application to full understand what you need
  Reply With Quote
Unread July 14th, 2019, 11:09 PM   #18
alexbeatle
Member
United States

alexbeatle is offline
 
Join Date: Feb 2010
Location: San Francisco
Posts: 136
Quote:
Originally Posted by GaryS View Post
I am assuming that you are only adding to the array is with the FFL
If that’s the case then before you trigger the Load do a file search on the array and set a bool to true if any of the array elements are true
Then either don’t load the FIFO ir just set the bool in load tag to false
I would need more details on your application to full understand what you need
Correct me if I'm wrong, but FSC instruction doesn't work with BOOL arrays
  Reply With Quote
Unread July 14th, 2019, 11:43 PM   #19
GaryS
Member
United States

GaryS is offline
 
GaryS's Avatar
 
Join Date: Aug 2003
Location: Lancaster Pa.
Posts: 1,035
I wouldn't use an FSC for this anyway to much overhead
set test tag to 0
set a simple loop for x = 0 to max array size
if array[x] = 1 set test tag to 1
x = x +1
loop
  Reply With Quote
Unread July 16th, 2019, 03:49 PM   #20
alexbeatle
Member
United States

alexbeatle is offline
 
Join Date: Feb 2010
Location: San Francisco
Posts: 136
Quote:
Originally Posted by GaryS View Post
I wouldn't use an FSC for this anyway to much overhead
set test tag to 0
set a simple loop for x = 0 to max array size
if array[x] = 1 set test tag to 1
x = x +1
loop
A little more details on my setup.
UDT[100] (1string, 1bool) goes through FIFO - FFL and FFU. The data is stored in the string of the UDT. I use the bools to mark the string for removal or insertion (see above posts for details). This bool is (re)set on the HMI button for each UDT[x]. I want to ensure that pressing one button (setting one of the UDT[X].bool) resets all of the others.

Using your suggested method will indirectly cause the for loop to run every FFL and FFU. I just want to have one UDT[X].bool set, when done so through HMI. But I want to have the function native to PLC. In case someone does testing in the future without HMI.
  Reply With Quote
Unread July 16th, 2019, 07:55 PM   #21
alexbeatle
Member
United States

alexbeatle is offline
 
Join Date: Feb 2010
Location: San Francisco
Posts: 136
May not be the most elegant solution, but solved with:

  1. get UDT[] FIFO size: FIFO_size
  1. get last POS of FIFO: FIFO_size -1 = Last_POS
  1. if none of the bools are selected: (all of the UDT[x].bool xic's ANDed)
    FIFO_Select_POS = FIFO_size
  1. else:
    move the number associated with the set bool to FIFO_Select_POS
  1. clear all bools
  1. if 0<FIFO_Select_POS<Last_POS, set udt[FIFO_Select_POS].bool


The idea, if none of the bools are set POS=FIFO_size, else POS = the number associated with the bool position in the UDT[]. And obviously all of my functions before accessing the UDT[FIFO_Select_POS] make sure that 0<FIFO_Select_POS<Last_POS

Last edited by alexbeatle; July 16th, 2019 at 08:40 PM.
  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
FIFO Reset ASF LIVE PLC Questions And Answers 2 March 10th, 2015 05:14 PM
FIFO dilemma jakeemon LIVE PLC Questions And Answers 21 August 6th, 2013 10:22 AM
fifo for 2 machines James Mcquade LIVE PLC Questions And Answers 64 September 14th, 2011 09:38 AM
part tracking davehask LIVE PLC Questions And Answers 26 August 31st, 2011 09:14 AM
FIFO Check The_Wanderer LIVE PLC Questions And Answers 1 October 15th, 2003 07:44 AM


All times are GMT -5. The time now is 02:04 AM.


.