Shop OBEX P1 Docs P2 Docs Learn Events
SHIFTOUT with inverted clock ? — Parallax Forums

SHIFTOUT with inverted clock ?

BeanBean Posts: 8,129
edited 2006-03-24 13:03 in BASIC Stamp
Is there any way to do SHIFTOUT with the clock inverted ?

I have a device that the clock pin MUST be normally held high, and clocks in data on the rising edge.

When the SHIFTOUT instruction is done the clock is left low, I must make the clock pin HIGH for the device to latch-in the new data. When I do this (make the clock pin high) the device shifts in an extra zero.

What I'm doing now is to only shift in 7 bits on the last byte of data, then set the data pin the last bit, then raise the clock line. Is there any other way ?

Bean.


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

"SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com

Coming soon... Cheap 4-digit LED display with driver IC·www.hc4led.com

"Sometimes it is better to remain silent and be thought a fool, than to speak and remove all doubt."
·

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-03-23 19:55
    No, but you could write a simple subroutine that is customized to your app:

    Get_Byte:
    · FOR idx =·0 TO·7
    ··· PULSOUT ClkPin, 5
    ··· temp.LOWBIT(idx) = DataPin
    · NEXT

    This assumes that the clock pin has been initialized high.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • BeanBean Posts: 8,129
    edited 2006-03-24 13:03
    Thanks Jon.

    I ended up doing this:
      SHIFTOUT Dat, Clock, MSBFIRST,[noparse][[/noparse]segments(3), segments(2), segments(1), (segments(0) >> 1)\7]
      Dat = segments(0) & 1
      HIGH Clock
    
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
    Product web site: www.sxvm.com

    Coming soon... Cheap 4-digit LED display with driver IC·www.hc4led.com

    "Sometimes it is better to remain silent and be thought a fool, than to speak and remove all doubt."
    ·
Sign In or Register to comment.