Jump to content

Recommended Posts

Posted

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,

Posted
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

Posted

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...

Posted
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?

Posted

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.

  • Like 1
Posted
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? 

 

Posted

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.

Posted
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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...