Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

A/D to PWM

A/D to PWM

2004-06-22 by p_anglum

I'm using a Tiny 15 to convert a 0-10 volt input to PWM output.
I use a voltage divider (10K - 10K) to scale the 0-10 down to 0-5 
before applying it to PB3(ADC3).

Everything seems to work except at the lowest range of input voltage 
the A/D seems to always read some small voltage.  In fact, with my 0-
10V input removed and only the voltage divider on the input to to 
ADC3 I read about .9 volts on ADC3.  It appears the source of the 
voltage is the ADC3 pin itself.  Any ideas?
(All voltage measurements were made in refernce to pin4 - GND on the 
Tiny15)

Re: A/D to PWM

2004-06-22 by p_anglum

--- In AVR-Chat@yahoogroups.com, David VanHorn <dvanhorn@c...> wrote:
> At 06:57 PM 6/22/2004 +0000, p_anglum wrote:
> 
> >I'm using a Tiny 15 to convert a 0-10 volt input to PWM output.
> >I use a voltage divider (10K - 10K) to scale the 0-10 down to 0-5 
> >before applying it to PB3(ADC3).
> >
> >Everything seems to work except at the lowest range of input 
voltage 
> >the A/D seems to always read some small voltage.  In fact, with my 
0-
> >10V input removed and only the voltage divider on the input to to 
> >ADC3 I read about .9 volts on ADC3.  It appears the source of the 
> >voltage is the ADC3 pin itself.  Any ideas?
> >(All voltage measurements were made in refernce to pin4 - GND on 
the 
> >Tiny15)
> 
> You may have too high an input impedance. 
> Also, what's your reference voltage? On the Tiny-26's, the 
2.5V "precision" reference comes out at 2.7V.

I meant to say I'm using the Vcc (5V) as my reference.  It works 
great at the high end.  At 10 volts (5 volts after the voltage 
divider) the output goes to 100%.  But on the low end I can't get it 
below approx 20% - which makes sense since the input is a almost 1 
volt (.9V).  Also, if I ground  ADC3 to pin 4 the output duty cycle 
does go to 0%.  I'm also reading only the 8 MSB.

Re: A/D to PWM

2004-06-22 by p_anglum

Of course I turned off the pull-up resistor.  OK, let me check one 
more time.  Wait a minute.... PB4 is the 5th bit not the fourth.
@#$%#&%&!  Hey, now it works.
Funny how being just onnnnnnne bit off makes a difference.

Thanks Brian,


Pat

