RIDE compiler is available for free download from: http://support-raisonance.com/extranet/tools/index.php?param=tool__id__6 When you first Run the Ride IDE Package, the screen is normally shown as in
Screen Shot #1:
Screen Shot #1
To start developing a program in ‘C’, follow the steps below:
Step 1: Create The Source File
This is your ‘C’ Code that you want to simulate and hopefully download to the 8051 based microcontroller once the program has been fully tested. Select FILE New.
The response is:
2
Use the mouse pointer to select C Files.
The response is as follows:
The package displays the editor window and it is ready for you to begin typing your program.
3
Type the following program:
/* Tutorial1.c: RC51 Compiler Tutorial Program */
/* By: Saeed - March 2006
*/
#include
#define Lights
#define ON
#define OFF
/* define 8051 registers */
P1
255
0
void Wait(void); void main (void)
{
for(;;)
{
/* Turn All Lights ON */
Lights = ON;
/* Wait for a while */
Wait();
/* Turn All Lights OFF */
Lights = OFF;
/* Wait for a while
*/
Wait();
/* Repeat for ever */
}
}
/* This is a short program that causes the controller to */
/* wait for a while */ void Wait(void)
{
unsigned char i,j; for(i=0; i.
Once you have selected the files, click Open.
8
Compiling the Program
To compile, select Project
Build all
9
The compiler begins translating your program. If you have any errors, the error messages as well as the line number where the error may be will be displayed at the bottom part of the screen. You need to correct the error and recompile the program.
When the program is error free, you should see the following messages:
This indicates that your program has no syntax errors and that the compiler has generated a series of files mainly the assembly version of your program as well as its equivalent HEXADECIMAL version of the program. Visit the folder where your project is saved and check out these files. If your filename is called then, you should see the hex version as : . It is this file that you need
In order to download the program onto the target board.
Before programming the target board, it is advisable to simulate your program to ensure that there are no logical errors. These are errors that the compiler can’t detect. The next section discusses how to start the debugger and single step your program execution.
Using the Ride Debugger
Select Debug
Tutorial1.aof
10
Then the screen displays:
Just click OK. The display shows:
Click OK again. And the previous box will appear again, click OK once again. The screen will change to:
11
Notice the cursor appears as horizontal blue line on the first line in the main program. Before we begin the execution of the program, take a look at the left hand side of the screen. It shows the various utilities which are available in the microcontroller that you have selected. The program uses PORT 1, therefore double click PORT 1 in the peripheral list. The debugger displays the 8-bits of
PORT 1. The status of each bit is shown as green. The numerical value is also shown in hex as (FF) or (255). This means that all the bits in PORT 1 at present are at logic 1.
Adjust and move the port widow and the editor window so that they are not overlapping each other as shown below:
12
The program is