Google

Monday, July 9, 2007

How to begin project?

1.Learn as many as you can about digital electronics, include digital electronics.
2.Acquire your equipments: components, input/output devices, softwares, and also a PC/laptop.
3.Build a minimum system.
4.Write a list of test program, compile and load it into micro.
5.You have finished a simple project



Digital Electronics

There are many terminologies related to the electronics. Voltage, current, resistance, power, energy, wire, bus, component, IC, amplifier, comparator, high logic, low logic, etc. The voltage is the most often talked thing. Generally, we describe the 'logic' as the voltage level. High logic means +5 volt, and called '1', meanwhile low logic means 0 volt (GROUND), and called '0'.

A micro can both source or sink current, therefore the logic of their pins can be '1' and also '0'.

Equipments needed

1.components for minimum system
1.MCU IC (AT90Sxxxx, ATmegaxxxx, ATtinyxx)
2.oscillator system: crystal, ceramics capacitors: 30 pF (2)
3.power system: voltage regulator LM7805, indicator LED, limiting resistor 1 kohm, ceramic capacitor 100 nF.
4.reset system: push button switch, limiting resistor 10 kohm, electrolytic capacitor 10 uF/16 V.
5.several jumpers (made of headers) for port expansion and downloader.
6.several cables needed

2.components for downloader cable
1.a 5-pins data cable (1 meter long)
2.a 5-pins housing
3.a male/female parallel connector (25-pins); to determine using male/female, look at your mainboard, they have to be opposite.
4.optional: limiting resistors 330 ohm

3.input/output devices
1.output devices: LEDs, motors, LCD, PC, electronic systems
2.input devices: switch, PC, optocoupler, electronic systems

4.software
1.operating system: Windows
2..pdf reader: any kind
3.AVRStudio: any version
4.PonyProg2000

5.PC/laptop specification
1.I can't describe here the minimum requirement needed, but based on my experience, a Pentium II based PC with 64 MB RAM is enough to run the microcontroller projects.
2.You will need a PC/laptop which has a parallel port for micro programming, and it is strongly recommended the PC/laptop also has one or two serial port(s) in addition to communicate to the micro.


Test program

There are 3 kinds of the language used to write a program: Assembler language, C language, and also BASIC language. The first one, assembler offers direct instruction to access registers and features in a micro. Nevertheless, the language structure is so simple, therefore makes it so complex. You will see short instructions such as ldi r16, $FF or sei. If you understand them, playing micro is so nice!

The second, C language is higher level than assembler. You can read english words here, such as while, if, unsigned, etc. For newbie, there are many symbols confusing, but it's only need an understanding. C language is known as the language used by many programmers around the world.

And the last, BASIC language. Differ from the others, it offer quick access to the features. Even, we can access a PWM feature in only few rows. The features can be accesses through the config instruction.

This is a test program using assembler language:

;Test program implemented in a ATmega8535 micro
;Turning on the LEDs connected to PortA

.include "m8535def.inc"

.org 0
rjmp main

main:
ldi r16, high(RAMEND)
out SPH, r16
ldi r16, low(RAMEND)
out SPL, r16

ser r16
out DDRA, r16
ldi r16, 0b10101010
out PORTA, r16

;end of program

No comments: