Using PBASIC "SHIFTIN" command with an ADC, and a BS2 ?
When using the SHIFTIN (SHIFTIN Dpin, Cpin, Mode),· does the BS2 deliver pre-set clock pulses to a connected ADC chip?· What I mean is, are the pulses automatically set within the BS2?· Or do we need to prescribe the timing of the pulses?
PO2L
PO2L
Comments
You do need to concern yourself with the "mode", but the SHIFTIN/SHIFTOUT commands do take control of the clock pin and deliver those pulses as needed. You do not need to separately mess with clock pulses.
You can read about this in some detail beginning on page 65 of the "Understanding Signals" text, available for free download here:
www.parallax.com/Store/Books/EducationalTexts/tabid/181/CategoryID/66/List/0/Level/a/ProductID/150/Default.aspx?SortField=ProductName,ProductName.
Just for the fun of it, here (attached) is an image of the output from the Stamp Logic Analyzer when I run the code below on a BS2sx. Notice the clock pulses produced automatically and at the right timings on P1.
Post Edited (sylvie369) : 11/12/2008 7:16:58 PM GMT