Intel 8051 Core

Absolutely Beginners:  Hey 8051 Starters,  Welcome to 1diySHARE 8051 page to know and learn the Intel 8051 core.   I made a video for absolutely Starters,  please watch it to know the history, evolution and why it is called the “8051 core – the most popular MCU in the world.

** you might like to subscribe to  my youtube channel to see more of my videos and future video

Are you in:  Ok! Let’s start without a  hardware, all you have to do is by Simulating Programs,  it means, running a program only on your Computer to see a quick result of your program —– it is like,  you are running a hardware in your PC.   Later,  you will be running your program in the real world hardware to see a real-world response.

The things you need is :

  1. go to Mark Alberts website and download his demo BASCOM 8051 IDE
  2. Uncompress the file and install into your PC as a normal Windows installation, you may refer to the Installation guide if needed which is in-package to the downloaded file.   Please note that this is a demo version for your trial, really good enough to write a small program.
  3. Follow the instruction below to write your very first 8051 Program using Basic

 

First Program, Saving, Simulating, Observed Response:  

1) Open BASCOM 8051:  for the first time as shown below

2) New File:   Press CTRL + N,  will create a new file with name “Noname”, you are now in the Editor Window

3) Write the Instruction:  Write the following BASIC instructions into the Editor Windows as follows :

BlinkLED:

P1.0 = 1
Waitms 10
P1.0 = 0
Waitms 10
Goto BlinkLED

end

 

4) Saving file: Save the file into your Program directory as :    Program1 – bascom-blink-LED

5)  Compiling: Press F7  or   Click Program–> Compile, this will transform your BAS file into HEX file / BIN File, see your HDD directory and you will see several files added to the Pragram1 – bascom-blink-LED.BAS

6)  Run the Simulator:  Press F2  or  Click Program –> Simulate and the Simulator window will pop-up

Click the LCD icon

and, the Hardware Emulation will appear

Now,  pay attention to the Port Arrays,  this is like LED and they represent the 32 I/O of the 40 pins 8051 MCU.

Pay attention to the P1.0 port which is located here

Click the Play icon

Observed the P1.0 LED,  you will see that it is changing color (how fast to change color will depend on your PC speed).  You will see also that the program tracer on the left side of the simulator is running on each of the instructions.

 

Congratulations!!!  You made it — easy, right!

 

 

Modification & Tweaking Program: 

You might notice that the P1.0 port changing its color “fast or slow”  (depending on your PC speed),  so,  lets optimized this by finding the right “blinking rate”.

  1. Modify the Instruction:  go back to the Editor window and changed the instruction

Waitms 10    and change   Waitms 50

like the code below now

BlinkLED:

     P1.0 = 1
     Waitms 50
     P1.0 = 0
     Waitms 50
Goto BlinkLED

end

 

2)  Compile it,  Open the Simulator then Run the Simulator

3)  Observed the P1.0 port, the blinking rate will be slower.

4)  You can optimize your preferred blinking rate, increasing or decreasing the “time” in the instruction Waims 50.

 

Exploring the Simulator Execution Options: 

When you run the Simulator,  you used the PLAY icon which will run the program automatically in fast execution, like playing a DVD movie on the DVD player.   You can actually control and see how the program executed at your finger-click with the

  • Step into code
  • Step Over (Gosub /  Call)

 

Explore it to know more how the program is executed while observing its response.

 

Happy Programming!

 

Next :  Blink the LED in Real-world Hardware