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.
Dpin PIN 0 ' data pin to 74HC595 Clk PIN 1 ' shift clock to 74HC595 Latch PIN 2 ' latch 74HC595 outputs counter VAR Byte Setup: LOW Latch ' initialize latch output ' This loop moves the 8-bit value 'counter' onto the output lines of the ' '595, pauses, then increments counter and repeats. The data is shifted ' msb first so that the msb appears on pin QH and the lsb on QA. Changing ' MSBFIRST to LSBFIRST causes the data to appear backwards on the outputs. Main: DO SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]counter] ' send the bits PULSOUT Latch, 1 ' transfer to outputs PAUSE 100 ' Wait 0.1 seconds counter = counter + 1 ' increment counter LOOP ENDPost Edited (sylvie369) : 11/12/2008 7:16:58 PM GMT