Hi,
I've never used that chip (or MC28AD-16) before.
But looking at the datasheets, it should be pretty easy to do with the SHIFTOUT statement.
Maybe something like this un-tested code, which if I got it right, should turn each output on one at a time for 1/2 second each ...HTH,Code:<font color="#008000"><b>DEFINE </b></font><b>OSC </b><font color="#800000"><b>4 </b></font><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">"AllDigital.pbp" </font><b>SClk </b><font color="#008000"><b>VAR </b></font><b>PORTC</b>.<font color="#800000"><b>3 </b></font><font color="#0000FF"><b><i>; synchronous serial clock pin </i></b></font><b>SDout </b><font color="#008000"><b>VAR </b></font><b>PORTC</b>.<font color="#800000"><b>4 </b></font><font color="#0000FF"><b><i>; " " data " </i></b></font><b>Strobe </b><font color="#008000"><b>VAR </b></font><b>PORTC</b>.<font color="#800000"><b>5 </b></font><font color="#0000FF"><b><i>; " " strobe " </i></b></font><b>OutEnable </b><font color="#008000"><b>VAR </b></font><b>PORTA</b>.<font color="#800000"><b>4 </b></font><font color="#0000FF"><b><i>; " " output enable </i></b></font><b>OutData </b><font color="#008000"><b>VAR WORD </b></font><font color="#0000FF"><b><i>; 16-bit output state variable </i></b></font><b>LoopCount </b><font color="#008000"><b>VAR BYTE </b></font><font color="#0000FF"><b><i>;----[Initialize the shift register]---------------------------------------- </i></b></font><b>ShiftInit</b>: <font color="#008000"><b>HIGH </b></font><b>OutEnable </b><font color="#0000FF"><b><i>; shift register outputs disabled </i></b></font><font color="#008000"><b>LOW </b></font><b>Strobe </b><font color="#0000FF"><b><i>; Strobe idles LOW (active HIGH) </i></b></font><b>OutData </b>= <font color="#800000"><b>0 </b></font><font color="#008000"><b>GOSUB </b></font><b>SyncSend </b><font color="#0000FF"><b><i>; clear the shift registers </i></b></font><font color="#008000"><b>LOW </b></font><b>OutEnable </b><font color="#0000FF"><b><i>; enable shift registers outputs ;----[The Main Loop]-------------------------------------------------------- </i></b></font><b>Main</b>: <font color="#008000"><b>FOR </b></font><b>LoopCount </b>= <font color="#800000"><b>0 </b></font><font color="#008000"><b>to </b></font><font color="#800000"><b>15 </b></font><font color="#0000FF"><b><i>; loop thru all output channels </i></b></font><b>OutData </b>= <font color="#008000"><b>DCD </b></font><b>LoopCount </b><font color="#0000FF"><b><i>; set a single bit according to LoopCount </i></b></font><font color="#008000"><b>GOSUB </b></font><b>SyncSend </b><font color="#0000FF"><b><i>; send the data </i></b></font><font color="#008000"><b>PAUSE </b></font><font color="#800000"><b>500 </b></font><font color="#0000FF"><b><i>; wait half a second </i></b></font><font color="#008000"><b>NEXT </b></font><b>LoopCount </b><font color="#0000FF"><b><i>; do next output channel </i></b></font><font color="#008000"><b>GOTO </b></font><b>Main </b><font color="#0000FF"><b><i>;----[Send synchronous data]------------------------------------------------ </i></b></font><b>SyncSend</b>: <font color="#008000"><b>SHIFTOUT </b></font><b>SDout</b>, <b>SClk</b>, <font color="#800000"><b>1</b></font>,[<b>OutData</b>\<font color="#800000"><b>16</b></font>] <font color="#008000"><b>HIGH </b></font><b>Strobe </b><font color="#0000FF"><b><i>; strobe the shift registers latches </i></b></font>@ <b>NOP </b><font color="#0000FF"><b><i>; hold Strobe for 1uS </i></b></font><font color="#008000"><b>LOW </b></font><b>Strobe </b><font color="#0000FF"><b><i>; Strobe idles LOW </i></b></font><font color="#008000"><b>RETURN </b></font>




Bookmarks