Pascal for the AVR micro-controller  

 

This page might be of interest to anyone who:

 

·        is engaged in writing small-scale control programs for the Atmel AVR micro-controller, either as a hobby or for educational purposes

·        would  prefer to use a high-level language based upon Pascal

·        is attracted by the idea of freeware!

 

The PascalAVR package is a small-scale IDE, which can be used to develop programs for the AVR using an extended subset of the Pascal programming language. The package offers a number features, including:

 

·        a range of 8 and 16-bit data types for control applications

·        EEPROM and SFR variables

·        string-type variables and constants

·        the facility to mix assembly-language code with high-level code

·        the facility to control the run-time environment of the target (the location of stack & global variables, clock frequency etc.)

·        an external library of useful modules for control of specialised peripheral devices (e.g. LCD panel, bar-code reader, matrix keypad, sound generator, PWM driver) which can be extended and optimised by the (assembly-language) programmer.

·        built-in help and documentation

·        a simple editor-compiler environment from which tools, such as an assembler (e.g. AVR assembler),  debugger (e.g. AVR Studio),  ISP programmer, terminal emulator etc. can be run

 

Note: you will need access to a copy of the Atmel AVR Assembler (V1.50 or later) which is available as part of the AVR Studio package. You can download this from the Atmel web-site.

 

The package should be suitable for any AVR device with SRAM, although it must be said that practically all of the development work was carried out on the Atmel STK200 and using breadboard construction with the AT90S2313 as the target. As soon as I get some larger parts (ATMega8 etc) I shall be able to test more thoroughly.

 

From here, you can:

 

·        read a brief account of the background and terms of use of PascalAVR

 

·        download a copy of PascalAVR as a self-extracting ZIP file

 

·        view a number of target systems constructed to test PascalAVR during its development:

 

1.      motor speed selector – uses PWM to drive a low-powered motor with ten programmed speeds selectable from a keypad.

2.      musical jingle generator – simple tunes played on a piezo-electric sounder and titles displayed on an LCD panel.

3.      max. and min. thermometer – uses an external ADC with temperature sensor; temperatures displayed on an LCD panel.

4.      magnetic stripe reader – a cheap second-hand swipe reader is connected to a parallel port and the data read is sent via the UART to the PC running a terminal emulator program.

 

The code for all four of the applications described above is included in the PascalAVR package, together with a number of others, in the ‘sample programs’ subdirectory.

 

Clive Graham.              mailto:pascalavr@grahamfamily.eclipse.co.uk