Shop OBEX P1 Docs P2 Docs Learn Events
74hc595 Shift Register Help — Parallax Forums

74hc595 Shift Register Help

MRMR Posts: 46
edited 2010-03-09 02:56 in BASIC Stamp
Please Review my code and make corrections. I am trying to become more proficient at programming.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
They say if you Play a Microsoft CD backwards you can hear satanic messages, that's nothing because if you play it forward it installs Windows!

I didn't Fail 10,000 times, I simply found 10,000 ways that didn't work. -Thomas Edison

Comments

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-03-08 15:12
    You might want to put your shiftout logic in a subroutine and set the bit patterns in variables.
    You would save about 80 bytes of program memory space (based on your attached code).

    patt1 var byte
    patt2 var byte

    AUXIO
    DIRS=Dears
    OUTS=A
    MAINIO
    patt1=%11111001
    patt2=%11111111
    GOSUB Shiftproc

    Shiftproc:
    SHIFTOUT DataOut, Clock, MSBFIRST, [noparse][[/noparse]patt1]
    SHIFTOUT DataOut, Clock, MSBFIRST, [noparse][[/noparse]patt2]
    PULSOUT Latch, 5 ' latch outputs
    PAUSE Hold
    GOSUB clear
    RETURN
  • ercoerco Posts: 20,256
    edited 2010-03-09 02:56
    http://www.kronosrobotics.com/an137/DAN137.shtml

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
Sign In or Register to comment.