Sign in to follow this  
Followers 0
noorloai

indirect addressing of individual bits of a tag of datatype dint using PLC ladder

4 posts in this topic

Hi All,

 

I have a question on if its possible to do indirect addressing of individual bits of a tag of datatype dint in studio5000 ladder logic?

I am writing a routine that should  loop through the individual bits of the tag of data type dint and do processing .

Like instead of using OTE instruction ConfirmRequest[rvIndexSafety]

where confirm Request is BOOL[32] elements 

if condition true and rvIndexSafety =1 => it will set confirmRequest[1] 

I need to use DINT and set DINTDataType.1 

How can i approach this?

 

Thanks,

 

Share this post


Link to post
Share on other sites

Use  DINTDataType.[Index_Value]  Note the '.' between the DINT and the opening bracket

Remember to confirm that Index_Value is 0 - 31 to prevent a runtime error.

The syntax of DINT[ index] with no period is used if the DINT tag was an array to select the particular array member. And DINT[array_index].[Index_Value] could be used to access a particular bit from one member of an array.

Edited by b_carlton

Share this post


Link to post
Share on other sites

Thanks for your response.

I also found a tech note that explain that using this 

MyArray[(MyIndex AND NOT 31) / 32 ] . [MyIndex AND 31]

 

Share this post


Link to post
Share on other sites

Can you link to that tech note? You shouldn't have to do anything fancy if you're just replacing a BOOL[32] array with a single DINT. Just limit check your MyIndex tag and use

DINTDataType.[MyIndex]

You will have to do something a little fancier if you want to convert a larger BOOL array to an array of DINTs.

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
Sign in to follow this  
Followers 0