B A S C O M

Introduction to microcontroller programming using BASCOM


This very usefull "pocket-book" has been dedicated to whom would like to experiment the use of µP and programming the same by using the powerfull and easy to use BASCOM BASIC Compiler.

This "pocket-book" has been conceived to allow people, mainly novices, to make the first important steps, and subsequent ones, to the misterious world of 8051 and AVR µP families.

Written in easy and explicatory English and equipped with a large number of demo programs, this "pocket-book" leads the reader to the discovery of many different applications.

Readers have at their disposal a complete serie of PCBs diagrams which allows to make an experimental cards with 8051 µP so as a Programmer/emulator for 89C2051 ect.

For further information please visit our Web Site www.grifo.it or www.grifo.com or contact us directly at our offices.


I.
II.
III.
IV.
V.
VI.
VII.
VIII.
IX.
X.
XI.
XII.
XIII.
XIV.
XV.
XVI.
XVII.
Introduction to microcontroller programming using BASCOM
Short intro to microcontrollers 
More lights! 
Inputs and outputs 
Letís play a tune 
Letís connect our BASCOM test board to the PC 
Displaying data on LED display 
Displaying data with multiplexed LED displays 
Connecting PC keyboard to microcontroller 
Frequency counter with the AT89C2051 microcontroller 
What to do when we run out of RAM? 
BASCOM for advanced users: Gosub and Call 
BASCOM for advanced users: Bascom and assembler 
BASCOM BASic COMpiler for micro controllers of the 8051 family 
Programmer PG302 
Adapters for the PG302 programmer 
BASCOM ñ Test board for the 8051 family 
4
7
9
17
20
25
32
43
49
58
87
92
98
103
106
115
123


We all remember the rainbow, Sinclair's ZX Spectrum, which opened up the mysterious world of microprocessors and microcontrollers to many of us. At that time microprocessors seemed like a total mystery (or tabu) to many of us, so most people avoided them whenever they could.

Advancements in the field of electronics, programming languages and development tools changed all this.

Microcontrollers are today widely available to anyone who cares to use them. Moreover, it is difficult to imagine a serious device without a microcontroller. We live in a world of inexpensive microcontrollers and the only question remaining is how to make a painless, as much as possible effortless transition. BASCOM is a perfect solution for a novice microcontroller user.

Still, it would be hard to persuade many of the engineers, dealing with analog circuits, that they need to use microcontrollers in their designs. They never really took enough time to recognize how useful microcontrollers can be in analog circuits.

However, most of us know about Basic, either from the golden times of Sinclair ZX or from high school. And this is where BASCOM uncovers the mystery. If we do for you what the Spectrum did for us - unveil a new magical world of seemingly unlimited possibilities - then what we did wasn't in vane.

BASCOM is a relatively new programming language; it was introduced in 1995.

We have been learning and building practical projects with BASCOM ever since, with the indispensable help from Mr. Pelcl and Mr. Okroznik. The BASCOM test board is a result of this cooperation. The BASCOM test board was designed for the testing of programs, not to mention all the examples in this manual.

The author of the BASCOM software, Mr. Mark Alberts, has invested a lot of time and effort to make BASCOM what it is, a useful and affordable development tool. Many useful general-purpose routines were integrated into BASCOM: LED Display control, RS232 communication, I2C, 1Wire routine and others. All of the mentioned routines would require a capable and well-trained programmer to write the code, but are provided here "for free". BASCOM gives all this power to the beginner programmer. We hope that this manual helps its readers make the first step as easy, educational and intresting as possible. The booklet that you are reading is the second, updated edition where more code examples are included, like serial connection between BASCOM test board and PC, communication between PC keyboard and microcontroller, frequency measuring with one AT89C2051 and other examples.

I would like to thank the authors, Mr. Mitrovic and Mr. Nahtigal for their contributions. I would like to express my gratitude to Mr. Mark Alberts, he was an indispensable help and he showed a great deal of patience as well. Mr. Mirko Pelcl and Mr. Gorazd Okroznik were great help as well; they have initiated me, a once novice programmer, into the magical world of code. Our long-term associate, Mr. Vladimir Mitrovic, helped with mature advice of a professional lecturer and with various tips concerning the manual itself. Mr. Marko Seruga done translations, while Mr. Douglas Burkett assisted with proof reading the translation. I'd like to express my gratitude to all of our associates that helped bring this manual to the market.

Thank you all very much!

Jure Mikeln

Ljubljana, September 2000


Last Up-dated at December 15st, 2000


GRIFO®
Via dell'Artigiano, 8/6
40016 San Giorgio di Piano
Bologna ITALY

Tel: +39 051 892.052 (4 lines)
FAX: +39 051 893.661


homeHome Cards Categorical Index I/0 Tables D. S. Advertiseds SimStick