Dane.Kouttron
Intro to Bascom
What?Teaching/preaching about AVR's, using ADC conversions, and driving lcd's in bascom in under an hour and a half
Why?
My friend (Hui) needed help with her ied project. the goal was to make a device that returned the degree measure an axel spun to. So say the axel spun 42 degrees. Using a multiturn potentiometer she is now able to say (within 10 bit accuracy ove 275 degrees) precisley the angle a physics demonstration was set to.How?
Using
an atmega 48, some breadboard and the good ol' sample
electronics parallel port programmer and less than an hour and a half
| Pre-project tip | get more than 1 color of wire. | |
| 1. | make a programmer. the
simplest one is the
sample electronics programmer. download bascom at: link |
![]() look at the schematic hereif you dont have a buffer, just use wire. its to the buffer's are to protect your computer but in a pinch a 100 ohm resistor or just plain old wire will work. |
| 2. | power
your ic the atmega 48 requires anywere from 1.8 to 5.5 v this can be provided by anything from a set of 2-3 aa alkaline batteries or 4 nicd rechargeable batteries (4.8V). if you want to drive 5v applications (lcd's) your going to need to run at 5v (or whatever the tolerant voltage is). the super basic diagramn shows where to connect the micro to the parallel port. |
|
| 3. | Plug in the prorgammer start up bascom, create a new project, save it. hit F7 (compile) and F4 (run). if you ic is plugged in properly the program will recognize the individual ic and everything will be happly. |
|
| 4. | Write some simple code and blink
an led config portb.3 = output b3 alias portb.3 main: b3=1 wait 1 b3=0 wait 1 goto main |
this blinks portb.3 on and
off once a second. if you were to add an led in that point, it would
blink once per second. i used a simple green led to display this |
| 5. | Taking an
ADC to return the angle an axel spins to, we used a potentiometer (10k) and ran the center pin to the microcontroller. For those without ee knowledge, it basically creates a device that is a variable voltage divider. When the potentiometer is turned all the way to one end, it spits out +5v, and at the other end 0v. its position is linear to the voltage output (for the most part) because the m48 has a 10 bit adc, (which can be set to range from either vcc or vref (2.4v internal) |
|
| 6. | displaying the data using the information about bascom and character lcd's at qsl.net [link] connect an lcd to the microcontroller's free gpio (general purpose i/o) for the first test, i |
|
| 7. |
| Simple
video of operation [hosted
by big brother] link |
|
Dane.Kouttron
Rensselaer Polytechnic Institute
Electrical & Electrical Power
631.978.1650

