Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Programming ADC on Attiny25
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Programming ADC on Attiny25

by raykholo on Fri Jun 04, 2010 9:52 pm

I am making a servo tester with the attiny25v microcontroller. I need help writing a function that will set up and perform an analog read (initializing adc registers, setting the timers, etc.) I use AVR Studio 4.
If anyone is interested, this servo tester will read a 10k pot and control the servo with that, and there will also be a pushbutton that will center the servo. And I was planning to "bit-bang" the servo pulses, but if anyone is aware of a super small library that will comfortably fit into the 2k of memory, please let me know.

Thank you.
raykholo
 
Posts: 26
Joined: Fri Feb 19, 2010 6:54 pm

Re: Programming ADC on Attiny25

by adshea on Sat Jun 05, 2010 2:32 am

The ATTiny25 has a timer that you can use in "Output Compare" mode as a PWM generator. This will let you generate pulses without having to bit-bang them.

adshea
 
Posts: 48
Joined: Fri Nov 06, 2009 10:01 pm

Re: Programming ADC on Attiny25

by raykholo on Sat Jun 05, 2010 8:16 am

AdShea wrote:The ATTiny25 has a timer that you can use in "Output Compare" mode as a PWM generator. This will let you generate pulses without having to bit-bang them.


Thank you. Is there a function such as PULSEOUT in the AVR Studio syntax?
raykholo
 
Posts: 26
Joined: Fri Feb 19, 2010 6:54 pm

Re: Programming ADC on Attiny25

by Entropy on Mon Jun 07, 2010 11:33 am

raykholo wrote:
AdShea wrote:The ATTiny25 has a timer that you can use in "Output Compare" mode as a PWM generator. This will let you generate pulses without having to bit-bang them.


Thank you. Is there a function such as PULSEOUT in the AVR Studio syntax?

Not sure if there is anything directly - I'd read the datasheet for information on ways you can configure the timer/counters to do what you need.

http://winavr.scienceprog.com/example-a ... g-avr.html should give you a start, but you'll have to take the register definitions and port them appropriately to the Tiny25 running at your selected clock frequency. (Exact register bits will be different, as will your prescaler values.)
Entropy
 
Posts: 472
Joined: Tue Jan 08, 2008 12:43 am
Location: Owego, NY USA

Please be positive and constructive with your questions and comments.