GPC450
GPC450 is nothing more than a very flexible microcontroller (AT90S4433) with
a robust power supply, 18 configurable I/O, in-circuit programming and RS232
communications arrangements on board. Combined with a real-time shell written for
Bascom-AVR, it is a very flexible and capable control platform. See a picture
here.
The combination of GPC450 and Bascom-AVR represents very little wasted effort,
from software tool installation and hardware hookup to the bare bones of a
working control application, for someone new to microcontroller-based control
platforms.
Contact me if you want to
purchase a GPC450, and Mark Alberts if you
want to purchase Bascom-AVR (free demo is available)
This general purpose controller was designed and prototyped, to support the
ELEN450 course (now Mechatronics II : MECN468 ).
GPC450 Quick Start (Bascom-AVR orientated)
- Look at the hardware, and
flip through the manual,
so you know what it is you are dealing with.
- Install Bascom-AVR software
demo.
Newest demo version allows 1kB of code, download all the relevant files New_1 New_2 New_Ex New_Help (yes,
even demo is supported by vendor)
An older (unsupported) demo version allows 2kB of code, I have a copy
here: Old_1
Old_2
Old_Ex
Old_Help
- Unzip the files above in
the same folder, install Bascom-AVR
- Open Bascom-AVR and set it
up correctly:
- Set:
Options-Compiler-Chip to 90S4433.
- Set:
Options-Compiler-Communication "baudrate" to 9600, or whatever
speed you want to communicate with GPC450 and "frequency" to
agree with what is stamped on the crystal on your particular GPC450
board, e.g. 8000000 for 8MHz.
- Set:
Options-Communication to agree with what you typed in above, but now set
the other serial port parameters as relevant to your serial port. Note
that you should use 8 data bits, and "no parity" and 1 stop bit
for most efficient code (at whatever baud rate).
- Set: Options-Environment-Editor
to "don't change case" otherwise you get German-style
captilisation of every word!
- Set:
Options-Programmer "programmer" to STK200/STK300 programmer
- Hit the
"default" button to store your setup, or else you'll end up
doing all of the above each time you open the program.
- Download, and unzip the
real-time shell to be found here
- Open RTSH_1_main.bas, and
see if it compiles (F7) with no error. If you get an error at this point,
go and check if your setup above is correctly done. Note that I have
only run the shell on the old demo version of Bascom-AVR.
- You could simulate the
program by hitting the corresponding Bascom icon. This step is
non-essential for now.
- Connect the
programmer/communicator to the GPC450 using the RJ45 patch cable.
- Plug the DB25 connector
side of the programmer/communicator into the PC parallel port, and the
link the serial port of the PC with the programmer/communicator using the
short DB9 patch cable.
- Power the GPC450 up
appropriately (consult the manual
if in doubt). The red indicator light should be illuminated.
- Load the binary file to the
GPC450, by hitting icon labelled "send to chip" or use F4 key.
Use "autoprogram" option.
- Open the Bascom terminal
emulator, by hitting the relevant icon.
- Type something, to see if
you can communicate with the GPC450 (since this is one of the functions the
shell program provides). If nothing comes back at you, check connections
and that all the setup is correct. If you type and you see characters,
verify that the GPC450 is generating them by switching the power off and
on again. You should get one or two random characters when you do this.
- Look at the header
instruction material of the real-time shell program. You should start by
programming to replace the "{{{{{{.....}}}}}}" in the definition
part of the shell, and in the "my program tasks" part of the shell.
Never use code here which holds the machine waiting for something - rather
set/clear a flag and continuously interrogate it. You will quickly see if
your code holds the machine up, if you compile and load it, it will start
typing the task demand overflow character "!" continuously to
the screen, provided that your serial communications are working.
- Ensure that you start from
a shell that compiles, make a small modification, then check that it still
compiles. You will not successfully de-bug using Bascom if you write your
entire program, then start debugging.
- Now you are ready to think
of your application hardware and software.
Don't be too ambitious when you program, rather use simple constructs in basic,
so that the most efficient assembler is generated. Avoid permanent
"Print" statements and long character messages, they chew up
space. (you can see how much space your program occupies in "show
compile result" in Bascom, look at the ROMIMAGE value (in
hexadecimal).
More detailed information
GPC Manuals (notes on usage)
Manual
Please contact me if you find any errors or discrepancies.
Programming the GPC450
Programming language
- Assembler:
Atmel offer a free assembler and simulator, see http://www.atmel.com/atmel/products/prod202.htm
IAR offer a free assembler packaged with their excellent Embedded
Workshop project package, see http://www.iar.com
(the IAR tools are my choice for any serious AVR work)
- BASIC compilers.
Several are available:
Bascom-AVR by Mark Alberts (NL) is the recommended choice, see http://www.mcselec.com. There is also an
active development program and lively, well-supported e-mail list you can
subscribe to. A bit "closed" (register usage is not common
knowledge), but a nice package overall, including its own
development, simulator and de-bugging environment -and there is
nothing stopping you from doing in-line assembler to get super performance
out of this package. More or less compatible with Qbasic they say,
although the front end looks like MicroSoft VisualBasic.
- C compilers. There
are several vendors of C-programs, from the high-end, ANSI-C and EC++ from
IAR (high price too) though to ICCAVR from ImageCraft, to CV from
CodeVision. For the serious C programmer (who cannot afford the excellent
IAR package), I recommend GCC-AVR, the GNU ANSI C compiler for the AVR
range of microcontrollers.
GCCAVR package can be found at : http://www.avrfreaks.com/AVRGCC/index.php
You may need to register with avrfreaks first, to download at any of these
links. I also recommend that you download the ELF2COFF conversion patch
here, so that you can simulate/de-bug using AVRstudio.
Documentation
- AVR software tools,
application notes, etc may be found at http://www.atmel.com/atmel/products/prod23.htm
- Data book http://www.atmel.com/atmel/acrobat/doc1042.pdf
- AVR Instruction list http://www.atmel.com/atmel/acrobat/doc0856.pdf
Simulator/de-bugger
A simulator-debugger is a useful tool, get it from Atmel: ftp://www.atmel.com/pub/atmel/astudio3.exe
Programmer software
If you don't like the programmer included with any development environment
(e.g. the F4 key functionality in Bascom-AVR), several other programming
software packages are available, for example PonyProg by Claudio Lanconelli
http://www.cs.unibo.it/~lanconel/prog.html Just set it up for AVR-ISP.
Other links and resources
- AVRfreaks : http://www.avrfreaks.com you
are going to have to register - no big deal.
- List of AVR applications
(some are quite useful, in various languages) http://www.hth.com/filelibrary/txtfiles/loaa.txt
- Real-time Shell in Bascom-AVR,
useful starting point for control or data aquisition applications.