PDA

View Full Version : Is anybody familiar with PICBlock MC28AD-16



jimseng
- 6th July 2009, 12:48
I have just ordered one of these i/o boards since it seems to be just what I need but I have realized that I may have bitten off more than I can chew since I am a bit of a novice. I will need to set the 16 open collector outputs based on UCN5841 serial latched drivers. Has anybody used these boards and therefore able to give me a shove in the right direction?

Thanks

Darrel Taylor
- 7th July 2009, 03:39
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 ...
<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">&quot;AllDigital.pbp (http://www.picbasic.co.uk/forum/showthread.php?t=11100)&quot;

</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>; &quot; &quot; data &quot;
</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>; &quot; &quot; strobe &quot;
</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>; &quot; &quot; 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>

HTH,

EarlyBird2
- 9th July 2009, 10:24
I have used these. The inputs are read by portB and the outputs are open collectors driven by PortC. Read portB for the inputs and set PortC for your outputs.

Seems very simple to me unless I am missing something.

Steve

EarlyBird2
- 9th July 2009, 10:33
Yes I missed something. I used the old version the MC28D which had only 8 inputs and 8 outputs. :)

Steve

jimseng
- 10th July 2009, 10:58
Well I don't know what happend to my response. I posted a thankyou yesterday and it seems to have dissapeared. You must have thought I was so rude. Thanks. It seems not too daunting.

Darrel Taylor
- 11th July 2009, 02:51
Ah Ha! You found our "Twilight Zone" section. :D
You never know where they go.

No problem.
I figured you were just waiting till you received the board you ordered.

Hope it works out for you.