Link068

Display PLC Time on HMI and Comparing Entered HMI Time to PLC Time

11 posts in this topic

Good Afternoon,

I am wanting to do two things with and ORMON PLC and HMI with CX-Programmer and NB-Designer.

1. I want to display the current time from PLC on HMI with the real time clock.

2. I want to be able to enter a time on the HMI which will be compared to the PLC time and will stop a process when when the entered time is equal to the actual PLC time. 

If I can have some help with this that would be a great help.

Thanks,

Share this post


Link to post
Share on other sites

PLC time is stored into registers in the controller, I don't have the list handy.  But you would simply do a compare to those registers in your code.

Share this post


Link to post
Share on other sites
On 9/9/2021 at 3:33 AM, Crossbow said:

PLC time is stored into registers in the controller, I don't have the list handy.  But you would simply do a compare to those registers in your code.

I am trying to compare time entered via an HMI and compare with the internal PLC clock. I Have broken it down to entered YY:MM:DD:HH:MIN to match the registers. 

So if I understand this correctly they are 16 bits with each variable broken into 8 bits.

6141af4a35e59_TimeRegisters.jpg.6479ea54

So to compare (as example) I want to have YY & MM together so they can be compared A353 register and set a bit true when they are the same. 

Since YY & MM are entered individually in HMI as INT, I need to but them together in one word using the XFRB block so they can match the A353 register.

6141b38cab56c_XFRBDescription.jpg.5dd115

I believe I am using this correctly but I can't seem to move the YY values into the register I want. The MM moves but not the year so I just want to be sure I am using this block control word correctly. 

So first 2 digits are the number of bits (anything between 1 or 15 bits), 3rd digit is the start position of where you want to store the 8 bit value (in my YY example is position 8 as a word has 16 bits, so this would cover position 8-15) and the last bit is the start position of the number of bits you want from the source word. 

MY example 

6141b43dc1301_MoveUsingXFRB.jpg.40ad4ca9

 

If I can have any help or if you can offer a netter cleaner way of doing it please let me know.

Thanks,

Ryan

Move Using XFRB.jpg

Share this post


Link to post
Share on other sites

Be careful with your moves... clock data is in BCD, not integer. 

I would swear there is a command that can copy digits from one register into another, but I cannot think of it right now.  It's been a while since I worked in CX-Programmer, mostly use Sysmac Studio anymore...

Share this post


Link to post
Share on other sites
7 hours ago, Crossbow said:

Be careful with your moves... clock data is in BCD, not integer. 

I would swear there is a command that can copy digits from one register into another, but I cannot think of it right now.  It's been a while since I worked in CX-Programmer, mostly use Sysmac Studio anymore...

I think the move you are thinking of is MOVD, but that moves 4 bits but aren’t the tine data stored in 8 bits?

Share this post


Link to post
Share on other sites

You can use a mask - then shift bits around to put them where you want. ANDW #00FF A352 D2000 will move hours into D2000.

ANDW #FF00 A351 D2001 will move I think it is minutes into D2001. They will be on the left of the word. MOVD D2001 #12 D2002 will move the value to the right had side of the word.

Hope this is what you require.

1 person likes this

Share this post


Link to post
Share on other sites
3 hours ago, BobB said:

You can use a mask - then shift bits around to put them where you want. ANDW #00FF A352 D2000 will move hours into D2000.

ANDW #FF00 A351 D2001 will move I think it is minutes into D2001. They will be on the left of the word. MOVD D2001 #12 D2002 will move the value to the right had side of the word.

Hope this is what you require.

thank you for that but in the MOVD why just #12? wouldn't it need 4 variables? 

 

Share this post


Link to post
Share on other sites

The mask only allows 2 digits through the mask - the other 2 digits are masked/blocked.

Therefore you only have to move 2 digits with MOVD.

believe me it works - I do it all the time.

Share this post


Link to post
Share on other sites
19 hours ago, Link068 said:

I think the move you are thinking of is MOVD, but that moves 4 bits but aren’t the tine data stored in 8 bits?

 

MOVD can be told the number of digits to move if I recall correctly, so it can move 8 bits...

Share this post


Link to post
Share on other sites

It certainly can.

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