Followers 0

writing from HMI to Array SINT [24] in PLC

6 posts in this topic

What is the easiest way that HMI writes to Array of SINT[24] ?

Like I am thinking to have a maintain buttons that points to a BOOl[32] elements in PLC

when button press on HMI the bit in BOO[32] will be active high and then can write 99 a member in to SITN[24] , else will write 0.

But that required 48 rungs . Is there any other efficient suggestion ?

Thanks

Share on other sites

Do the array elements match up? In other words, will pressing BOOL[7] write 99 to SINT[7]?

Why 48 rungs with only 32 buttons? Do you have an example of what you've done so far that does what you want for one button?

Share on other sites

I would rather know why you want to write to an individual element in a SINT array.

Seems to me that you would be better served in using the built in capabilities of both the PLC and the HMI.

Could you explain what you are using the SINT array for and or trying to accomplish?

Share on other sites
2 hours ago, Joe E. said:

Do the array elements match up? In other words, will pressing BOOL[7] write 99 to SINT[7]?

Why 48 rungs with only 32 buttons? Do you have an example of what you've done so far that does what you want for one button?

“Do the array elements match up? In other words, will pressing BOOL[7] write 99 to SINT[7]?"

·         Yes It does match

Why 48 rungs with only 32 buttons? Do you have an example of what you've done so far that does what you want for one button?”

·         As I have two condition 0 and 99 , and I have 24 elements

Share on other sites
2 hours ago, pcmccartney1 said:

I would rather know why you want to write to an individual element in a SINT array.

Seems to me that you would be better served in using the built in capabilities of both the PLC and the HMI.

Could you explain what you are using the SINT array for and or trying to accomplish?

I have the following:

Array of SINT[24] call it Sorted[24] has a sorted vehicles based on its position

If there is less than 24 vehicles on track, I need operator to insert gaps which will shift the first Array elements based on the location that operator select

I want operator to select from HMI whether this location is full or empty which write to another Array of SINT[24] call it Gap[24], 0 means full, 99 mean empty

Example:

Sorted[21]= [6,7,8,9,…..,10]

Operator can add up to 3 gaps, Based on operation selection Gap[24]= [0,99,99,99,0….0]

Output Array = [6,99,99,99,7,8,9,…..10]

So what I am thinking is to map 24 buttons on HMI to Bool[32] on PLC only 24 used,

Then if operator select that bit it will write 99 to Array SINT[24] Else it will write 0

Then I can compare my sorted array with my gap array and find the output array.

If you have a better solution/idea would be appreciated.

Share on other sites

How did you declare hmiInBubbleTrain? It looks like a UDT or an array of UDTs. Without seeing how your tag is declared, I can't see how to streamline your process any.

You mentioned you were using a BOOL[32] array and a SINT[24] array, so I put together a quick loop that goes through a BOOL array and uses the status of each bit to write either a 99 or 0 to the corresponding elements of a SINT array. In my screenshot, HMI_Buttons is declared as BOOL[32] while BubbleArray is declared SINT[24].

I'm having a hard time visualizing how you're using this information based on your description, so I can't say if what you're doing is the best way or not.