Saturday, September 25, 2010

Great Cow Basic (GCBASIC) installation guide

After struggling to install GCBasic for few days finally I make it. I had installed two version of GCBasic. The versions are Version 24/2/2007 and 6/2/2010. You can download it at http://gcbasic.sourceforge.net/download.html.

These two versions give different resulted. I prefer to use version 6/2/2010 because it give satisfying resulted. However I make an adjustment to gcbasic.ini. For the version 24/2/2007 I think the gputils was outdated. If you want to use it make sure you download GCBASIC minimal 0903.exe and download the latest gputils.

In this post I only focus to version 6/2/2010. The adjustment gcbasic.ini is the assembler path. I used MPWINASM to compile the program. Luckily I already have MPASM which is I did installed the Proteus software before. It will produce asm file, hex file and lst file when you compile your program. However you can use either MPASM or GPASM to compile your program.


The gcbasic.ini adjustment
Prior to use GCBasic you must make sure that gcbacic.ini correctly modifies. At your GCBasic folder you can edit sample gcbasic.ini file in notepad. Prior to that makes sure rename the file to gcbasic.ini. Then open it using notepad to modify.








Observe the red underline as picture above (Please click picture to enlarge). I rewrite the assembler path to my Proteus path so that I can access my MPASM in Proteus without to install twice.

First program
After the gcbasic.ini correctly setup, it is time to test the software. The test can be performing by programming GCBASIC first. In this example I write a program to ON a led in pin 0 of port B. I use PIC16F84A with clock of 4 MHz.

'A program to ON a  LEDs on PORTB,

'Chip model
#chip 16F84a, 4

'Set the pin directions
dir PORTB.0 out

'Main routine
Start:

 'Turn one LED on, the other off
 SET PORTB.0 ON

goto Start

 Copy the program above into your notepad and save it to test.txt. I suggest that the file is place on your desktop (only for this tutorial). Open your GCBasic folder, usually c:\program files\Great Cow BASIC.

In this folder you will see gcbasic.exe file. Drag your test.txt file at your desktop onto gcbasic.exe. After that your test.txt will compile and it will automatically created new files. It will produce compiled.asm, compiled.hex and compiled.lst.

Use compiled.hex to programmer into your PIC16F84a. I consider that you already know how to programmer the PIC. If don’t know… please google…

However for this program I not try in real PIC. I just use Proteus to simulate the program. Below is the circuit diagram for this program. Good luck.


No comments:

Post a Comment