Ttelmah
Joined: 11 Mar 2010 Posts: 19370
|
|
Posted: Fri Aug 19, 2016 2:29 am |
|
|
Problem is that you can't fully tell what this is doing without knowing how LS138_A, B & C are defined....
However parts are 'simple':
Point&0x01 Takes the value in 'Point', and bitwise and's it with 0x1.
==0x01 Then tests if this is '1'.
So this can be coded alternatively as:
bit_test(Point,1)
So the result of this test is loaded into LS138_A (whatever this is....).
Now 'guessing', since I know the LS138, that LS138_A, is actually a bit definition of the output latch for the PIC pin connected to the LS138 'A' pin, this then puts the three bottom bits in 'Point', out on the three pins that select which output to turn 'on' (low).
So LS138_Out(0) will pull Y0 low. LS138_Out(1) will pull Y1 low etc..
So in fact the test could be done as:
output_bit(PIN_LSA, bit_test(Point,1));
Where 'PIN_LSA' is a pin define for the pin for the LS138 A connection.
Like most things in C, there are actually dozens of ways of coding the same result... |
|