--- In AVR-Chat@yahoogroups.com, "Brian Fairchild" <b.fairchild@d...> 
wrote:
> Although you have configured the pin as an input, have you turned 
off
> the pull-up resistor?
>  
>  
> -----Original Message-----
> From: p_anglum [mailto:p_anglum@h...] 
> Sent: 22 June 2004 19:57
> To: AVR-Chat@yahoogroups.com
> Subject: [AVR-Chat] A/D to PWM
> 
> 
> I'm using a Tiny 15 to convert a 0-10 volt input to PWM output.
> I use a voltage divider (10K - 10K) to scale the 0-10 down to 0-5 
> before applying it to PB3(ADC3).
> 
> Everything seems to work except at the lowest range of input 
voltage 
> the A/D seems to always read some small voltage.  In fact, with my 
0-
> 10V input removed and only the voltage divider on the input to to 
> ADC3 I read about .9 volts on ADC3.  It appears the source of the 
> voltage is the ADC3 pin itself.  Any ideas?
> (All voltage measurements were made in refernce to pin4 - GND on 
the 
> Tiny15)
> 
> 
> 
> Yahoo! Groups Sponsor	
> 
> ADVERTISEMENT
>  
> 
<http://us.ard.yahoo.com/SIG=1295l07cu/M=295196.4901138.6071305.300117
6/
> 
D=groups/S=1706554205:HM/EXP=1088017048/A=2128215/R=0/SIG=10se96mf6/*h
tt
> p://companion.yahoo.com> click here	
>  
> <http://us.adserver.yahoo.com/l?
M=295196.4901138.6071305.3001176/D=group
Show quoted textHide quoted text
> s/S=:HM/A=2128215/rand=901415906> 	
> 
>   _____  
> 
> Yahoo! Groups Links
> 
> 
> *	To visit your group on the web, go to:
> http://groups.yahoo.com/group/AVR-Chat/
>   
> 
> *	To unsubscribe from this group, send an email to:
> AVR-Chat-unsubscribe@yahoogroups.com
> <mailto:AVR-Chat-unsubscribe@yahoogroups.com?subject=Unsubscribe> 
>   
> 
> *	Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .

Re: [AVR-Chat] A/D to PWM

2004-06-22 by David VanHorn

At 06:57 PM 6/22/2004 +0000, p_anglum wrote:

>I'm using a Tiny 15 to convert a 0-10 volt input to PWM output.
>I use a voltage divider (10K - 10K) to scale the 0-10 down to 0-5 
>before applying it to PB3(ADC3).
>
>Everything seems to work except at the lowest range of input voltage 
>the A/D seems to always read some small voltage.  In fact, with my 0-
>10V input removed and only the voltage divider on the input to to 
>ADC3 I read about .9 volts on ADC3.  It appears the source of the 
>voltage is the ADC3 pin itself.  Any ideas?
>(All voltage measurements were made in refernce to pin4 - GND on the 
>Tiny15)

You may have too high an input impedance. 
Also, what's your reference voltage? On the Tiny-26's, the 2.5V "precision" reference comes out at 2.7V.

Re: [AVR-Chat] A/D to PWM

2004-06-22 by James Wagner

Inaccuracy in the reference should have very little
effect on measurments near ground. 

But, yes, the source impedance may be too high. Try this
experiment:

1. Make a measurment with the top of the divider (the end
normally connected to 10V) grounded. This will make the
divider resistance as seen by the ADC input 5K. Note the
reading.

2. Make a measurement with the top of the divider not
connected to anything. Make sure that there are no nearby
signals (processor clocks, PWM, etc) that can be coupled in
to upset things. This will make the divider resistance seen
by the ADC input 10K. Note the reading.

3. If the second reading is significantly greater than the
first, its an impedance (resistance) issue. If this is the
case and you really need the higher resistance, try adding
a cap across the bottom resistor. This may help because the
current flows only during the sample time. I would try a
0.01uf cap.

Jim


On Tue, 22 Jun 2004 14:34:45 -0500
 David VanHorn <dvanhorn@cedar.net> wrote:
> 
> 
> 
> 
> At 06:57 PM 6/22/2004 +0000, p_anglum wrote:
> 
> >I'm using a Tiny 15 to convert a 0-10 volt input to
> PWM output.
> >I use a voltage divider (10K - 10K) to scale the 0-10
> down to 0-5 
> >before applying it to PB3(ADC3).
> >
> >Everything seems to work except at the lowest range
> of input voltage 
> >the A/D seems to always read some small
> voltage.  In fact, with my 0-
> >10V input removed and only the voltage divider on the
> input to to 
> >ADC3 I read about .9 volts on ADC3.  It appears
> the source of the 
> >voltage is the ADC3 pin itself.  Any ideas?
> >(All voltage measurements were made in refernce to
> pin4 - GND on the 
> >Tiny15)
> 
> You may have too high an input impedance. 
> Also, what's your reference voltage? On the Tiny-26's,
> the 2.5V "precision" reference comes out at
> 2.7V. 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Sponsor
> 
> 
>   ADVERTISEMENT 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Yahoo! Groups Links
> 
> To visit your group on the web, go
> to:http://groups.yahoo.com/group/AVR-Chat/ 
> To unsubscribe from this group, send an email
> to:AVR-Chat-unsubscribe@yahoogroups.com 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms
> of Service.
> 
> 
> 
> 
> 
> 
> 
> 
> 

Preview Mac OS X "Tiger" v10.4 at WWDC 2004.
http://developer.apple.com/wwdc/applelinks.html
---------------------------------------------------------------
---------------------------------------------------------------
The Think Different Store
http://www.thinkdifferentstore.com/
For All Your Mac Gear
---------------------------------------------------------------
---------------------------------------------------------------

RE: [AVR-Chat] A/D to PWM

2004-06-22 by Brian Fairchild

Although you have configured the pin as an input, have you turned off the pull-up resistor?
-----Original Message-----
From: p_anglum [mailto:p_anglum@hotmail.com]
Sent: 22 June 2004 19:57
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] A/D to PWM

I'm using a Tiny 15 to convert a 0-10 volt input to PWM output.
I use a voltage divider (10K - 10K) to scale the 0-10 down to 0-5
before applying it to PB3(ADC3).

Everything seems to work except at the lowest range of input voltage
the A/D seems to always read some small voltage. In fact, with my 0-
10V input removed and only the voltage divider on the input to to
ADC3 I read about .9 volts on ADC3. It appears the source of the
voltage is the ADC3 pin itself. Any ideas?
(All voltage measurements were made in refernce to pin4 - GND on the
Tiny15)


Re: [AVR-Chat] Re: A/D to PWM

2004-06-23 by David VanHorn

At 08:26 PM 6/22/2004 +0000, p_anglum wrote:

>Of course I turned off the pull-up resistor.  OK, let me check one 
>more time.  Wait a minute.... PB4 is the 5th bit not the fourth.
>@#$%#&%&!  Hey, now it works.
>Funny how being just onnnnnnne bit off makes a difference.


You'd think that would be automatic, wouldn't you? 
:)

TFT Display and SED1374 interfacing

2004-06-23 by Arif YILMAZ

Hello,
I am going to use a TFT display with SED1374 ( S1D13704)
can anyone help to how to connect SED1374 to a color TFT display, TFTs  have
analog or digital rgb interfaces  and SED1374 has digital RGB output,
however TFT displays have  afew more inputs like VSYNC, HSYNC etc.

and do you know any TFT displays that already contains this or similar
controller?

interfacing to micro seems easy however to TFT is not to me, I dont know
which TFT display to choose, there are a lot but which is compatible with
SEDXXXX is the question...

also is there any good tutorials that you know  about RGB or video?

thanks for your help in advance,

4 Serial Ports

2004-06-29 by Paul Maddox

Dear all,

anyone have any idea how I can add an extra two serial ports to a Mega128?
I basically want two extra ports for communicating with two other Mega128's,
doesn't need to be super fast 192Kbaud will be fast enough.

Paul

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by David VanHorn

At 09:16 AM 6/29/2004 +0100, Paul Maddox wrote:

>Dear all,
>
>anyone have any idea how I can add an extra two serial ports to a Mega128?
>I basically want two extra ports for communicating with two other Mega128's,
>doesn't need to be super fast 192Kbaud will be fast enough.

Can you do clocked serial on a couple of pins, maybe in a ring, or share clock and separate data lines?

Does everyone need to talk to everyone, or master to two slaves, or ?

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Paul Maddox

Dave,

> Can you do clocked serial on a couple of pins, maybe in a ring, or share
clock and separate data lines?

I could, though There will be other stuff going on, so I'd rather not have
to depend on bit banging.

> Does everyone need to talk to everyone, or master to two slaves, or ?

two fo the four ports come from outside, for these I planned to use the
built in USARTs.
The other two are slaves from the master, so I could use my own 'serial'
ports by bit banging, but I'd rather avoid the over head if possible.
Ideally I'd love a dual UART chip with buffer :-)

Paul

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Robert Adsett

At 11:01 AM 6/29/04 +0100, you wrote:
>The other two are slaves from the master, so I could use my own 'serial'
>ports by bit banging, but I'd rather avoid the over head if possible.
>Ideally I'd love a dual UART chip with buffer :-)

You mean something like a 16c552? (National and TI both have versions)  I 
think Motorola had a duart as well but I don't know whether Freescale or On 
would have picked that up.  There are probably others but that's a start.

Robert

" 'Freedom' has no meaning of itself.  There are always restrictions,
be they legal, genetic, or physical.  If you don't believe me, try to
chew a radio signal. "

                         Kelvin Throop, III

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Magnus Johansson

> The other two are slaves from the master, so I could use my own 'serial'
> ports by bit banging, but I'd rather avoid the over head if possible.
> Ideally I'd love a dual UART chip with buffer :-)

There's always the 16550/16552. Are you using the i2c-port, how about
connecting the slaves to that bus instead?

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Paul Maddox

Magnus,

> There's always the 16550/16552.

looking at them, not ideal, but good..

> Are you using the i2c-port, how about
> connecting the slaves to that bus instead?

that would get me a third, but isn't the i2c port the same pins as the
second UART?

Paul

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Paul Maddox

David,

> Use SPI, and make it a ring?

There's an idea....
I need to look at the pins and see whats in use...

Paul

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Magnus Johansson

> that would get me a third, but isn't the i2c port the same pins as the
> second UART?

Had to look at the pinout, haven't used the 128 in a while. No, i2c/TWI 
are pins 25 & 26, UART1 uses pins 27 & 28. You'd use the same i2c-bus to 
communicate with both slaves.

Re: [AVR-Chat] 4 Serial Ports

2004-06-29 by Paul Maddox

Magnus/Dave/all,

> Had to look at the pinout, haven't used the 128 in a while. No, i2c/TWI 
> are pins 25 & 26, UART1 uses pins 27 & 28. You'd use the same i2c-bus to 
> communicate with both slaves.

I2C or SPI it is then, off to have a play, thanks again!

Paul

Re: [AVR-Chat] 4 Serial Ports

2004-06-30 by Reza

--- Paul Maddox <P.Maddox@signal.qinetiq.com> wrote:
> Dear all,
> 
> anyone have any idea how I can add an extra two
> serial ports to a Mega128?
> I basically want two extra ports for communicating
> with two other Mega128's,
> doesn't need to be super fast 192Kbaud will be fast
> enough.
> 
> Paul
> 
> 
> 
Hi.
I dont know this can solve your problem, or not.
but I had same problem wichi was communicating with PC
and at same time with 12 other micros.

I used a bridge (an ATmega163) and other micros were
163 also. I was build a bridge board which
periodically switches between all channels which were
connected to 163 using a MAX232 a buffer. but in all
cases the bridge board denotes which micro haveto
communicate and in which direction like this:

for all channels including PC
   enable channel
   query channel if need to send a packet
   if so, request to send the packet
   disable channel
   enable target receiver channel (specified in
packet)
   send data to target receiver
   disable channel
end for

I used this method at 9600 bps but in my problem, the
speed was a great problem bcz of distance and quality
of medium used for communication.

reza


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

Re: [AVR-Chat] 4 Serial Ports

2004-06-30 by Paul Maddox

Reza,

> I used a bridge (an ATmega163) and other micros were
> 163 also. I was build a bridge board which
> periodically switches between all channels which were
> connected to 163 using a MAX232 a buffer. 

Thanks, another good soloution!

Paul

Re: [AVR-Chat] 4 Serial Ports

2004-06-30 by wagner

Paul Maddox wrote:
> Dave,
>
>> Can you do clocked serial on a couple of pins, maybe in a ring, or
>> share clock and separate data lines?
>
> I could, though There will be other stuff going on, so I'd rather not
> have to depend on bit banging.

I would think twice.
The processing cycles overhead to produce a 4800 bps software UART
(big-bang) is no more than a 1% in a 4MHz AVR (considering 8 instructions to
manage each serial bit), could say even half percent in a 8MHz AVR.  Well, I
see you want to intercommunicate 2 or 3 uCs at 192kbps, for that I would
develop my own protocol in burst mode, synchronous data frames, CRCs, etc,
something dedicated for the application.  Bit-bang for that speed is an
overkill, consider 4 channels running at 25%, will be an equivalent of a
constant 400kbps data flow, a 8MHz core will deliver no more than 20
instructions per each serial bit period of time, impossible to do anything
else.


>> Does everyone need to talk to everyone, or master to two slaves, or ?
>
> two fo the four ports come from outside, for these I planned to use
> the built in USARTs.
> The other two are slaves from the master, so I could use my own
> 'serial' ports by bit banging, but I'd rather avoid the over head if
> possible. Ideally I'd love a dual UART chip with buffer :-)
>
> Paul



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.706 / Virus Database: 462 - Release Date: 6/14/2004

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.