PDA

View Full Version : 74hc595 Shift Register Help



MR
03-08-2010, 04:30 PM
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

Ron Czapala
03-08-2010, 11:12 PM
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, [patt1]
SHIFTOUT DataOut, Clock, MSBFIRST, [patt2]
PULSOUT Latch, 5 ' latch outputs
PAUSE Hold
GOSUB clear
RETURN

erco
03-09-2010, 10:56 AM
http://www.kronosrobotics.com/an137/DAN137.shtml

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"If you build it, they will come."