how to use SHIFTOUT?
Archiver
Posts: 46,084
To control a digital potentiometer (a Dallas 1267, which is a dual pot with two
wipers and two resistance
elements).
I believe I need to use the SHIFTOUT command to control this device. I wrote a
program to try it out, but it
doesn't work.
One difficulty is that the pot's datasheet calls for a 17 bit transfer. The
Basic Stamp manual seems to say that
SHIFTOUT will shift out only 16 bits at a time, but then it suggests the command
will after all shift more than
one variable or constant. By SHIFTOUTing more than one number in succession, it
should be possible to fill the
destination device's shift register with 20 or 32 bits or what have you.
I followed their example in the manual as a prototype for the SHIFTOUT command
in an effort to shift out my 17
bits. But no go. I am monitoring the digital pot's wiper with an ohmeter, and
the stamp is not moving the wiper
in response to the program.
Here is the test program. Perhaps someone can spot the problem. Many thanks
for your ideas on this. Michael G.
'{$STAMP BS2}
'this is TRY67.BS2. The idea is to try to make the DS1267-50 work.
'The first step is to declare variables and constants.
'Then enable the 1267 chip with the reset pin from P0
'then do the SHIFTOUT command
'For reference, p0 is RST, p6 is data, and p10 is the clock
OUTPUT 0
OUTPUT 6
OUTPUT 10
high 0 'pin 0 goes high to reset the 1267
'HERE IS THE PROTOTYPE SHIFTOUT COMMAND
'SHIFTOUT DATAPIN, CLOCKPIN, MODE, [noparse][[/noparse]STACKSELECT \1,W1 \8,W0 \8]
WIPER1 VAR BYTE
WIPER0 VAR BYTE
STACKSELECT CON 0
WIPER1=126
WIPER0=1
SHIFTOUT 6,10,MSBFIRST,[noparse][[/noparse]STACKSELECT\1, WIPER1\8, WIPER0\8]
LOW 0 'A NEW WIPER POSITION WILL ENGAGE ONLY AFTER RST GOES ' LOW
wipers and two resistance
elements).
I believe I need to use the SHIFTOUT command to control this device. I wrote a
program to try it out, but it
doesn't work.
One difficulty is that the pot's datasheet calls for a 17 bit transfer. The
Basic Stamp manual seems to say that
SHIFTOUT will shift out only 16 bits at a time, but then it suggests the command
will after all shift more than
one variable or constant. By SHIFTOUTing more than one number in succession, it
should be possible to fill the
destination device's shift register with 20 or 32 bits or what have you.
I followed their example in the manual as a prototype for the SHIFTOUT command
in an effort to shift out my 17
bits. But no go. I am monitoring the digital pot's wiper with an ohmeter, and
the stamp is not moving the wiper
in response to the program.
Here is the test program. Perhaps someone can spot the problem. Many thanks
for your ideas on this. Michael G.
'{$STAMP BS2}
'this is TRY67.BS2. The idea is to try to make the DS1267-50 work.
'The first step is to declare variables and constants.
'Then enable the 1267 chip with the reset pin from P0
'then do the SHIFTOUT command
'For reference, p0 is RST, p6 is data, and p10 is the clock
OUTPUT 0
OUTPUT 6
OUTPUT 10
high 0 'pin 0 goes high to reset the 1267
'HERE IS THE PROTOTYPE SHIFTOUT COMMAND
'SHIFTOUT DATAPIN, CLOCKPIN, MODE, [noparse][[/noparse]STACKSELECT \1,W1 \8,W0 \8]
WIPER1 VAR BYTE
WIPER0 VAR BYTE
STACKSELECT CON 0
WIPER1=126
WIPER0=1
SHIFTOUT 6,10,MSBFIRST,[noparse][[/noparse]STACKSELECT\1, WIPER1\8, WIPER0\8]
LOW 0 'A NEW WIPER POSITION WILL ENGAGE ONLY AFTER RST GOES ' LOW
Comments
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...