262 Setting up the Development Environment

Installing the Required Components:

Video of Setting Up and Programming 1st Project

Download and Install Keil uVision
Https://www.keil.com/demo/eval/c51.htm

To Download Hex to Board
You will need to download the program “Silicon Laboratories Flash Utility”

https://www.silabs.com/products/development-tools/software/8-bit-8051-microcontroller-software#flash

Under “Flash Programming Utilities” -> Download Software
It may ask to register
Download, Unzip and install

Testing and Creating 1st project to download to the board

Now Start Up Keil uVision

//Create and setup the uVision Project
Project -> New uVision Project

Device -> EFM8BB10F8G-QSOP24 and leave all settings to default
It will Ask “Copy SILABS_STARTUP.A51 to Project Folder and Add File to Project?” Click Yes

//Setup Output to Generate Hex File and Add Include File Directory to C Compiler
Right-Click Target 1 -> Options for Target

Click “Output” Tab
Check the Box for “Create Hex File”

Click “C51” Tab
In the box for “Include Paths” add:
C:\Keil_v5\C51\INC\SiLABS\shared\si8051Base
Or change the directory if you installed Keil uVision to a different location

Click “OK” at bottom

TEST CODE:
//main.c

#include <SI_EFM8BB1_Register_Enums.h>

void InitDevice(void)
{
//Disable Watchdog Timer
//Disable Watchdog with key sequence
WDTCN = 0xDE; //First key
WDTCN = 0xAD; //Second key
// [WDTCN – Watchdog Timer Control]$

//Setup Defaults for P1
P1MDOUT = P1MDOUT_B0__OPEN_DRAIN | P1MDOUT_B1__OPEN_DRAIN
| P1MDOUT_B2__OPEN_DRAIN | P1MDOUT_B3__OPEN_DRAIN
| P1MDOUT_B4__PUSH_PULL | P1MDOUT_B5__OPEN_DRAIN
| P1MDOUT_B6__OPEN_DRAIN | P1MDOUT_B7__OPEN_DRAIN;

//Enable Weak Pullups
XBR2 = XBR2_WEAKPUD__PULL_UPS_ENABLED | XBR2_XBARE__ENABLED;

//Disable Interrupts
IE = IE_EA__DISABLED | IE_EX0__DISABLED | IE_EX1__DISABLED
| IE_ESPI0__DISABLED | IE_ET0__DISABLED | IE_ET1__DISABLED
| IE_ET2__ENABLED | IE_ES0__DISABLED;

}

main(void)
{
unsigned char x,y;

InitDevice();

while(1) //Infinite while loop, i.e. Superloop
{

P1 = 0x55;

//Busy Wait Delay
for(x = 0; x < 0xFF; x++){
for(y = 0; y < 0x10; y++){
}
}

P1 = 0xAA;

//Busy Wait Delay
for(x = 0; x < 0xFF; x++){
for(y = 0; y < 0x10; y++){
}
}

}
}

 

How to Download Hex File to Development Board

Run the Download Utility “Silicon Laboratories Flash Utility”

We first need to Connect to the board, make sure the board is connected via a micro usb cable.

Click on “Enumerate USB”
Adapter Selection should say LCK0064019 or something similar
Click on the radio button for “USB Debug Adapter”
Click on “Connect”
You should get a dialog box that says “Connected”, Click OK
Click on the Tab “Download Hex File/Go/Stop”
Click on “Browse” under “Download Filename”
Navigate to where you saved your project, go into the “Object” Folder and select the Hex file that was generated by Keil
Click on “Open”

Now Click on “Download”
You should see a message that says “Succeeded Downloading Hex File, Checksum 0xXXXX”
Click on OK
Click on Go to Start Running the Code

You should see a blinking LED on the Board at this point