Run your Program in the Real Hardware in the Real world Response

Circuit Diagram:

Let’s run our program into our intended Target Board,  the DR100W_CM module.  Just make it sure you understood well the basic 8051 intro and programming basics.

Let’s use the Port P3.6  (port 3 bit 6) of the 40 pins 8051 MCU to control our LED, it means that, a red LED will be connected to port P3.6 in the “current sink” configuration.

The 8051 core default I/O pin for port 3 is logic high (logic 1) so, the LED1 is initially OFF  (not lighted).  To cause the LED to light (ON),  it needs to instruct the MCU to goes Logic Low (logic 0), you can do that with the instruction :

P3.6 = 0

and the equivalent circuit will be

 

Program to Blink the LED:
Blink_red_LED:

P3.6 = 0
 Waitms 10
 P3.6 = 1
 Waitms 10
 Goto Blink_red_LED

End

Save it as :   Program2 – blink_red_led

 

Simulate the Program:

Simulate the program and pay attention to the P3.6,

 

Let’s make our program readable & Clear :

When we are writing a program, we can easily remember P3.6 is the port to control a red LED, but maybe after a month, we may forget it.  Well, let’s add a comment and a better declaration

'******************************************************************
'Lerning 8051 core MCU
'by F. Dandy
'1diyshare.com
'******************************************************************

' Declaration

led1_red_MCUctrl Alias P3.6
' rename P3.6 into a meaningful understandable port
' as led1_red_MCUctrl

Do

led1_red_MCUctrl = 0   ' command led1_red_MCUctrl port to logic 0
                       ' this will make the LED to light
Waitms 10              ' put a delay so we can see it is lighted

led1_red_MCUctrl = 1   ' command led1_red_MCUctrl port to logic 1
                       ' this will make the LED to turned-off

Waitms 10              ' put a delay so we can see it is turned off

Loop                   ' repeat from the start with DO

End                    ' end of the program

 

 

The Hardware is the DR100W_CM module:

The DR100W_CM module is my target hardware,  this is where I run the sample program discussed above.  click here to know this project  with my introduction on my youtube.com

MCU                 :  STC90C516RD+
Package             :  40 pins DIP
I/O Ports           :  32 I/O
Motherboard         :  DR100W_CM Module

It looks complicated, but just concentrate on the RED LED for now!   We will be going to deal with other hardware you seen in the above photo, soon or ….. later.!

 

 

Downloading the HEX or BIN code into the ROM of 8051 MCU:

There are 2 things to know here :

  1. Hardware to Download the BIN or HEX file, I called it the USB Bridge
  2. Software to drive the USB Bridge,  the STC ISP Software

 

USB Bridge :  This is a USB-to-TTL or sometimes called USB-to-UART hardware, here is the schematic diagram.

 

 

STC ISP Software:  We will be using STC toolchain for downloading the program (burning) – the STC ISP software running on Windows OS (I don’t’  see it can support MAC and Linux OS).  We will use this software because we are using the STC90C516RD+ MCU which is manufactured by STC.

  1. Download this application.
  2. Put into a working directory
  3. Uncompressed the file
  4. Find the STC ISP icon and copy it into your desktop
  5. Run it

If you encountered a problem in running it,  try to solve using Windows support.  I will be adding a Failure Analysis and countermeasure on how to run STC ISP if the problem will be encountered.

…………….. to be continued.   (Plase comeback later.  Thank you)

 

Next :  Backlight Control of 20×4 LCD Module