From the Silicon Laboratories page download SILICON LABS IDE. It is a classical design suite for 8051 chips requiring modest space on your windows computer. Look for the mcu_ide.exe installer file.
Advanced hacksters should also download and install the limited Keil compiler and the Flash Programming Utilities programs.You have to install a C compiler for 8051 chips on your computer. This project uses Small Device C Compiler on Windows.
For more information, read the original AN198 Application Note from Silicon Laboratories.
New Project WorkspaceCreate a new project and save to a workspace in your documents folder. Choose helpful names for locations and workspace.
Choose any name you want. Make sure the program adds the file to the project.
Paste this code into the file. Save. An asterisk* shows whether the file is saved.
#include <8051.h>
void DELAY(int count);
int main() {
while(1)
{ P1++; P2--; P3++; P0++; DELAY(30000);}}
void DELAY(int count)
{ int i; for(i=0; i<count; i++){ ; }}
The screen should look like this.
Silicon Laboratories IDE is ready for several toolchains. Go to Menu->Project->Toolchain Integration.
Use the pulldown menu to select sdcc3.x(read-only). It has old default applications and locations that we will change. Save as sdcc4 for the new values.
Click Assembler Tab. Make sure Executable is C:\Program Files(x86)\SDCC\bin\sdas8051.exe. Command line flags stay the same.
Browse lets you locate the assembler in the folder. See the other MCUs? Notice each has its own sdas assembler program.
Click Compiler Tab. Executable set to C:\Program Files(x86)\SDCC\bin\sdcc.exe. Browse may be easier. Change the included header file to C:\Program Files(x86)\SDCC\include. Notice the quote marks.
These header files provide definitions of the chips and features. You can view and edit them with notepad.
Click Linker Tab. Change Executable to C:\Program Files(x86)\SDCC\bin\sdcc.exe to link for our 8051 project. Command line flags remain the same.
Menu Project->Target Build Configuration to set up our output file.
Default is to build an OMF file which is an executable with debug information. We want a hex file output. Tick the Generate hex file box and browse to C:\Program Files(x86)\SDCC\bin\packihx.exe.
Menu Project->Build/Make Project. Rebuild Project to clean and build again.
Don't worry about it. We generated a whole bunch of files that look good.
Read the Build message text generated during our compile. This is a successful build.
This simulator runs blinky from our compiled executable. That is a good sign.
Perhaps you have a compatible flash programmer device? Silicon Laboratories Flash Utility works with serial interface and some USB programmers.
Comments
Please log in or sign up to comment.