You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old October 19th, 2009, 06:04 PM   #1
timmyh
Member
United States

timmyh is offline
 
Join Date: Apr 2008
Location: St. Louis, MO
Posts: 28
Ifix access of a bit in a Dint

Hi everyone,

Sorry if I am a little vague but this question was ask to me by someone working on a system that I am not familiar with. Anyway the plc is a control logix and hmi software is ifix. They are using igs driver. How do you access one bit from a dint register? I know in fix32 you can use F_00 for a bit of an int. Is there anything similar in ifix. Sorry I dont have more info.
  Reply With Quote
Old October 19th, 2009, 08:38 PM   #2
TConnolly
Lifetime Supporting Member
United States

TConnolly is offline
 
TConnolly's Avatar
 
Join Date: Apr 2005
Location: Salt Lake City
Posts: 6,147
I'm not familiar with ifix, however, I'll try and answer the general "how to" of your question.

The status of any bit can be accessed by bitwise ANDing the word with a mask where only the desired bit is set.

For example,

IF (DINT_TAG & 8) Then Do whatever -> will do whatever if bit 3 is set.

IF (DINT_TAG & 536870912) Then Do whatever -> will do whatever if bit 29 is set.

To determine the value to bitwise AND to the DINT raise 2 to the power of the bit number. 2^3 is 8. 2^29 is 536870912

If DINT_TAG is signed in ifix then the 31st bit needs different treatment because bit 31 is the sign bit. Therfore (DINT_TAG & -2147483648) may be needed to check for bit 31.

I hope that helps.
__________________
True craftsmanship is only one more power tool away.

That's the beauty of processors, they don't have emotions they just run code - The PLC Kid.
  Reply With Quote
Old October 20th, 2009, 11:07 AM   #3
CowDung
Member
United States

CowDung is offline
 
CowDung's Avatar
 
Join Date: Dec 2006
Location: Milwaukee
Posts: 180
The database in iFix works the same way as Fix32. The F_00 thing should work.
  Reply With Quote
Old December 2nd, 2010, 02:23 PM   #4
phuz
Member
United States

phuz is offline
 
Join Date: Jun 2008
Location: Mohnton, PA
Posts: 768
Not true. The F_xx refers to the offset in an array.
So if you are referencing F_CV as ANALOG_ARRAY[0] then F_01 would reference ANALOG_ARRAY[1].
Unfortunately there is no easy way to do bit picking (masking) in IFIX. You have to use an equation similar to what I am doing here:
Fix32.XXXX.XX_HV-150-18_DEV_3_STAT.F_CV - ( 4096 * ( INT ( Fix32.XXXX.XX_HV-150-18_DEV_3_STAT.F_CV / 4096 ) ) ) >= 512
For me, this references bit 9 of the analog register.
Wonderware makes this easy...one of the many reasons why I prefer it over IFIX.
  Reply With Quote
Old August 9th, 2015, 01:03 AM   #5
hkamps
Member
Mexico

hkamps is offline
 
Join Date: Feb 2009
Location: D.F.
Posts: 4
Ifix has some undocumented features......

so please have a look at the following page : http://support.ge-ip.com/support/ind...66&actp=search

Good luck..
  Reply With Quote
Old August 9th, 2015, 12:27 PM   #6
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 812
tagname.1 or tagname[0].1 if an array of dints.
If I was at my machine I could tell you precisely, I do it all the time. I use Kepware but IGS is very similar.
There is some wierdness in kepware wherein tags that are static force you to use a slash instead of a dot. i.e. tagname/1 (as I recall)
  Reply With Quote
Old August 19th, 2015, 11:38 AM   #7
hkamps
Member
Mexico

hkamps is offline
 
Join Date: Feb 2009
Location: D.F.
Posts: 4
So how would that look like in a expression, Node.TagName.F_CV.0 because when I put it like that and go to runtime Ifix notifies me that the tag doesn´t exist
  Reply With Quote
Old August 19th, 2015, 11:47 AM   #8
phuz
Member
United States

phuz is offline
 
Join Date: Jun 2008
Location: Mohnton, PA
Posts: 768
No.
For bit 0, F_00
For bit 15, F_15
  Reply With Quote
