Jump to content

Recommended Posts

Posted

How to map physical Input and output into variables type of Word?  It is easy in CX programmer with Mov 0 to  Inp_Word_0  (type Channel)

Global Variable  -----> Inp_Word_0 ,      Inp_Word_1     Type Word

                                      Out_Word_0,        Type Word                          

Example in NX1P2   map Input Bit 00 to Input Bit 15 to a Inp_Word_0,     and    map  Input Bit 16 to Input Bit 23 to a Inp_Word_1

                                     map Outpu Bit 00 to Input Bit 15 to a Out_Word_0, 

 

 

                                 

 

Posted

You have to make a union.    See below:

First, make a union under data types like this:

Union1.jpg.ea3d03c445708928cfbe36c930f3e

Then create a variable that is of the type that you created:

Union2.jpg.301856bb548a4a18f5ab8b4934da9

Then use the variable as both a bit and a word like this:

Union3.thumb.jpg.9c1c1cd4543598857177890

You can ignore my comments about VB in the ladder, this was an example that I did for someone else. 

Posted

I am using the above method:-), I thought there is a more simple method instead of writing bits to bits. Is there a way of assigning a variable at IO Table directly with the union variable?

 

Posted
On 7/16/2019 at 7:19 PM, simonongsk said:

I am using the above method:-), I thought there is a more simple method instead of writing bits to bits. Is there a way of assigning a variable at IO Table directly with the union variable?

 

Just assign a word variable to the input channel (in my example, I am using an input card) and then put a move instruction in the first rung of code that moves the input word variable into the unionVariable.word and done.

Of course output words would be at the very end of your program and you would be moving from the unionVariable.word into the output word.

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