Shop OBEX P1 Docs P2 Docs Learn Events
shiftout question — Parallax Forums

shiftout question

ArchiverArchiver Posts: 46,084
edited 2002-11-16 13:14 in General Discussion
I need to shift out eleven bits

3 address bits, then 8 data bits

Is there a way to do this using shiftout and a two digit hex number?

so in effect I need to send
a2,a1,a0,d7,d6,d5,d4,d3,d2,d1,d0

it wants to see a2 as the first bit, and I don't quite understand how to
do this

say I shiftout hex 3
msb first
this will send
0000 0011 starting left to right - most sig thru least correst

and if I were to use lstfirst

it would send
1100 0000 correct?

so is there an easy way to do this?

I need to send msbfirst, except skip of the most sig 5 bits

thanks

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-11-16 12:53
    Try this:

    SHIFTOUT p_data, p_clock, MSBFIRST, [noparse][[/noparse]a << 5 \3, d]

    or,

    SHIFTOUT p_data, p_clock, MSBFIRST, [noparse][[/noparse]a << 5 + d \11]


    Regards,

    Steve

    On 16 Nov 02 at 5:39, rad0 wrote:

    > I need to shift out eleven bits
    >
    > 3 address bits, then 8 data bits
  • ArchiverArchiver Posts: 46,084
    edited 2002-11-16 13:14
    On 16 Nov 02 at 5:53, S Parkis wrote:

    > Try this:
    >
    > SHIFTOUT p_data, p_clock, MSBFIRST, [noparse][[/noparse]a << 5 \3, d]
    >
    > or,
    >
    > SHIFTOUT p_data, p_clock, MSBFIRST, [noparse][[/noparse]a << 5 + d \11]


    Correction to last line:

    SHIFTOUT p_data, p_clock, MSBFIRST, [noparse][[/noparse]a << 8 + d << 5 \11]

    Sorry for the confusion.

    Steve
Sign In or Register to comment.