A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
Interfacing a PIC with Digital Potentiometer? - smitty505000 - Oct 9 16:04:00 2005
Hey all,
I am working on another R/C project and need to be able to adjust a
5K 3 wire pot via Pic. I have been looking at digital pots and see
that they have 2 types I2C and SPI. What does this mean? I just need
to be able to adjust the pot via a Pic from 0-5K with no fancy extras.
Can someone help me?
Thanks!
Neil Smith

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - rtstofer - Oct 9 16:39:00 2005
--- In piclist@picl..., "smitty505000" <smitty505000@y...>
wrote:
>
> Hey all,
>
> I am working on another R/C project and need to be able to adjust
a
> 5K 3 wire pot via Pic. I have been looking at digital pots and see
> that they have 2 types I2C and SPI. What does this mean? I just need
> to be able to adjust the pot via a Pic from 0-5K with no fancy
extras.
> Can someone help me?
>
> Thanks!
> Neil Smith
If you want to talk to the potentiometer, you have to speak the
language. You didn't say which PIC and it matters because some have
hardware implementations of I2C and/or SPI. However, if you aren't
adjusting it very often, it is probably easier to bit-bang SPI than
I2C.
Unless you have a compelling reason to go with I2C, you will find SPI
easier to use. Even without the hardware help, you only have to
wiggle two outputs (data and clock) to control the device. Look at
the timing diagram for assistance.
Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - smitty505000 - Oct 9 20:08:00 2005
I can use just about any pic I need to use. I will also be
programing in Pic Basic Pro. I am going to be using a couple of R/C
heading hold gyros that will be read by the Serin command then take
that data and apply it linearly to the 5K digital pot. I can already
read the data from the gyro and get a number from 100-215. I just
need to figure out what digital pot to get and how to send it the
data. The pot will need to be updated in real time or as close to
real time as possible. If you are wondering, I am making a head
tracking device for live airbourn video in an R/C plane.
Thanks!
Neil Smith
--- In piclist@picl..., "rtstofer" <rstofer@p...> wrote:
>
> --- In piclist@picl..., "smitty505000" <smitty505000@y...>
> wrote:
> >
> > Hey all,
> >
> > I am working on another R/C project and need to be able to
adjust
> a
> > 5K 3 wire pot via Pic. I have been looking at digital pots and
see
> > that they have 2 types I2C and SPI. What does this mean? I just
need
> > to be able to adjust the pot via a Pic from 0-5K with no fancy
> extras.
> > Can someone help me?
> >
> > Thanks!
> > Neil Smith
> >
>
> If you want to talk to the potentiometer, you have to speak the
> language. You didn't say which PIC and it matters because some
have
> hardware implementations of I2C and/or SPI. However, if you
aren't
> adjusting it very often, it is probably easier to bit-bang SPI
than
> I2C.
>
> Unless you have a compelling reason to go with I2C, you will find
SPI
> easier to use. Even without the hardware help, you only have to
> wiggle two outputs (data and clock) to control the device. Look
at
> the timing diagram for assistance.
>
> Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Re: Interfacing a PIC with Digital Potentiometer? - Norm Carlberg - Oct 9 21:10:00 2005
Example code in Proton Plus
very similar to PicBasicPro.
Digipots are limited milliamps. May be used with opamps however for more
amps.
' PROTON PLUS DIGITAL POT 10-9-05
Symbol sCS1 = PORTB.1
Symbol sSCK1 = PORTB.2
Symbol sDATA1 = PORTB.3
Symbol sCS2 = PORTB.4
Symbol sSCK2 = PORTB.5
Symbol sDATA2 = PORTB.6
'********************************
' digipot MC41xxx MICROCHIP 5v max 1ma max
' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vRAW1 = ",Dec vRAW1,13]
vPOTSET1.LowByte = vRAW1
' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16 vPOTSET1,13]
vPOTSET1.HighByte = %00010001
' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16 vPOTSET1,13]
Low sCS1
SHOut sDATA1,sSCK1,msbfirst_l,[vPOTSET1\16] ' Shift out the 16-bit word
High sCS1
'********************************
' digipot AD7376 ANALOG DEVICES 30v max 5ma to 20ma max
Low sCS2
SHOut sDATA2,sSCK2,msbfirst_l,[vPOTSET2\8] ' Shift out the 8-bit byte
High sCS2
'********************************
Norm
----- Original Message -----
From: "smitty505000" <smitty505000@smit...>
To: <piclist@picl...>
Sent: Sunday, October 09, 2005 7:08 PM
Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
> I can use just about any pic I need to use. I will also be
> programing in Pic Basic Pro. I am going to be using a couple of R/C
> heading hold gyros that will be read by the Serin command then take
> that data and apply it linearly to the 5K digital pot. I can already
> read the data from the gyro and get a number from 100-215. I just
> need to figure out what digital pot to get and how to send it the
> data. The pot will need to be updated in real time or as close to
> real time as possible. If you are wondering, I am making a head
> tracking device for live airbourn video in an R/C plane.
>
> Thanks!
> Neil Smith
>
> --- In piclist@picl..., "rtstofer" <rstofer@p...> wrote:
> >
> > --- In piclist@picl..., "smitty505000" <smitty505000@y...>
> > wrote:
> > >
> > > Hey all,
> > >
> > > I am working on another R/C project and need to be able to
> adjust
> > a
> > > 5K 3 wire pot via Pic. I have been looking at digital pots and
> see
> > > that they have 2 types I2C and SPI. What does this mean? I just
> need
> > > to be able to adjust the pot via a Pic from 0-5K with no fancy
> > extras.
> > > Can someone help me?
> > >
> > > Thanks!
> > > Neil Smith
> > >
> >
> > If you want to talk to the potentiometer, you have to speak the
> > language. You didn't say which PIC and it matters because some
> have
> > hardware implementations of I2C and/or SPI. However, if you
> aren't
> > adjusting it very often, it is probably easier to bit-bang SPI
> than
> > I2C.
> >
> > Unless you have a compelling reason to go with I2C, you will find
> SPI
> > easier to use. Even without the hardware help, you only have to
> > wiggle two outputs (data and clock) to control the device. Look
> at
> > the timing diagram for assistance.
> >
> > Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - smitty505000 - Oct 9 21:59:00 2005
Thanks Norm! That gives me some direction. I am having a hard time
finding a digi pot with 5K and in a thru hole dip package. Are the
higher values adjustable? In other words can I get a 50K Digi pot
with 256 steps and program it for 5K with 256 steps? Or am I down to
like 25.6 steps at 5K?
Thanks in advance guys!!
Neil Smith
--- In piclist@picl..., "Norm Carlberg" <normnet@h...> wrote:
>
> Example code in Proton Plus
> very similar to PicBasicPro.
>
> Digipots are limited milliamps. May be used with opamps however
for more
> amps.
>
> ' PROTON PLUS DIGITAL POT 10-9-05
> Symbol sCS1 = PORTB.1
> Symbol sSCK1 = PORTB.2
> Symbol sDATA1 = PORTB.3
>
> Symbol sCS2 = PORTB.4
> Symbol sSCK2 = PORTB.5
> Symbol sDATA2 = PORTB.6
>
> '********************************
>
> ' digipot MC41xxx MICROCHIP 5v max 1ma max
> ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vRAW1 = ",Dec vRAW1,13]
> vPOTSET1.LowByte = vRAW1
> ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16
vPOTSET1,13]
> vPOTSET1.HighByte = %00010001
> ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16
vPOTSET1,13]
>
> Low sCS1
> SHOut sDATA1,sSCK1,msbfirst_l,[vPOTSET1\16] ' Shift out the 16-bit
word
> High sCS1
>
> '********************************
> ' digipot AD7376 ANALOG DEVICES 30v max 5ma to 20ma max
>
> Low sCS2
> SHOut sDATA2,sSCK2,msbfirst_l,[vPOTSET2\8] ' Shift out the 8-bit
byte
> High sCS2
>
> '********************************
>
> Norm
>
> ----- Original Message -----
> From: "smitty505000" <smitty505000@y...>
> To: <piclist@picl...>
> Sent: Sunday, October 09, 2005 7:08 PM
> Subject: [piclist] Re: Interfacing a PIC with Digital
Potentiometer?
> > I can use just about any pic I need to use. I will also be
> > programing in Pic Basic Pro. I am going to be using a couple of
R/C
> > heading hold gyros that will be read by the Serin command then
take
> > that data and apply it linearly to the 5K digital pot. I can
already
> > read the data from the gyro and get a number from 100-215. I just
> > need to figure out what digital pot to get and how to send it the
> > data. The pot will need to be updated in real time or as close to
> > real time as possible. If you are wondering, I am making a head
> > tracking device for live airbourn video in an R/C plane.
> >
> > Thanks!
> > Neil Smith
> >
> > --- In piclist@picl..., "rtstofer" <rstofer@p...>
wrote:
> > >
> > > --- In piclist@picl..., "smitty505000"
<smitty505000@y...>
> > > wrote:
> > > >
> > > > Hey all,
> > > >
> > > > I am working on another R/C project and need to be able to
> > adjust
> > > a
> > > > 5K 3 wire pot via Pic. I have been looking at digital pots
and
> > see
> > > > that they have 2 types I2C and SPI. What does this mean? I
just
> > need
> > > > to be able to adjust the pot via a Pic from 0-5K with no
fancy
> > > extras.
> > > > Can someone help me?
> > > >
> > > > Thanks!
> > > > Neil Smith
> > > >
> > >
> > > If you want to talk to the potentiometer, you have to speak the
> > > language. You didn't say which PIC and it matters because some
> > have
> > > hardware implementations of I2C and/or SPI. However, if you
> > aren't
> > > adjusting it very often, it is probably easier to bit-bang SPI
> > than
> > > I2C.
> > >
> > > Unless you have a compelling reason to go with I2C, you will
find
> > SPI
> > > easier to use. Even without the hardware help, you only have
to
> > > wiggle two outputs (data and clock) to control the device.
Look
> > at
> > > the timing diagram for assistance.
> > >
> > > Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Re: Interfacing a PIC with Digital Potentiometer? - Norm Carlberg - Oct 9 22:38:00 2005
I haven't seen any programmable for total resistance with same number of
steps.
Take a look at Digikey MCP42010-I/P-ND Dual 10k dip 256 steps.
In parallel = 5k.
Norm
----- Original Message -----
From: "smitty505000" <smitty505000@smit...>
To: <piclist@picl...>
Sent: Sunday, October 09, 2005 8:59 PM
Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
> Thanks Norm! That gives me some direction. I am having a hard time
> finding a digi pot with 5K and in a thru hole dip package. Are the
> higher values adjustable? In other words can I get a 50K Digi pot
> with 256 steps and program it for 5K with 256 steps? Or am I down to
> like 25.6 steps at 5K?
>
> Thanks in advance guys!!
>
> Neil Smith
>
> --- In piclist@picl..., "Norm Carlberg" <normnet@h...> wrote:
> >
> > Example code in Proton Plus
> > very similar to PicBasicPro.
> >
> > Digipots are limited milliamps. May be used with opamps however
> for more
> > amps.
> >
> > ' PROTON PLUS DIGITAL POT 10-9-05
> > Symbol sCS1 = PORTB.1
> > Symbol sSCK1 = PORTB.2
> > Symbol sDATA1 = PORTB.3
> >
> > Symbol sCS2 = PORTB.4
> > Symbol sSCK2 = PORTB.5
> > Symbol sDATA2 = PORTB.6
> >
> > '********************************
> >
> > ' digipot MC41xxx MICROCHIP 5v max 1ma max
> > ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vRAW1 = ",Dec vRAW1,13]
> > vPOTSET1.LowByte = vRAW1
> > ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16
> vPOTSET1,13]
> > vPOTSET1.HighByte = %00010001
> > ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16
> vPOTSET1,13]
> >
> > Low sCS1
> > SHOut sDATA1,sSCK1,msbfirst_l,[vPOTSET1\16] ' Shift out the 16-bit
> word
> > High sCS1
> >
> > '********************************
> > ' digipot AD7376 ANALOG DEVICES 30v max 5ma to 20ma max
> >
> > Low sCS2
> > SHOut sDATA2,sSCK2,msbfirst_l,[vPOTSET2\8] ' Shift out the 8-bit
> byte
> > High sCS2
> >
> > '********************************
> >
> > Norm
> >
> >
> >
> > ----- Original Message -----
> > From: "smitty505000" <smitty505000@y...>
> > To: <piclist@picl...>
> > Sent: Sunday, October 09, 2005 7:08 PM
> > Subject: [piclist] Re: Interfacing a PIC with Digital
> Potentiometer?
> >
> >
> > > I can use just about any pic I need to use. I will also be
> > > programing in Pic Basic Pro. I am going to be using a couple of
> R/C
> > > heading hold gyros that will be read by the Serin command then
> take
> > > that data and apply it linearly to the 5K digital pot. I can
> already
> > > read the data from the gyro and get a number from 100-215. I just
> > > need to figure out what digital pot to get and how to send it the
> > > data. The pot will need to be updated in real time or as close to
> > > real time as possible. If you are wondering, I am making a head
> > > tracking device for live airbourn video in an R/C plane.
> > >
> > > Thanks!
> > > Neil Smith
> > >
> > > --- In piclist@picl..., "rtstofer" <rstofer@p...>
> wrote:
> > > >
> > > > --- In piclist@picl..., "smitty505000"
> <smitty505000@y...>
> > > > wrote:
> > > > >
> > > > > Hey all,
> > > > >
> > > > > I am working on another R/C project and need to be able to
> > > adjust
> > > > a
> > > > > 5K 3 wire pot via Pic. I have been looking at digital pots
> and
> > > see
> > > > > that they have 2 types I2C and SPI. What does this mean? I
> just
> > > need
> > > > > to be able to adjust the pot via a Pic from 0-5K with no
> fancy
> > > > extras.
> > > > > Can someone help me?
> > > > >
> > > > > Thanks!
> > > > > Neil Smith
> > > > >
> > > >
> > > > If you want to talk to the potentiometer, you have to speak the
> > > > language. You didn't say which PIC and it matters because some
> > > have
> > > > hardware implementations of I2C and/or SPI. However, if you
> > > aren't
> > > > adjusting it very often, it is probably easier to bit-bang SPI
> > > than
> > > > I2C.
> > > >
> > > > Unless you have a compelling reason to go with I2C, you will
> find
> > > SPI
> > > > easier to use. Even without the hardware help, you only have
> to
> > > > wiggle two outputs (data and clock) to control the device.
> Look
> > > at
> > > > the timing diagram for assistance.
> > > >
> > > > Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - smitty505000 - Oct 9 23:42:00 2005
Norm,
Funny you should suggest the MCP42010, I just ordered a couple and
from Jameco nevertheless! Never even thought of putting them in
parallel though, Thanks! Now I just have to find out how to hook
them up to the pic and if I need any other components. I will be
removing qty 2, 5K 3 wire pots from my RC transmitter and replace
them with this circuit. On my Head Mounted Display will be two
heading lock gyro's that will read up/down and left/right. They will
send data to the pic that will convert those and then send out to
the digi pots. These two pots output to my radio and will then
control camera pan and tilt on my plane. What do you think? Crazy
huh?
Neil Smith
--- In piclist@picl..., "Norm Carlberg" <normnet@h...> wrote:
>
> I haven't seen any programmable for total resistance with same
number of
> steps.
> Take a look at Digikey MCP42010-I/P-ND Dual 10k dip 256 steps.
> In parallel = 5k.
>
> Norm
> ----- Original Message -----
> From: "smitty505000" <smitty505000@y...>
> To: <piclist@picl...>
> Sent: Sunday, October 09, 2005 8:59 PM
> Subject: [piclist] Re: Interfacing a PIC with Digital
Potentiometer?
> > Thanks Norm! That gives me some direction. I am having a hard
time
> > finding a digi pot with 5K and in a thru hole dip package. Are
the
> > higher values adjustable? In other words can I get a 50K Digi pot
> > with 256 steps and program it for 5K with 256 steps? Or am I
down to
> > like 25.6 steps at 5K?
> >
> > Thanks in advance guys!!
> >
> > Neil Smith
> >
> > --- In piclist@picl..., "Norm Carlberg" <normnet@h...>
wrote:
> > >
> > > Example code in Proton Plus
> > > very similar to PicBasicPro.
> > >
> > > Digipots are limited milliamps. May be used with opamps
however
> > for more
> > > amps.
> > >
> > > ' PROTON PLUS DIGITAL POT 10-9-05
> > > Symbol sCS1 = PORTB.1
> > > Symbol sSCK1 = PORTB.2
> > > Symbol sDATA1 = PORTB.3
> > >
> > > Symbol sCS2 = PORTB.4
> > > Symbol sSCK2 = PORTB.5
> > > Symbol sDATA2 = PORTB.6
> > >
> > > '********************************
> > >
> > > ' digipot MC41xxx MICROCHIP 5v max 1ma max
> > > ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vRAW1 = ",Dec
vRAW1,13]
> > > vPOTSET1.LowByte = vRAW1
> > > ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16
> > vPOTSET1,13]
> > > vPOTSET1.HighByte = %00010001
> > > ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vPOTSET1 = ",BIN16
> > vPOTSET1,13]
> > >
> > > Low sCS1
> > > SHOut sDATA1,sSCK1,msbfirst_l,[vPOTSET1\16] ' Shift out the 16-
bit
> > word
> > > High sCS1
> > >
> > > '********************************
> > > ' digipot AD7376 ANALOG DEVICES 30v max 5ma to 20ma max
> > >
> > > Low sCS2
> > > SHOut sDATA2,sSCK2,msbfirst_l,[vPOTSET2\8] ' Shift out the 8-
bit
> > byte
> > > High sCS2
> > >
> > > '********************************
> > >
> > > Norm
> > >
> > >
> > >
> > > ----- Original Message -----
> > > From: "smitty505000" <smitty505000@y...>
> > > To: <piclist@picl...>
> > > Sent: Sunday, October 09, 2005 7:08 PM
> > > Subject: [piclist] Re: Interfacing a PIC with Digital
> > Potentiometer?
> > >
> > >
> > > > I can use just about any pic I need to use. I will also be
> > > > programing in Pic Basic Pro. I am going to be using a couple
of
> > R/C
> > > > heading hold gyros that will be read by the Serin command
then
> > take
> > > > that data and apply it linearly to the 5K digital pot. I can
> > already
> > > > read the data from the gyro and get a number from 100-215. I
just
> > > > need to figure out what digital pot to get and how to send
it the
> > > > data. The pot will need to be updated in real time or as
close to
> > > > real time as possible. If you are wondering, I am making a
head
> > > > tracking device for live airbourn video in an R/C plane.
> > > >
> > > > Thanks!
> > > > Neil Smith
> > > >
> > > > --- In piclist@picl..., "rtstofer" <rstofer@p...>
> > wrote:
> > > > >
> > > > > --- In piclist@picl..., "smitty505000"
> > <smitty505000@y...>
> > > > > wrote:
> > > > > >
> > > > > > Hey all,
> > > > > >
> > > > > > I am working on another R/C project and need to be
able to
> > > > adjust
> > > > > a
> > > > > > 5K 3 wire pot via Pic. I have been looking at digital
pots
> > and
> > > > see
> > > > > > that they have 2 types I2C and SPI. What does this mean?
I
> > just
> > > > need
> > > > > > to be able to adjust the pot via a Pic from 0-5K with no
> > fancy
> > > > > extras.
> > > > > > Can someone help me?
> > > > > >
> > > > > > Thanks!
> > > > > > Neil Smith
> > > > > >
> > > > >
> > > > > If you want to talk to the potentiometer, you have to
speak the
> > > > > language. You didn't say which PIC and it matters because
some
> > > > have
> > > > > hardware implementations of I2C and/or SPI. However, if
you
> > > > aren't
> > > > > adjusting it very often, it is probably easier to bit-bang
SPI
> > > > than
> > > > > I2C.
> > > > >
> > > > > Unless you have a compelling reason to go with I2C, you
will
> > find
> > > > SPI
> > > > > easier to use. Even without the hardware help, you only
have
> > to
> > > > > wiggle two outputs (data and clock) to control the device.
> > Look
> > > > at
> > > > > the timing diagram for assistance.
> > > > >
> > > > > Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Re: Interfacing a PIC with Digital Potentiometer? - Peter Vincent - Oct 10 4:50:00 2005
hi,
sory i didnt mention it earlyer but Dallas/Maxim make
digital pots and you can order free samples online
http://www.maxim-ic.com/products.cfm
i think microchip do a digital pot also and you can get
free samples from them too
Pete
----- Original Message -----
From: smitty505000
To: p...@yahoogroups.com
Sent: Monday, October 10, 2005 4:42 AM
Subject: [piclist] Re: Interfacing a PIC with
Digital Potentiometer?
Norm,
Funny you should suggest the MCP42010, I just ordered a
couple and
from Jameco nevertheless! Never even thought of putting them in
parallel though, Thanks! Now I just have to find out how to hook
them up to the
pic and if I need any other components. I will be
removing qty 2, 5K 3 wire pots
from my RC transmitter and replace
them with this circuit. On my Head Mounted
Display will be two
heading lock gyro's that will read up/down and left/right. They
will
send data to the pic that will convert those and then send out to
the
digi pots. These two pots output to my radio and will then
control camera pan and
tilt on my plane. What do you think? Crazy
huh?
Neil Smith--- In
p...@yahoogroups.com, "Norm Carlberg" <normnet@h...> wrote:
>
> I
haven't seen any programmable for total resistance with same
number of
>
steps.
> Take a look at Digikey MCP42010-I/P-ND Dual 10k dip 256 steps.
> In parallel = 5k.
>
> Norm> ----- Original Message -----
> From: "smitty505000" <smitty505000@y...>
> To:
<p...@yahoogroups.com>
> Sent: Sunday, October 09, 2005 8:59 PM
>
Subject: [piclist] Re: Interfacing a PIC with Digital
Potentiometer?> > Thanks
Norm! That gives me some direction. I am having a hard
time
> > finding a
digi pot with 5K and in a thru hole dip package. Are
the
> > higher
values adjustable? In other words can I get a 50K Digi pot
> > with 256 steps
and program it for 5K with 256 steps? Or am I
down to
> > like 25.6 steps
at 5K?
> >
> > Thanks in advance guys!!
> >
>
> Neil Smith
> >
> > --- In p...@yahoogroups.com, "Norm Carlberg"
<normnet@h...>
wrote:
> > >
> > > Example code in
Proton Plus
> > > very similar to PicBasicPro.
> > >
>
> > Digipots are limited milliamps. May be used with opamps
however
> > for more
> > > amps.
> > >
> > > '
PROTON PLUS DIGITAL POT 10-9-05
> > > Symbol sCS1 = PORTB.1
> >
> Symbol sSCK1 = PORTB.2
> > > Symbol sDATA1 = PORTB.3
> >
>
> > > Symbol sCS2 = PORTB.4
> > > Symbol sSCK2 =
PORTB.5
> > > Symbol sDATA2 = PORTB.6
> > >
> >
> '********************************
> > >
> > > ' digipot
MC41xxx MICROCHIP 5v max 1ma max
> >
> ' SerOut sSEROUT_PIN,sBAUD,[Rep $00\8,"vRAW1 = ",Dec vRAW1,13]
> > >
vPOTSET1.LowByte = vRAW1
> > > ' SerOut sSEROUT_PIN,sBAUD,[Rep
$00\8,"vPOTSET1 = ",BIN16
> > vPOTSET1,13]
> > >
vPOTSET1.HighByte = %00010001
> > > ' SerOut sSEROUT_PIN,sBAUD,[Rep
$00\8,"vPOTSET1 = ",BIN16
> > vPOTSET1,13]
> > >
> >
> Low sCS1
> > > SHOut sDATA1,sSCK1,msbfirst_l,[vPOTSET1\16] ' Shift out
the 16-
bit
> > word
> > > High sCS1
> > >
> > > '********************************
> > > ' digipot AD7376
ANALOG DEVICES 30v max 5ma to 20ma max
> >
>
> > > Low sCS2
> > > SHOut
sDATA2,sSCK2,msbfirst_l,[vPOTSET2\8] ' Shift out the 8-
bit
> > byte
> > > High sCS2
> > >
> > >
'********************************
> > >
> > > Norm
>
> >
> > >
> > >
> > > ----- Original
Message -----
> > > From: "smitty505000" <smitty505000@y...>
>
> > To: <p...@yahoogroups.com>
> > > Sent: Sunday, October 09,
2005 7:08 PM
> > > Subject: [piclist] Re: Interfacing a PIC with Digital
> > Potentiometer?
> > >
> > >
> > >
> I can use just about any pic I need to use. I will also be
> > > >
programing in Pic Basic Pro. I am going to be using a couple
of
> >
R/C
> > > > heading hold gyros that will be read by the Serin command
then
> > take
> > > > that data and apply it linearly to the
5K digital pot. I can
> > already
> > > > read the data from
the gyro and get a number from 100-215. I
just
> > > > need to
figure out what digital pot to get and how to send
it the
> > > >
data. The pot will need to be updated in real time or as
close to
> >
> > real time as possible. If you are wondering, I am making a
head
>
> > > tracking device for live airbourn video in an R/C plane.
> >
> >
> > > > Thanks!
> > > > Neil Smith
>
> > >
> > > > --- In p...@yahoogroups.com,
"rtstofer" <rstofer@p...>
> > wrote:
> > > > >
> > > > > --- In p...@yahoogroups.com, "smitty505000"
> >
<smitty505000@y...>
> > > > > wrote:
> > > >
> >
> > > > > > Hey all,
> > > > >
>
> > > > > > I am working on another R/C
project and need to be
able to
> > > > adjust
> > >
> > a
> > > > > > 5K 3 wire pot via Pic. I have been looking
at digital
pots
> > and
> > > > see
> > >
> > > that they have 2 types I2C and SPI. What does this mean?
I
>
> just
> > > > need
> > > > > > to be able to
adjust the pot via a Pic from 0-5K with no
> > fancy
> > > >
> extras.
> > > > > > Can someone help me?
> > >
> > >
> > > > > > Thanks!
> > > > >
> Neil Smith
> > > > > >
> > > > >
>
> > > > If you want to talk to the potentiometer, you have to
speak
the
> > > > > language. You didn't say which PIC and it matters
because
some
> > > > have
> > > > > hardware
implementations of I2C and/or SPI. However, if
you
> > > >
aren't
> > > > > adjusting it very often, it is probably easier to
bit-bang
SPI
> > > > than
> > > > > I2C.
> > > > >
> > > > > Unless you have a compelling
reason to go with I2C, you
will
> > find
> > > > SPI
> > > > > easier to use. Even without the hardware help, you only
have
> > to
> > > > > wiggle two outputs (data and
clock) to control the device.
> > Look
> > > > at
>
> > > > the timing diagram for assistance.
> > > > >
> > > > > Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Re: Interfacing a PIC with Digital Potentiometer? - Peter Vincent - Oct 10 5:21:00 2005
Hi
me again just curious are you using the digi pot to
replace the servo pot to maintain a straight line?
how about use a pic like 16F877A that has 2 CCP ports
use one to intercept the pwm out from the reciver and use the other to send the adjusted
pwm signal to the servo that would be do'able in real time, you dont have to mod any
expencive hardware
Pete
----- Original Message -----
From: smitty505000
To: p...@yahoogroups.com
Sent: Monday, October 10, 2005 1:08 AM
Subject: [piclist] Re: Interfacing a PIC with
Digital Potentiometer?
I can use just about any pic I need to use. I will also be
programing in Pic Basic Pro. I am going to be using a couple of R/C
heading hold
gyros that will be read by the Serin command then take
that data and apply it
linearly to the 5K digital pot. I can already
read the data from the gyro and get a
number from 100-215. I just
need to figure out what digital pot to get and how to
send it the
data. The pot will need to be updated in real time or as close to
real time as possible. If you are wondering, I am making a head
tracking device
for live airbourn video in an R/C plane.
Thanks!
Neil Smith
--- In p...@yahoogroups.com, "rtstofer" <rstofer@p...> wrote:
>
> --- In p...@yahoogroups.com, "smitty505000" <smitty505000@y...>
>
wrote:
> >
> > Hey all,
> >
>
> I am working on another R/C project and need to be able to
adjust
> a
> > 5K 3 wire pot via Pic. I have been looking at
digital pots and
see
> > that they have 2 types I2C and SPI. What does
this mean? I just
need
> > to be able to adjust the pot via a Pic from
0-5K with no fancy
> extras.
> > Can someone help me?
> >
> > Thanks!
> > Neil Smith
> >
>
> If
you want to talk to the potentiometer, you have to speak the
> language.
You didn't say which PIC and it matters because some
have
> hardware
implementations of I2C and/or SPI. However, if you
aren't
> adjusting
it very often, it is probably easier to bit-bang SPI
than
> I2C.
>
> Unless you have a compelling reason to go with I2C, you will find
SPI
> easier to use. Even without the hardware help, you only have to
>
wiggle two outputs (data and clock) to control the device. Look
at
>
the timing diagram for assistance.
>
> Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - Chris - Oct 10 8:45:00 2005
--- In piclist@picl..., "smitty505000" <smitty505000@y...>
wrote:
>
> Norm,
On my Head Mounted Display will be two
> heading lock gyro's that will read up/down and left/right. They will
> send data to the pic that will convert those and then send out to
> the digi pots. These two pots output to my radio and will then
> control camera pan and tilt on my plane. What do you think? Crazy
> huh?
>
> Neil Smith
Sounds great, you might even be able to save using the pots at all if
you can find out the method of signal modulation following the a/d
conversion from the existing pot, and how it's fed to the rf modulator
side of things. You're using a pic already so it might be fun to try
and elliminate the need for digital pots completely !

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: Re: Interfacing a PIC with Digital Potentiometer? - Alan Marconett - Oct 10 13:03:00 2005
Hi Neil, Chris,
What Chris says is correct; you can generate a R/C servo control signal in
the PIC. They've been well documented. They use a varying pulse width.
Read through Chuck's site:
http://www.mcmanis.com/chuck/robotics/
Alan KM6VV
> Chris
> Sent: Monday, October 10, 2005 5:45 AM
> To: piclist@picl...
> Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
>
> wrote:
> >
> > Norm,
> On my Head Mounted Display will be two
> > heading lock gyro's that will read up/down and left/right. They will
> > send data to the pic that will convert those and then send out to
> > the digi pots. These two pots output to my radio and will then
> > control camera pan and tilt on my plane. What do you think? Crazy
> > huh?
> >
> > Neil Smith
>
> Sounds great, you might even be able to save using the pots at all if
> you can find out the method of signal modulation following the a/d
> conversion from the existing pot, and how it's fed to the rf modulator
> side of things. You're using a pic already so it might be fun to try
> and elliminate the need for digital pots completely !

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Re: Interfacing a PIC with Digital Potentiometer? - Malcolm - Oct 10 14:48:00 2005
To elaborate on Alan's posting, by sending a pulse that is between 1ms
and 2ms long every 20ms any servo can go from full throw in either
direction. Centre stick is represented by a 1.5ms pulse.
Malcolm
Alan Marconett wrote:
> Hi Neil, Chris,
>
> What Chris says is correct; you can generate a R/C servo control signal in
> the PIC. They've been well documented. They use a varying pulse width.
>
> Read through Chuck's site:
>
> http://www.mcmanis.com/chuck/robotics/
>
> Alan KM6VV
> > Chris
> > Sent: Monday, October 10, 2005 5:45 AM
> > To: piclist@picl...
> > Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
> >
> > wrote:
> > >
> > > Norm,
> > On my Head Mounted Display will be two
> > > heading lock gyro's that will read up/down and left/right. They will
> > > send data to the pic that will convert those and then send out to
> > > the digi pots. These two pots output to my radio and will then
> > > control camera pan and tilt on my plane. What do you think? Crazy
> > > huh?
> > >
> > > Neil Smith
> >
> > Sounds great, you might even be able to save using the pots at all if
> > you can find out the method of signal modulation following the a/d
> > conversion from the existing pot, and how it's fed to the rf modulator
> > side of things. You're using a pic already so it might be fun to try
> > and elliminate the need for digital pots completely !
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> ------------------------------------------------------------------------
> >.
> ------------------------------------------------------------------------

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - rtstofer - Oct 10 15:49:00 2005
I recently create a PIC program for driving 8 servos using timer
interrupts. It has 12.8 uS resolution although this could probably be
improved. You can find it here in the Files section as
ArrayOfInterruptDrivenServos.zip
Richard
-- In piclist@picl..., Malcolm <malcolm.crabbe@n...> wrote:
>
> To elaborate on Alan's posting, by sending a pulse that is between 1ms
> and 2ms long every 20ms any servo can go from full throw in either
> direction. Centre stick is represented by a 1.5ms pulse.
>
> Malcolm
>
> Alan Marconett wrote:
>
> > Hi Neil, Chris,
> >
> > What Chris says is correct; you can generate a R/C servo control
signal in
> > the PIC. They've been well documented. They use a varying pulse
width.
> >
> > Read through Chuck's site:
> >
> > http://www.mcmanis.com/chuck/robotics/
> >
> > Alan KM6VV
> >
> >
> > > Chris
> > > Sent: Monday, October 10, 2005 5:45 AM
> > > To: piclist@picl...
> > > Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
> > >
> > > wrote:
> > > >
> > > > Norm,
> > > On my Head Mounted Display will be two
> > > > heading lock gyro's that will read up/down and left/right.
They will
> > > > send data to the pic that will convert those and then send out to
> > > > the digi pots. These two pots output to my radio and will then
> > > > control camera pan and tilt on my plane. What do you think? Crazy
> > > > huh?
> > > >
> > > > Neil Smith
> > >
> > > Sounds great, you might even be able to save using the pots at
all if
> > > you can find out the method of signal modulation following the a/d
> > > conversion from the existing pot, and how it's fed to the rf
modulator
> > > side of things. You're using a pic already so it might be fun to try
> > > and elliminate the need for digital pots completely !
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
> > instructions
> >
> >
> >
------------------------------------------------------------------------
> > >.
> >
> >
> >
------------------------------------------------------------------------
>

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: Re: Interfacing a PIC with Digital Potentiometer? - Alan Marconett - Oct 10 16:49:00 2005
HI Richard,
Thanks for the contribution! I take it this code is for R/C type servos.
Now all it needs is an RS-232 interface (USB?), and a simple command
language.
Alan KM6VV
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of rtstofer
> Sent: Monday, October 10, 2005 12:49 PM
> To: piclist@picl...
> Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
>
> I recently create a PIC program for driving 8 servos using timer
> interrupts. It has 12.8 uS resolution although this could probably be
> improved. You can find it here in the Files section as
> ArrayOfInterruptDrivenServos.zip
>
> Richard
>
> -- In piclist@picl..., Malcolm <malcolm.crabbe@n...> wrote:
> >
> > To elaborate on Alan's posting, by sending a pulse that is between 1ms
> > and 2ms long every 20ms any servo can go from full throw in either
> > direction. Centre stick is represented by a 1.5ms pulse.
> >
> > Malcolm
> >
> > Alan Marconett wrote:
> >
> > > Hi Neil, Chris,
> > >
> > > What Chris says is correct; you can generate a R/C servo control
> signal in
> > > the PIC. They've been well documented. They use a varying pulse
> width.
> > >
> > > Read through Chuck's site:
> > >
> > > http://www.mcmanis.com/chuck/robotics/
> > >
> > > Alan KM6VV
> > >
> > >
> > > > Chris
> > > > Sent: Monday, October 10, 2005 5:45 AM
> > > > To: piclist@picl...
> > > > Subject: [piclist] Re: Interfacing a PIC with Digital
Potentiometer?
> > > >
> > > > wrote:
> > > > >
> > > > > Norm,
> > > > On my Head Mounted Display will be two
> > > > > heading lock gyro's that will read up/down and left/right.
> They will
> > > > > send data to the pic that will convert those and then send out
to
> > > > > the digi pots. These two pots output to my radio and will
then
> > > > > control camera pan and tilt on my plane. What do you think?
Crazy
> > > > > huh?
> > > > >
> > > > > Neil Smith
> > > >
> > > > Sounds great, you might even be able to save using the pots at
> all if
> > > > you can find out the method of signal modulation following the a/d
> > > > conversion from the existing pot, and how it's fed to the rf
> modulator
> > > > side of things. You're using a pic already so it might be fun to
try
> > > > and elliminate the need for digital pots completely !
> > >
> > >
> > >
> > >
> > > to unsubscribe, go to http://www.yahoogroups.com and follow the
> > > instructions
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > >.
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > >
>
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> Yahoo! Groups Links

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - rtstofer - Oct 10 18:52:00 2005
--- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
>
> HI Richard,
>
> Thanks for the contribution! I take it this code is for R/C type
servos.
>
> Now all it needs is an RS-232 interface (USB?), and a simple
command
> language.
>
> Alan KM6VV
Yes, R/C servos. However, it isn't very granular and there are only
about 100 steps between 0 and 180 degrees - see the code listing.
What probably needs to happen is to move the pulse on time to Timer
1 because it is 16 bits. Then Timer 0 could generate the 20 mS
timing interval. That isn't easy because Timer 0 is only 8 bits.
If you use a PIC with 2 16 bit counters life is good!
Nevertheless, it will get you started.
Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Alan Marconett - Oct 10 18:58:00 2005
HI Richard,
Yes, I see that now. Timer 0 could still run at a faster rate, say 1 mS,
and then only "act" every 20 mS. I'll have to give all that a try.
Alan KM6VV
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of rtstofer
> Sent: Monday, October 10, 2005 3:53 PM
> To: piclist@picl...
> Subject: [piclist] Re: Interfacing a PIC with Digital Potentiometer?
>
> --- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
> >
> > HI Richard,
> >
> > Thanks for the contribution! I take it this code is for R/C type
> servos.
> >
> > Now all it needs is an RS-232 interface (USB?), and a simple
> command
> > language.
> >
> > Alan KM6VV
>
> Yes, R/C servos. However, it isn't very granular and there are only
> about 100 steps between 0 and 180 degrees - see the code listing.
>
> What probably needs to happen is to move the pulse on time to Timer
> 1 because it is 16 bits. Then Timer 0 could generate the 20 mS
> timing interval. That isn't easy because Timer 0 is only 8 bits.
>
> If you use a PIC with 2 16 bit counters life is good!
>
> Nevertheless, it will get you started.
>
> Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - rtstofer - Oct 10 19:52:00 2005
--- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
>
> HI Richard,
>
> Yes, I see that now. Timer 0 could still run at a faster rate,
say 1 mS,
> and then only "act" every 20 mS. I'll have to give all that a
try.
These's always a yes but.... If you are using a 20 MHz crystal then
you start with 5 MHz and divide that by 256 (prescaler) and you are
clocking at 19.531 KHz. The timer will overflow in 13 mS. So, you
have to let it overflow twice and keep track to get to 20 mS.
Should work. Maybe I'll give it a try.
Richard
> Alan KM6VV
>
> > -----Original Message-----
> > From: piclist@picl... [mailto:piclist@picl...]
On Behalf
> > Of rtstofer
> > Sent: Monday, October 10, 2005 3:53 PM
> > To: piclist@picl...
> > Subject: [piclist] Re: Interfacing a PIC with Digital
Potentiometer?
> >
> > --- In piclist@picl..., "Alan Marconett" <KM6VV@a...>
wrote:
> > >
> > > HI Richard,
> > >
> > > Thanks for the contribution! I take it this code is for R/C
type
> > servos.
> > >
> > > Now all it needs is an RS-232 interface (USB?), and a simple
> > command
> > > language.
> > >
> > > Alan KM6VV
> >
> > Yes, R/C servos. However, it isn't very granular and there are
only
> > about 100 steps between 0 and 180 degrees - see the code listing.
> >
> > What probably needs to happen is to move the pulse on time to
Timer
> > 1 because it is 16 bits. Then Timer 0 could generate the 20 mS
> > timing interval. That isn't easy because Timer 0 is only 8 bits.
> >
> > If you use a PIC with 2 16 bit counters life is good!
> >
> > Nevertheless, it will get you started.
> >
> > Richard
>

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - KM6VV - Oct 10 21:07:00 2005
Hi Richard,
I'm using '877 PICs, with either a 4 Mhz resonator, or a 10 Mhz Xtal.
With a 10 Mhz Xtal I prescale 16, and use a counter reload value of -37 (that's
what the PIC .AS file says, I let the compiler figure it out) or 219, I get a
nice 250 uS INT rate. This works fine for multiplexing 4 LED 7 segment
displays. I then count interrupts to generate a 1/10 sec. "systems tick". I
check for a key detected (keys muxed with LED segment drive lines), and set task
flags depending on what keys were detected. I also call other tasks at this
1/10 sec rate, if they are an active task. All this gives me a nice multi-task
base to work from.
What I'd like to do (on an 18F4620 PIC) is run up to 4 stepper motors. The PIC
would have to ramp up/down, and generate a pre-calculated number of steps in
each axis. I currently (on my PC) watch the time until it's time to generate a
step, and then calculate the next step time. This method doesn't fit in too
well with the above kernel! I could just throw out the above kernel, and
simulate the 8254 of the PC, and "build" my 40-bit clock, running at a similar
5
Mhz rate. I haven't decided yet.
Alan KM6VV
rtstofer wrote:
> --- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
>
>>HI Richard,
>>
>>Yes, I see that now. Timer 0 could still run at a faster rate,
>
> say 1 mS,
>
>>and then only "act" every 20 mS. I'll have to give all that a
>
> try.
>
> These's always a yes but.... If you are using a 20 MHz crystal then
> you start with 5 MHz and divide that by 256 (prescaler) and you are
> clocking at 19.531 KHz. The timer will overflow in 13 mS. So, you
> have to let it overflow twice and keep track to get to 20 mS.
>
> Should work. Maybe I'll give it a try.
>
> Richard
>>Alan KM6VV
>>
>>
>>>-----Original Message-----
>>>From: piclist@picl... [mailto:piclist@picl...]
>
> On Behalf
>
>>>Of rtstofer
>>>Sent: Monday, October 10, 2005 3:53 PM
>>>To: piclist@picl...
>>>Subject: [piclist] Re: Interfacing a PIC with Digital
>
> Potentiometer?
>
>>>--- In piclist@picl..., "Alan Marconett" <KM6VV@a...>
>
> wrote:
>
>>>>HI Richard,
>>>>
>>>>Thanks for the contribution! I take it this code is for R/C
>
> type
>
>>>servos.
>>>
>>>>Now all it needs is an RS-232 interface (USB?), and a simple
>>>
>>>command
>>>
>>>>language.
>>>>
>>>>Alan KM6VV
>>>
>>>Yes, R/C servos. However, it isn't very granular and there are
>
> only
>
>>>about 100 steps between 0 and 180 degrees - see the code listing.
>>>
>>>What probably needs to happen is to move the pulse on time to
>
> Timer
>
>>>1 because it is 16 bits. Then Timer 0 could generate the 20 mS
>>>timing interval. That isn't easy because Timer 0 is only 8 bits.
>>>
>>>If you use a PIC with 2 16 bit counters life is good!
>>>
>>>Nevertheless, it will get you started.
>>>
>>>Richard
>>>
>
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
> Yahoo! Groups Links

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - rtstofer - Oct 11 0:15:00 2005
I did a similar task switcher a while back - mostly because it
cleaned up the code. Tasks are just neater - simple, stand alone
functions with limited interaction.
My time base was 1 mS so I switched a lot and each task had to be
guaranteed to be complete in 1 mS because this was not a preemptive
scheduler. But, 1 mS is a long time when you grind out 5,000,000
instructions (albeit simple ones) per second. You can execute about
5000 instructions in a time slice and that is a lot.
It worked quite well but there was the drawback of the fixed time
slice. Even when a task completed early, another task was not
dispatched. That would be a simple upgrade...
Richard
--- In piclist@picl..., KM6VV <KM6VV@a...> wrote:
>
> Hi Richard,
>
> I'm using '877 PICs, with either a 4 Mhz resonator, or a 10 Mhz
Xtal.
>
> With a 10 Mhz Xtal I prescale 16, and use a counter reload value
of -37 (that's
> what the PIC .AS file says, I let the compiler figure it out) or
219, I get a
> nice 250 uS INT rate. This works fine for multiplexing 4 LED 7
segment
> displays. I then count interrupts to generate a 1/10
sec. "systems tick". I
> check for a key detected (keys muxed with LED segment drive
lines), and set task
> flags depending on what keys were detected. I also call other
tasks at this
> 1/10 sec rate, if they are an active task. All this gives me a
nice multi-task
> base to work from.
>
> What I'd like to do (on an 18F4620 PIC) is run up to 4 stepper
motors. The PIC
> would have to ramp up/down, and generate a pre-calculated number
of steps in
> each axis. I currently (on my PC) watch the time until it's time
to generate a
> step, and then calculate the next step time. This method doesn't
fit in too
> well with the above kernel! I could just throw out the above
kernel, and
> simulate the 8254 of the PC, and "build" my 40-bit clock, running
at a similar 5
> Mhz rate. I haven't decided yet.
>
> Alan KM6VV
>
> rtstofer wrote:
> > --- In piclist@picl..., "Alan Marconett" <KM6VV@a...>
wrote:
> >
> >>HI Richard,
> >>
> >>Yes, I see that now. Timer 0 could still run at a faster rate,
> >
> > say 1 mS,
> >
> >>and then only "act" every 20 mS. I'll have to give all that a
> >
> > try.
> >
> > These's always a yes but.... If you are using a 20 MHz crystal
then
> > you start with 5 MHz and divide that by 256 (prescaler) and you
are
> > clocking at 19.531 KHz. The timer will overflow in 13 mS. So,
you
> > have to let it overflow twice and keep track to get to 20 mS.
> >
> > Should work. Maybe I'll give it a try.
> >
> > Richard
> >
> >
> >>Alan KM6VV
> >>
> >>
> >>>-----Original Message-----
> >>>From: piclist@picl... [mailto:piclist@picl...]
> >
> > On Behalf
> >
> >>>Of rtstofer
> >>>Sent: Monday, October 10, 2005 3:53 PM
> >>>To: piclist@picl...
> >>>Subject: [piclist] Re: Interfacing a PIC with Digital
> >
> > Potentiometer?
> >
> >>>--- In piclist@picl..., "Alan Marconett" <KM6VV@a...>
> >
> > wrote:
> >
> >>>>HI Richard,
> >>>>
> >>>>Thanks for the contribution! I take it this code is for R/C
> >
> > type
> >
> >>>servos.
> >>>
> >>>>Now all it needs is an RS-232 interface (USB?), and a simple
> >>>
> >>>command
> >>>
> >>>>language.
> >>>>
> >>>>Alan KM6VV
> >>>
> >>>Yes, R/C servos. However, it isn't very granular and there are
> >
> > only
> >
> >>>about 100 steps between 0 and 180 degrees - see the code
listing.
> >>>
> >>>What probably needs to happen is to move the pulse on time to
> >
> > Timer
> >
> >>>1 because it is 16 bits. Then Timer 0 could generate the 20 mS
> >>>timing interval. That isn't easy because Timer 0 is only 8
bits.
> >>>
> >>>If you use a PIC with 2 16 bit counters life is good!
> >>>
> >>>Nevertheless, it will get you started.
> >>>
> >>>Richard
> >>>
> >>
> >
> >
> >
> >
> >
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
>

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Alan Marconett - Oct 11 11:17:00 2005
Hi Richard,
I've been examining my companies' PIC products, and we use these task
switchers quite a bit. I can see the utility, one product has 50 "mini
tasks" that take turns running off the main system tick. A/D reads on
multiple channels, trigger input reads, start/stop/monitoring of several
small pumps, display update tasks, etc.
There are drawbacks, but it still makes a simpler system then a fully
pre-emptive one.
I'm not sure how my stepper drivers will fare under a task switcher, 'tho.
Alan KM6VV
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of rtstofer
> Sent: Monday, October 10, 2005 9:16 PM
> To: piclist@picl...
> Subject: [piclist] R/C servos on PIC. WAS Re: Interfacing a PIC with
> Digital Potentiometer?
> I did a similar task switcher a while back - mostly because it
> cleaned up the code. Tasks are just neater - simple, stand alone
> functions with limited interaction.
>
> My time base was 1 mS so I switched a lot and each task had to be
> guaranteed to be complete in 1 mS because this was not a preemptive
> scheduler. But, 1 mS is a long time when you grind out 5,000,000
> instructions (albeit simple ones) per second. You can execute about
> 5000 instructions in a time slice and that is a lot.
>
> It worked quite well but there was the drawback of the fixed time
> slice. Even when a task completed early, another task was not
> dispatched. That would be a simple upgrade...
>
> Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - rtstofer - Oct 11 13:08:00 2005
Yes, the switcher makes the code much more clear. But, as you said,
there are drawbacks...
I would make the stepper driver code fully interrupt driven,
independent of the task switcher. Once commanded to make a certain
number of steps, that operation would run in the background. Even
with multiple steppers, the trick will be to give them higher priority
than the task switcher.
The problem, as I see it, is that most microcontrollers don't allow
you to assign the interrupt priority and many won't allow interrupts
to be nested.
The Atmel ATmega128 allows nested interrupts but the priorities are
fixed. This might be ok, it is a matter of capitalizing on the way
they are defined. And the chip moves right along at 16 MIPS.
Moving up, the Philips LPC2106 ARM-7 has a fully programmable
interrupt controller so priorities can be dynamically assigned. And,
it screams at about 60 MIPS! The LPC2136 has an added A/D converter.
FreeRTOS (a free, real time OS) runs on the LPC2106 - I haven't
checked it on the LPC2136 but it probably works. There is a fairly
steep learning curve to getting started but it all plays nicely.
Development boards for these devices are available at www.sparkfun.com
Richard

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Chris - Oct 11 13:44:00 2005
--- In piclist@picl..., "rtstofer" <rstofer@p...> wrote:
>
> Yes, the switcher makes the code much more clear. But, as you
said,
> there are drawbacks...
>
> I would make the stepper driver code fully interrupt driven,
> independent of the task switcher.
> The Atmel ATmega128 allows nested interrupts but the priorities are
> fixed.
I've just finished my first 18f252 project and notice that there are
two levels of priority.
#Wether or not these priorities are assigned to any relevant hardware
to your project it's hard to say, but it may be possible to trigger
one interupt from another somewhow to work around this if it's an
issue.
For the stepper drivers I think it was the l297 I used once, which
took speed and direction inputs. The inputs came from the pics pwm
output plus one other pin for direction. I turned off the pwm module
to keep the motor stationary and turned it on when needed. I didn't
go to the logical conclusion of making the speed variable by changing
the pwm frequency but then again it wasn't needed.
That said, I think I'm the same as most other folks here and
generally prefer to do as much as possible in terms of control on the
pic itself.
What I decided was that I would need an h-bridge to drive the stepper
anyway, that using an h-bridge/stepper driver (l293) with logic
(l297) wasn't cheating too much.
ChrisB

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: R/C servos on PIC. - Alan Marconett - Oct 11 15:56:00 2005
Hi Richard,
Sounds like the steppers really don't need a task switcher much. I would
need to service either RS-232 or USB, but they could be interrupt driven as
well. I will have to "ramp up" (and down) to the desired feed rates. This
can go in the background. As well as buffering up commands, and watching
limit and E-switches.
As you say, the priorities are the problem. I think there are two levels of
priority for the 18F4620, (or 18F4550 USB?), so that might help. And of
course, there are bits to check to decide what to do in the ISR.
I'm thinking then I need to have a TOD clock running (much like for DOS and
its 8254) and be able to compare the lower end of the counter (CCP) for the
time of the next step to be generated. The prescaler could be used on
timer1, and the compare would generate the interrupt.
Sounds like a 40Mhz clock / 8 would give me a 5 Mhz step clock, and a 16 bit
Timer1 would allow 60+ seconds between steps, if needed. Although that
would allow step time errors to accumulate because of the shorter (16 bit)
counter. A long counter of say 40 bits could keep track of the "time" all
day long. Basically what I do on a PC (under DOS).
I'd maintain a list of the step counts to watch for, and watch for the
earliest one needed. The counter (Timer1) would continue to run and
rollover. Rollover is not hard to handle.
I guess one could maintain the remainder of a long counter in memory. That
would do it! If the CCP matched, the remainder of the long counter could
then be compared to verify the complete time (since reset).
The other chips are interesting... but I just got the MicroChip PICDEM FS
USB board! RB0-7 (and a lot of other stuff) are on a pad for a header, so I
can add a little board with the ULN2003 driver chips. These will then drive
four Gecko G210 stepper modules.
Food for thought! Thanks for the comments!
Alan KM6VV
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of rtstofer
> Sent: Tuesday, October 11, 2005 10:09 AM
> To: piclist@picl...
> Subject: [piclist] R/C servos on PIC. WAS Re: Interfacing a PIC with
> Digital Potentiometer?
>
> Yes, the switcher makes the code much more clear. But, as you said,
> there are drawbacks...
>
> I would make the stepper driver code fully interrupt driven,
> independent of the task switcher. Once commanded to make a certain
> number of steps, that operation would run in the background. Even
> with multiple steppers, the trick will be to give them higher priority
> than the task switcher.
>
> The problem, as I see it, is that most microcontrollers don't allow
> you to assign the interrupt priority and many won't allow interrupts
> to be nested.
>
> The Atmel ATmega128 allows nested interrupts but the priorities are
> fixed. This might be ok, it is a matter of capitalizing on the way
> they are defined. And the chip moves right along at 16 MIPS.
>
> Moving up, the Philips LPC2106 ARM-7 has a fully programmable
> interrupt controller so priorities can be dynamically assigned. And,
> it screams at about 60 MIPS! The LPC2136 has an added A/D converter.
> FreeRTOS (a free, real time OS) runs on the LPC2106 - I haven't
> checked it on the LPC2136 but it probably works. There is a fairly
> steep learning curve to getting started but it all plays nicely.
>
> Development boards for these devices are available at www.sparkfun.com
>
> Richard
>
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions
> Yahoo! Groups Links

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Alan Marconett - Oct 11 16:31:00 2005
Hi Chris,
That's true, there is PWM. I DO need to be changing the step rates. For
CNC (my intended use), we need to accelerate/decelerate, otherwise steps are
lost (bad thing). I don't know if I want to be changing the PWM rate all
the time; and I need 4 steppers. The motion (endpoints of moves) must be
coordinated so that arcs and angled paths can be followed. One winds up
having to generate from one to four streams of steps, at different rates.
And for arcs, the rates are CONSTANTLY changing!
My current working CNC controller software is running on a PC under DOS (no
nasty OS grabbing CPU cycles at the worst time, stepper motors HATE that!).
The Gcode (RS-274U) interpretation, step count calculations and all the
other stuff would continue to be done on a PC; however now windoz or LINUX
could be used as an OS.
I've played with the L293/L297, but for this, I want G210 Geckos! The idea
is to build a "black box" step (and direction) generator for 4 axis, and
drive Geckos.
In other projects, like steppers on a small robot, one might want to do it
all (as much as possible, anyway) in the PIC. So the L293 gets replaced,
leaving the high current (and chopper) up to the L297.
Alan KM6VV
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of Chris
> Sent: Tuesday, October 11, 2005 10:44 AM
> To: piclist@picl...
> Subject: [piclist] R/C servos on PIC. WAS Re: Interfacing a PIC with
> Digital Potentiometer?
>
> --- In piclist@picl..., "rtstofer" <rstofer@p...> wrote:
> >
> > Yes, the switcher makes the code much more clear. But, as you
> said,
> > there are drawbacks...
> >
> > I would make the stepper driver code fully interrupt driven,
> > independent of the task switcher.
> > The Atmel ATmega128 allows nested interrupts but the priorities are
> > fixed.
>
> I've just finished my first 18f252 project and notice that there are
> two levels of priority.
> #Wether or not these priorities are assigned to any relevant hardware
> to your project it's hard to say, but it may be possible to trigger
> one interupt from another somewhow to work around this if it's an
> issue.
>
> For the stepper drivers I think it was the l297 I used once, which
> took speed and direction inputs. The inputs came from the pics pwm
> output plus one other pin for direction. I turned off the pwm module
> to keep the motor stationary and turned it on when needed. I didn't
> go to the logical conclusion of making the speed variable by changing
> the pwm frequency but then again it wasn't needed.
>
> That said, I think I'm the same as most other folks here and
> generally prefer to do as much as possible in terms of control on the
> pic itself.
>
> What I decided was that I would need an h-bridge to drive the stepper
> anyway, that using an h-bridge/stepper driver (l293) with logic
> (l297) wasn't cheating too much.
>
> ChrisB

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Chris - Oct 11 17:47:00 2005
--- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
>
> Hi Chris,
>
> That's true, there is PWM. I DO need to be changing the step
rates. For
> CNC (my intended use), we need to accelerate/decelerate, otherwise
steps are
> lost (bad thing). I don't know if I want to be changing the PWM
rate all
> the time; and I need 4 steppers. The motion (endpoints of moves)
must be
> coordinated so that arcs and angled paths can be followed. One
winds up
> having to generate from one to four streams of steps, at different
rates.
> And for arcs, the rates are CONSTANTLY changing!
>
> My current working CNC controller software is running on a PC under
DOS (no
> nasty OS grabbing CPU cycles at the worst time, stepper motors HATE
that!).
>
> The Gcode (RS-274U) interpretation, step count calculations and all
the
> other stuff would continue to be done on a PC; however now windoz
or LINUX
> could be used as an OS.
Thats all good, by the sounds of it at least, Alan !
Are you a member of any Yahoo CNC groups too. Would you mind keeping
me in mind as someone else who has a desire to build a CNC machine
and is slowly collecting all the necessary parts.
I thought I might use an old PC with the outputs contaisisting of
step and direction pulses coming from the parallel port...are you
saying it's possible to lose pulses doing this or do you still
consider it to have integrity ?
Best personal regards,
Chris
GM4UCD

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
RE: R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Alan Marconett - Oct 11 19:14:00 2005
Hi Chris,
There are the Sherline, SherlineCNC and CAD_CAM_EDM_DRO lists, all on Yahoo,
plus other lists as well.
An old PC works fine, just stick to DOS. And turn off other stuff such as
memory management, etc. We're doing just fine on old PCs!
Best 73's as well to you!
Alan KM6VV
> -----Original Message-----
> From: piclist@picl... [mailto:piclist@picl...] On Behalf
> Of Chris
> Sent: Tuesday, October 11, 2005 2:47 PM
> To: piclist@picl...
> Subject: [piclist] R/C servos on PIC. WAS Re: Interfacing a PIC with
> Digital Potentiometer?
>
> --- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
> >
> > Hi Chris,
> >
> > That's true, there is PWM. I DO need to be changing the step
> rates. For
> > CNC (my intended use), we need to accelerate/decelerate, otherwise
> steps are
> > lost (bad thing). I don't know if I want to be changing the PWM
> rate all
> > the time; and I need 4 steppers. The motion (endpoints of moves)
> must be
> > coordinated so that arcs and angled paths can be followed. One
> winds up
> > having to generate from one to four streams of steps, at different
> rates.
> > And for arcs, the rates are CONSTANTLY changing!
> >
> > My current working CNC controller software is running on a PC under
> DOS (no
> > nasty OS grabbing CPU cycles at the worst time, stepper motors HATE
> that!).
> >
> > The Gcode (RS-274U) interpretation, step count calculations and all
> the
> > other stuff would continue to be done on a PC; however now windoz
> or LINUX
> > could be used as an OS.
>
> Thats all good, by the sounds of it at least, Alan !
>
> Are you a member of any Yahoo CNC groups too. Would you mind keeping
> me in mind as someone else who has a desire to build a CNC machine
> and is slowly collecting all the necessary parts.
>
> I thought I might use an old PC with the outputs contaisisting of
> step and direction pulses coming from the parallel port...are you
> saying it's possible to lose pulses doing this or do you still
> consider it to have integrity ?
>
> Best personal regards,
> Chris
> GM4UCD

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
R/C servos on PIC. WAS Re: Interfacing a PIC with Digital Potentiometer? - Chris - Oct 13 16:03:00 2005
--- In piclist@picl..., "Alan Marconett" <KM6VV@a...> wrote:
>
> Hi Chris,
>
> There are the Sherline, SherlineCNC and CAD_CAM_EDM_DRO lists, all
on Yahoo,
> plus other lists as well.
>
> An old PC works fine, just stick to DOS. And turn off other stuff
such as
> memory management, etc. We're doing just fine on old PCs!
>
> Best 73's as well to you!
>
> Alan KM6VV
good to hear, thanks
I'm already on CAD_CAM_EDM so i'll get plugged back into it. I can't
tear myself away from the appeal of being able to machine your own
pcb's and cases !

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )
Re: Interfacing a PIC with Digital Potentiometer? - Jovan Kostovski - Oct 21 9:59:00 2005
Hi,
>I have been looking at digital pots and see
>that they have 2 types I2C and SPI. What does this mean?
Those are the names of the communication protocols that are used
for comunicating with the devices.
They don't offer any fancy features ;)
Cheers, Jovan

(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )