HOME - - - - - - Other material for programmers - - - - - - Pascalite Hardware "How To.." Main Page

Pascalite hardware: First Steps

First Steps with Pascalite

This page covers, I hope in beginner-friendly detail, all the "fun" things you need to go through the first time you use your shiney new Pascalite hardware.

This material (c) T K Boyd, 3/03. I hope you will establish links to this for me... but please do not re-distribute it. It is for your personal use. If you are a teacher, please feel free to make properly credited copies for use by your own pupils until August 2004, at which time the license lapses. Please revisit this site to see how things stand then.

This is written especially for the Pascalite Plus, and software version 2.60C... but much of what appears here will apply equally to the other Pascalites and other versions of the software.

I suspect most users will already have the software installed, but just in case, I'm starting from scratch with these notes.

I have tried to cover things that neophytes will need to know. Let me know if you were left without an answer to something. Experienced users: Please be patient?!

I have no formal connection to Control Plus, though I hope, through this and other efforts to build up some "good will" credit with them!

First, set up the PC which is going to be used for programming your Pascalite. This machine will be called the development PC in the rest of this.

I used an old Toshiba 100CS Satellite that cost me £ 75. You'll need a free serial port, either a 9 pin one, or you'll need a 25->9pin adapter. (Assuming you bought the very reasonably priced cable supplied by Control Plus. You could, of course, make up your own 9 pin (Pascalite end) to 25 pin cable.

Besides testing the performance of a system set up at the time of receiving my first Pascalite, I've also confirmed that it works fine on a system which was set up with the free compiler and simulator download. (If you have that on your machine already, you still need to set up the environment options, as desribed below.

The Pascalite disc I received 2/03 had a standard Windows "Setup.exe" which behaved nicely when I ran it... Allowed me to say where I wanted the software installed. As I remember it, the download from the net was also well behaved. I installed the program where I wanted it (C:\Program Files\Pascalite) rather than in the default folder, and had no regrets.

See my Pascalite software tutorials for notes on what the software should do, even without the hardware.... Or just keep reading... we'll be using it shortly...

The following attempts to take you through a set of exercises and tests which will...

     a) Introduce you to your Pascalite
     b) Test it in a logical and "first things first" sequence.

Unplug anything that may be plugged into your Pascalite board.

Organise your power supply. This needs to be 7-15v DC, 500mA; it doesn't need to be regulated. If you are (as you probably should) using a procket to connect the power to the board, the outer sleeve should be 0 volts, and the central hole positive.

Plug your power in to your board. Use a voltmeter to check that 5 volts appears across the pins marked "GND" and "5v" on the 26 way (2 x 13) set of pins. The first psu I tried on it out of my junk box SEEMED to meet the specs... but I was only getting 4.3v. A different PSU worked okay... mystery not resolved at this time... but it is very likely the problem is with the PSU.

(An aside: Look at the underside of the Pascalite board. You will see that the pins of the 2 x 13 header are connected in pairs: pins 1 and 2 are for "Cnt", pins 3 & 4 are for D7, etc.)

You can also power the Pascalite with an ordinary 9v battery.

Regardless of your power source, I would recommend incorporating an on/ off switch... not just because I try to be tidy-minded, but also because you quite often have to reset the device with a power off / on cycle when you are doing repeated programming. (Most of us have to program and RE-program a few times to get something to where we want it. Incremental development is a good thing.... and we sometimes fall prey to indulge in "poke and hope" debugging, which always adds "try again" cycles!)

On the development PC, start the Pascalite Integrated Development Environment (IDE).

Invoke File|New|Empty