Old August 19th, 2015, 11:53 AM   #9
hkamps
Member
Mexico

hkamps is offline
 
Join Date: Feb 2009
Location: D.F.
Posts: 4
When going to runtime it shows illegal block field, tag is defined as an AI
  Reply With Quote
Old August 19th, 2015, 12:00 PM   #10
phuz
Member
United States

phuz is offline
 
Join Date: Jun 2008
Location: Mohnton, PA
Posts: 768
I know it seems counter-intuitive, but if you are trying to bit pick from a DINT, you need to create a data type DR for the analog register in order to use F_XX.
If you have an analog array and try to use F_XX, you will be accessing member XX of the array. For example DINT[3] would be F_03 of that analog array.
Try using the DR data type and you'll be fine.
  Reply With Quote
Old August 19th, 2015, 01:14 PM   #11
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 812
AI tag can't address a bit, only an entire register. Use DI, DO or DR for this. I almost always use DI and turn the output on or off if needed. But opinions differ.

I address these bits in the iFix Database one of 2 ways:

If I have an array of bools in the PLC I address the 12th bit in brackets.
i.e. Line1.PLC131.MaintenanceBits[12]

If I have them in a DINT in the PLC I use bracket and decimal. i.e. Line1.PLC131.MaintenanceBits[0].12
  Reply With Quote
Old August 19th, 2015, 01:16 PM   #12
phuz
Member
United States

phuz is offline
 
Join Date: Jun 2008
Location: Mohnton, PA
Posts: 768
Quote:
Originally Posted by TheWaterboy View Post
AI tag can't address a bit, only an entire register. Use DI, DO or DR for this. I almost always use DI and turn the output on or off if needed. But opinions differ.

I address these bits in the iFix Database one of 2 ways:

If I have an array of bools in the PLC I address the 12th bit in brackets.
i.e. Line1.PLC131.MaintenanceBits[12]

If I have them in a DINT in the PLC I use bracket and decimal. i.e. Line1.PLC131.MaintenanceBits[0].12
Yes, but he is talking about bit-picking a DINT. So rather than creating 32 tags for 32 bits, you create one tag, and use F_XX in workspace to reference each of the 32 bits.
  Reply With Quote
Old August 19th, 2015, 01:25 PM   #13
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 812
So am I but I'm just picking it from the PLC instead of the iFix DB.

Your suggestion would certainly optimize the comm traffic (Which IGS attempts to take care of for you) but make it a little more difficult to troubleshoot.

When comms are fast enough, I prefer to pull 32 bits with their own tagnames. But if you are counting tags for licensing then DR is the way to go.
  Reply With Quote
Old August 19th, 2015, 01:30 PM   #14
phuz
Member
United States

phuz is offline
 
Join Date: Jun 2008
Location: Mohnton, PA
Posts: 768
Quote:
Originally Posted by TheWaterboy View Post
So am I but I'm just picking it from the PLC instead of the iFix DB.

Your suggestion would certainly optimize the comm traffic (Which IGS attempts to take care of for you) but make it a little more difficult to troubleshoot.

When comms are fast enough, I prefer to pull 32 bits with their own tagnames. But if you are counting tags for licensing then DR is the way to go.
I personally prefer to bitpick because I have not encountered a situation where it over-complicated the setup. In fact, it helps keep the number of tags to a minimum. Great for throughput and tag limits.
  Reply With Quote
Old August 19th, 2015, 01:45 PM   #15
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 812
Where do you document Tagname.F_XX for its specific purpose.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Question: bit access and VAR_IN_OUT? titi_nicolas LIVE PLC Questions And Answers 3 August 14th, 2009 12:38 PM
gray code 3 bit MAHER LIVE PLC Questions And Answers 13 April 25th, 2009 03:10 PM
Bit Masking (Filter) Example Jordanx LIVE PLC Questions And Answers 2 June 12th, 2008 11:57 AM
help needed with mitsubishi FX2N CRC sorrrrrin LIVE PLC Questions And Answers 15 November 3rd, 2005 01:34 PM
S7 - using Arrays with Multiplex Addressing in ProTool RMA LIVE PLC Questions And Answers 4 August 12th, 2005 08:39 AM


All times are GMT -5. The time now is 06:47 PM.


.