Begin with SDCC Small Device C Compiler on Windows to setup your computer. We will use the same main.c sample code that toggles the output pins of Ports A to D with a delay. On SimulIDE we will use a simulated 8051 microcontroller.
main.c// sdcc example 8051 chip
#include <reg51.h>
void DELAY_ms(unsigned int ms_Count)
{
unsigned int i,j;
for(i=0;i<ms_Count;i++)
{
for(j=0;j<1000;j++);
}
}
int main()
{
while(1)
{
P0 = 0xff; /* Turn ON all the leds connected to Ports */
P1 = 0xff;
P2 = 0xff;
P3 = 0xff;
DELAY_ms(100);
P0 = 0x00; /* Turn OFF all the leds connected to Ports */
P1 = 0x00;
P2 = 0x00;
P3 = 0x00;
DELAY_ms(100);
}
return (0);
}
SimulideFind and open your simulide.exe program. Open the mcs-51_test.sim circuit from the SDCC Small Device C Compiler on Windows project.
Use the File explorer panel on the left Examples/Micro/mcs-51/mcs-51_test and double click or pull mcs-51_test.simu1 onto the screen. The windows adjust with your cursor all the way to the edge.
Code is editted on the right. Hover over the icons in the edit menu. Function names will appear.
Create a new main.c file and save
Open compiler settings, select SDCC. Device is 8051 part of the mcs51 family of microcontrollers. The Tool Path for SDCC and the includes are already known by the operating system. Watch for SDCC Compiler successfully loaded.
Click the check mark to compile SUCCESS!!! Compilation ok
Click the Upload button Mapping Flash to Source...
Click the red ON/OFF button
Click on the Debug button and the menu changes. We can step through our program on the simulator, run, add breakpoints and reset.
Comments
Please log in or sign up to comment.