program IntTut1;
until 4=5;
(Yes, I know there's an extra semi-colon in that! See elsewhere for details of Pascal programming. For now.. just do it!)

Save your program. You can use whatever name you like. I'm using IntTutn for these: "Introductory Tutorial"n. I'd suggest making a folder called Pascalite in your My Documents folder.

Invoke Tools| Simulate Program (or just press F2!).

Once you've fixed all typos (!), and it compiles, other windows will open. Above the window where you entered the program's source code, a new bar of icons will have appeared. Click on the green, right-pointing triangle. In the simulation window, you should see LED d0 winking on and off.

Click the grey square to stop the program.

So far, so good. Now to make it work in the real Pascalite. Good old RS-232! If you were working with computers back then, you'll know what I mean. If not, you may find out. But at least it has a lot less to go wrong than modern machines!! If you have trouble with this element of the package, it will only be once, and will be your biggest difficulty.

Invoke the Pascalite IDE Options|Environment window.

On the Compiler tab...

Set the Microcontroller version
Set "Display size" if you are going to be using an LCD module.

On the Communication tab, set the Comm port. (Probably Comm 1 or Comm 2). If you're using a serial mouse, and it goes mad, use the other one!)

On the Editor tab... you don't need to do anything!

Now you need to make Windows settings. Either right click "My Computer", and click on "Properties", or, if you prefer going through the Start Menu: Settings | Control Panel | System | Ports:

The comm port you are plugging the Pascalite into needs the right speed, etc. For my Pascalite PLUS: the following worked: 57600 bits per second, 8 data bits, parity none, stop bits 2, flow control: none. (You may be able to get away with one stop bit, but 2 is safer.)

Have a look in the "Hardware / Software" manual at the end of section 3.1 (pg. 8 in my copy) There is some advice about ASCII values greater than 127 and the possibility of overwriting programs. I haven't yet fully figured this advice out, but I have been happily downloading programs to my Pascalite without incident.

Connect the Pascalite to the development PC with a RS-232 crossover cable. I hope you bought the one Control Plus offers? At that price, why struggle? I'll try to add a pin-out to this page. Write if you want it.
Press f9 to comile your program and send it to the Pascalite. (Or go through the menu: Compile | Sent to Microcontroller. (There's no need to ask the software to compile it before sending... it will do that automatically.)

You should get sensible messages on the screen as things progress.

If you get error messages, don't panic. See "Troubleshooting" in the Hardware/Software manual. Even before you do that, try unplugging the power to the Pascalite briefly and pressing f9 again. (Sometimes the communication between the devices doesn't sync right the first time.)

Hopefully, you will eventually see: "File IntTut1.pas is downloaded successful" and three buttons. Click on start. You won't see anything wonderful yet.

Connect an LED to a resistor. I used a 1K2 resistor with a green LED. (It was a bit too big, the LED is faint. But it keeps the drain on my battery to a minimum, and it was what I had to hand! You can use other color LEDs and, within reason, other resistor values. (I may add details later). For this next thing, you don't need to do a "proper" connection... just be careful not to short any pins!!: Try your LED + resistor between GND and 5v (Pins 25 and 11 of the 2 x 13 pin header.) If the LED glows, good. If not, try turning your LED + resistor around the other way. It won't matter if you attached it backwards. It doesn't matter which side of the LED the resistor is on, but it DOES matter that the resistor is in series with the LED. I.e.: GND - resistor - LED - 5v, or GND - LED - resistor - 5v.

NB: The pages in the manual giving which-pins-connect-to-what-signal are easy to confuse, and the connections for a Pascalite Pro are NOT the same as for a Plus. Once you have the right page....

When you know which way 'round your LED + resistor works, attach the end that was connected to ground to d0 (Pascalite Plus: pins 19 & 20), and the other end to GND (zero volts). (Pascalite Plus: pins 25 & 26)


Now you should see the LED winking on / off / on / off ! ! (On time: about a fifth of a second. Also off time.)

If you have any doubts about why the program does what it does, try to change it to give an on time of half a second (delay(500)) and an off time of a tenth of a seond. You can do it!

I lied. (Above). You could probably get away with connecting the LED between d0 and GND, without the resistor. The reason? The Pascalite has resistors between the pins on the chip and the pins on the 2x13 connector. That is part of the reason that my "reasonable" 1K2 current limiting resistor was too big. So FOR A PASCALITE: you can get away with "no" (extra) resistor, if the onboard resistor is big enough for your needs. Don't think that in general you can attach LEDs without current limiting resistors.

Moving on....

Remove the power from the Pascalite.

Connect a momentary switch to d4. Connect the other side of the switch to GND. Also connect d4 to an 18K resistor. (Other values would do... c. 5k minimum, 50k max). Connect the other side of the resistor to 5v.

(NOTE TO MYSELF: SORT OUT "extra" resistors on Pascalite)

Now write, compile, and download the following:

program IntTut2;
var bInp:byte;
read(portd, bInp);
if (bInp and 16)=16 then reset(d0) else set(d0);
until 4=5;
Press the switch and the LED goes on; release switch and LED goes off.

read(portd,bInp) fills the variable bInp with 1s and zeros depending on what is connected to d0,d1,d2...d7. Even though you can write to a single bit, you have to read all 8 bits to find out what is in any of them. (Note that the pins are numbered from zero. The first pin is "d0".)

"bInp and 16" returns either 0001000 (binary... which equals 16), or 00000000, depending on what was in the 5th bit of bInp, which, after read(portd, bInp) will in turn depend on what the voltage of pin d4 was.

To search THIS site.... (Go to the site's above, and use their search buttons if you want to seach them.)... Way to search this site without using forms
Search this site or the web powered by FreeFind

Site search Web search

Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows pc) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!
Click here to visit editor's freeware, shareware page.

Link to editor's (Arunet) homepage
Link to editor's Sheepdog Software ™ page
How to email or write this page's editor, Tom Boyd