Shop OBEX P1 Docs P2 Docs Learn Events
Using SHIFTOUT with DS pot — Parallax Forums

Using SHIFTOUT with DS pot

ArchiverArchiver Posts: 46,084
edited 2001-12-17 16:00 in General Discussion
Hello Kalun,

Many thanks for this code and the PULSOUT idea. I will try it today.

Is it necessary to put the SHIFTOUT variables describing the wiper positions
into Hex? Or can SHIFTOUT read and operate
upon decimal variables? There are 255 possible wiper positions along the "arc"
of the resistance element. The variables
would assume values in the range 1-255. There are two variables because this
dual pot has two wipers.

That irksome 17th bit that Dallas Semiconductor wants us to inject into the
pot's internal shift register is intended to
tell the dual pot which wiper to connect to a particular pot output pin (wiper0
or wiper1). We are supposed to use this
common wiper pin in applications where the two pots are connected end to end,
that is, stacked, to create in effect a
single pot with 560 positions along the dial. But the 17th bit is supposed to be
included in every SHIFTOUT regardless of
the wiring configuration.

It seems to me that SHIFTOUT should automatically generate from the the Stamp a
clock pulse to shepherd that 17th bit.
But something not happening because the pot is sound asleep.

Maybe it is a phasing problem -- I noticed in some books with program examples
using SHIFTOUT that the clock is
pre-positioned high or low before SHIFTOUT is invoked.

Another posibility. Maybe my pot is DOA.

Best wishes and thank you again, Kalun.
Michael


Kalun Lau wrote:

> Hello Michael,
>
> Try the following code:
>
> OutPot var word
> PotA var OutPot.highbyte
> PotB var OutPot.lowbyte
>
> PotA = $FF
> PotB = $00
>
> init:
> HIGH RST 'RST pin on DS1267
> pulsout CLK,1
> shiftout Datapin, CLK, [noparse][[/noparse]OutPot\16]
> LOW RST
>
> the pulsout CLK,1 will give the pulse 17 to the clock
>
> Sunday, December 16, 2001, 4:29:24 PM, you wrote:
>
> MG> To control a digital potentiometer (a Dallas 1267, which is a dual pot
with two wipers and two resistance
> MG> elements).
>
> MG> I believe I need to use the SHIFTOUT command to control this device. I
wrote a program to try it out, but it
> MG> doesn't work.
>
> MG> One difficulty is that the pot's datasheet calls for a 17 bit transfer.
The Basic Stamp manual seems to say that
> MG> SHIFTOUT will shift out only 16 bits at a time, but then it suggests the
command will after all shift more than
> MG> one variable or constant. By SHIFTOUTing more than one number in
succession, it should be possible to fill the
> MG> destination device's shift register with 20 or 32 bits or what have you.
>
> MG> I followed their example in the manual as a prototype for the SHIFTOUT
command in an effort to shift out my 17
> MG> bits. But no go. I am monitoring the digital pot's wiper with an
ohmeter, and the stamp is not moving the wiper
> MG> in response to the program.
>
> MG> Here is the test program. Perhaps someone can spot the problem. Many
thanks for your ideas on this. Michael G.
>
> MG> '{$STAMP BS2}
> MG> 'this is TRY67.BS2. The idea is to try to make the DS1267-50 work.
> MG> 'The first step is to declare variables and constants.
> MG> 'Then enable the 1267 chip with the reset pin from P0
> MG> 'then do the SHIFTOUT command
> MG> 'For reference, p0 is RST, p6 is data, and p10 is the clock
> MG> OUTPUT 0
> MG> OUTPUT 6
> MG> OUTPUT 10
>
> MG> high 0 'pin 0 goes high to reset the 1267
>
> MG> 'HERE IS THE PROTOTYPE SHIFTOUT COMMAND
> MG> 'SHIFTOUT DATAPIN, CLOCKPIN, MODE, [noparse][[/noparse]STACKSELECT \1,W1 \8,W0 \8]
>
> MG> WIPER1 VAR BYTE
> MG> WIPER0 VAR BYTE
> MG> STACKSELECT CON 0
>
> MG> WIPER1=126
> MG> WIPER0=1
>
> MG> SHIFTOUT 6,10,MSBFIRST,[noparse][[/noparse]STACKSELECT\1, WIPER1\8, WIPER0\8]
>
> MG> LOW 0 'A NEW WIPER POSITION WILL ENGAGE ONLY AFTER RST GOES ' LOW
>
> MG> To UNSUBSCRIBE, just send mail to:
> MG> basicstamps-unsubscribe@yahoogroups.com
> MG> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> MG> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
> Best regards,
> Kalun mailto:klnlau@v...
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Sign In or Register to comment.