FBC(file bit comparison) instruction

thejerryguy

Member
Join Date
Sep 2005
Location
PA
Posts
1
In my SLC 504 programs, I have used the FBC instruction to scan a word for a bit that has been set. This instruction is not supported in the micrologix 1500. I need to create an FBC instruction in a mocrologix 1500 system.
 
Maybe copy the word to a temporary register, then examine temp_reg.0 for true, if not loop through 15 times, each time dividing the word by 2 (shift right) and examine again temp_reg.0 for true.

Or perhaps, use a bit-shift?

For a quick way of seeing if any bit is set, just compare the word to zero. Not equal means at least one bit is set somewhere.
 
You could also set up a register and shift a single bit through each of 16 positions and AND that with the test word.

A Q&D way to do it is to just create an SBR - 17 rungs.

XIC N7:0/0 BST MOV N7:1 0 NXB RET BND
XIC N7:0/1 BST MOV N7:1 1 NXB RET BND
XIC N7:0/2 BST MOV N7:1 2 NXB RET BND
.
.
.
.
XIC N7:0/15 BST MOV N7:1 15 NXB RET BND
OTL N7:1/15

The position of the first found bit will be in N7:1. If N7:1 is negative then no bit was found.

Its not the most compact code, but its probably the fastest to enter.
 

Similar Topics

Dear Techies, My application requires to Compare two arrays and put the result of comparision in array. For this we can use FBC (File Bit Compare...
Replies
0
Views
3,487
Thinking about using the FBC instruction. Have never used it and have a couple questions. 1st does the reference need to be the same length as...
Replies
4
Views
3,401
Logix 5000 v32 on 1769-L16ER I used the FBC instruction to scan an array of DINTs for true bits and it works but I found a thing that just...
Replies
2
Views
69
Hi guys, having a few challenges with 90-30 and FBC BEM341 FIP bus controller. The goal is to be able to replace either the CPU 350 and or...
Replies
3
Views
1,844
Good afternoon all, I am attempting to get a panelview standard 1000e too communicate completely with a 1756-L83E through a 1756-DHRIO card and...
Replies
2
Views
2,808
Back
Top Bottom