On Tue, 2008-01-22 at 09:33 -0600, Jeff Epler wrote:
> A "bit" pin which is TRUE can have any nonzero value, not just 1.  So
> the line
>     bit_shifted = (bit_in << which_bit);
> is incorrect.  Instead, you may wish to write something like
>     if(bit_in)
>         accum = accum | (1 << which_bit);
> to avoid the confusion.  (I prefer "|" (bitwise OR) to "+" (addition) in
> this case, to emphasize the nature of the operation.  But either should
> work the same way)
> 
> For example, here's the way that the parport bits are read into HAL
> pins:
>         *(port->status_in[b]) = indata & mask;
> so if the pin corresponds to the '8' bit in indata, then that HAL pin
> will have the value 8 if it is TRUE and 0 if it is false.
> 
> Jeff

Thanks Jeff (Alex and Javid) for the replies. The above, explains why
the comp runs differently between the simulated input and the actual
input. With the simulated input, I know I am getting 00000000 and
00000001 for values(?). The data coming in from parport.0.pin-X-in is
00000000 and ???????? (but non-zero). Shifting ???????? results
in ???????? (dooh).

In the example above, if (status register?) port pins 1, 3, and 5 are
high with the rest low, indata would be 00010101? To check for pin 3
this would be anded with 00000100 resulting in 00000100, which would be
what my shift would start with? This all makes sense (now).

Too bad it's so cold in the shop. (I can hear the ahhhh's from the
non-Californians.) It may take a while to get my butt out there to test
the update.

-- 
Kirk Wallace (California, USA
http://www.wallacecompany.com/machine_shop/ 
Hardinge HNC lathe,
Bridgeport mill conversion, doing XY now,
Zubal lathe conversion pending)


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to