Bascom and AVR, Introduction.
Bascom means Basic Compiler. Bascom is developed and sold by
Bascom comes in three variants:
- Bascom-LT for Atmel AT89Cx051 microcontrollers
- Bascom-8051 for 8051 microcontrollers
- Bascom-AVR for Atmel AVR microcontrollers
The pages you are reading here are solely concerned with Bascom-AVR and are written
as a result of a group-effort of 10 radio hams trying to get started with writing
ham-radio applications for Atmel AVR microcontrollers. So, although these pages are probably
general enough to get anyone started, they are obviously focused in some places
on ham-radio applications .
Bascom is a PC application that will allow you to:
- write programs in Basic
- translate these programs on the PC to machinecode (a format the AVR controller can execute)
- simulate the compiled code
- use external programs to flash ('program') the compiled code into an
Bascom is a work in progress, it has its quirks, as any compiler has. It has its share of bugs and problems.
In my view however, it has exceptional value for money.
Make sure you regularly read (and perhaps contribute to)
the Bascom forum. Follow the forum for a while to see what is
going on with the users of Bascom and what the major points of discussion are.
The nice thing about Bascom is that you can get started with a
free Bascom version (goto
the Bascom AVR download page,
and download the Bascom-AVR Demo zip-file)
whose only limit is the 4k generated code size (this was 2k until 2005). The obvious choice of AVR
microcontroller would then be one of the (2k flash) ATTiny models or the much-used (but now obsolete) AT90S2313
which will let you get acquainted with Bascom and AVR microcontrollers.
Bascom enables quick prototyping because it has built-in support for almost all AVR microcontroller features such
plus it supports lots of peripherals such as:
- alfanumerical lcd's
- graphics lcd's
- external 3x4 or 4x4 keyboard
- ps/2 keyboard
- infrared remote control
It is especially this support that makes using Bascom attractive in terms of time saved while developing
Do not let the name Basic fool you: Bascom is not a slow interpreter, but a compiler. It translates Basic
statements into AVR machinecode. It certainly generates overhead, as compilers do, but the code is quite fast
is a family of 8-bit microcontrollers with a large range of variants differing in:
- size of program-memory (flash)
- size of eeprom memory
- number of I/O pins
- number of on-chip features such as uart and adc
- package forms
The smallest microcontroller is the ATTiny11 with 1k flash and 6 I/O pins. The largest is the
ATMEGA256x with 256k flash, 54 I/O pins and lots of on-chip features.
All AVR controllers have the same RISC-like instruction set, enabling fairly easy porting of Bascom programs
between microcontroller types. They execute one instruction per clock-cycle making them appreciably
faster than comparable 8-bit 4 clock-cycles-per-instruction
PIC controllers .
What I want with these pages.
If you want to get started with writing Bascom programs for AVR controllers you face several challenges.
Installing software and writing Basic statements will not be a major problem, but if you want to build
your own programmer hardware and AVR projects you always run the risk of 'things not working'.
These pages could be a step-by-step guide in helping you to build a programmer, build a simple AVR
project (a LED flasher) and getting all this to work. If you can get over this hurdle, the rest is fairly
uncomplicated: designing microcontroller applications will only be limited by your imagination plus
of course the more trite limitations of the microcontrollers and Bascom itself.
Once you have got started, you may want to look at some examples I have tested. These are not complete
applications but small pieces of Bascom code highlighting some feature. You could use these examples as a
starting point to write your own programs.
Most of the examples shown on these pages have been tried out with the low-cost AT90S2313 controller.
Make sure you download and read the
Atmel has not formally discontinued this type yet, but calls it a 'mature product'. This means that
Atmel does not recommend using the AT90S2313 for new commercial designs. However, the AT90S2313 is
still widely available. You may choose to use the direct replacement ATTiny2313 instead. This
controller is supported in Bascom. Bascom will hide most of the differences between the AT90S2313
and ATTiny, but you may want to read
the relevant ATMEL application note.
On the subject of ATMEL info: browse the
list of application notes
to see if there is anything interesting for you. Some notes and articles are general enough to be
of interest, even if you do not want to know how to exactly solve some problem using assembler.