Example Application of AD/DA conversion
have u listen a music ?
Of Course yup! (what on earth r u -if u never listen a music-)
u must known CD (compact disk), its usually to storage a song & film but most of all is to storage music. Do you know how it works?
How exactly a computer or CD player read the code. it`s all about AD/DA conversion (Analog to Digital/Digital to Analog conversion).
ADC -Analog to Digital Converter-
it changes analog signal into digital (analog signal such as output sensor voltage). Why we must change the signal, it`s because a computer or any other electronic devices only process digital input, no matter what.
DAC -Digital to Analog Converter-
this is the inverse of ADC. its useful to ‘translate’ data from a computer to any actuator (for e.g.; fan, motor,etc).
when we talked about AD/DA conversion, we need to know these things
1. Bit
2. Resolution
3. Error
Bit: usually 8 bit ADC (cheaper) and 12 bit for more precision.
Resolution : depend on your bit. (full scale voltage)/(2^n -1)
Error : There is always an error. i got 6% of error from my DAC converter. U can count that with this formula.
(if u used 8 bit and max voltage 5 volt)
Digital voltage = (DAC read/256)*5 volt
Error = |Actual voltage-Digital voltage|*100% / actual voltage
see more detail in this site
http://communication.howstuffworks.com/analog-digital3.htm
STK 200 (FREE avr programmer / downloader)
i used this one, is simple, easy to build & cheap. no need any microcontroller. this is the schematic
i got it from this site
it`s connected to parallel port on your computer and also need supply voltage 5 volt and ground of course. There r three important line that must be connected between the parallel port (centronics) to your microcontroller unit (MCU), and that are MOSI MISO and SCK. Each type of MCU have a different pin configuration so u need to see the datasheet. This is my STK200

i have no trouble when i built this, its amazed me somehow, coz usually there is always some little mistake that i made when i build something, but not this one.
if u wanna build with USB connection, visit this site
Using CodevisonAVR
This is about, how to get started in codevison AVR.
First thing first, of course u need to install CodevisionAVR vist this site
and download this one,
CodeVisionAVR Evaluation V2.04.6
CodevisionAVR is a compiler for microcontroller AVR with C language, its included codewizardAVR. Believe me is really easy to used this thing, i will show u.
This is the step
File, New, Project, using codewizardAVR………then u will find this

do whatever u want -based on your purpose- (just click it) then after that
File , Generate save file and exit
all u need to do is just add your program (sometimes it takes only a few lines). for further information u can read my book (GUIDLINE PROJECT from AVR to Delphi)

i still want to edit this book, not to complete but its enough to understand about AVR. just come to my lab and i will give u this book. it`s still in indonesian version, if u want the english version, u have to wait.
i will give this book for free, coz knowledge is free.
control servo (PWM) with atmega8535
My friend ask me to help in her final project which need a motor with a very slow velocity (1cm/hour) . Can you imagine that ?
As far as I know, the best solution is Servo. We can control the speed with PWM (Pulse Width Modulation), and of course as my favourite microcotroller ATMega8535 will do that control. it`s only need two line addprogram in codevision AVR.
and it`s really work.
I love it…I love it…..I love it
this is the program
/*****************************************************
#include <mega8535.h>
#include <delay.h>
void main(void)
{
// Port A initialization
DDRA=0xFF;
// Port B initialization
DDRB=0xFF;
// Port D initialization
DDRD=0×20;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: 1500.000 kHz
// Mode: Ph. & fr. cor. PWM top=ICR1
// OC1A output: Non-Inv.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0×80;
TCCR1B=0×12;
TCNT1H=0×00;
TCNT1L=0×00;
ICR1H=0x3A;
ICR1L=0×98;
OCR1A=1000;
OCR1BH=0×00;
OCR1BL=0×00;
while (1)
{
for(OCR1A=600;OCR1A!=1500;OCR1A++){
delay_ms(7100);}
};
}
This program will control the servo in speed 1cm/hour
It`s WORKS! try this one(its fun, u need to wait 2hours to make sure the distance..ha…ha..)
-
Archives
- July 2010 (1)
- May 2010 (1)
- March 2010 (4)
- February 2010 (4)
- July 2009 (1)
- March 2009 (4)
- February 2009 (2)
-
Categories
-
RSS
Entries RSS
Comments RSS
