2017年4月30日 星期日

8051 - MCU 8051 IDE Development Environment (English)

We will start to install MCU 8051 IDE on Ubuntu 14.04. You can use VirtualBox to install and run Ubuntu 14.04 so that you can use Windows and Ubuntu at the same time.

Download MCU 8051 IDE

Official website: http://www.moravia-microsystems.com/mcu-8051-ide/

Click [Download] -> [mcu8051ide] -> [mcu8051ide] -> [1.4.10] -> [mcu8051ide-1.4.10-all.deb]

Install MCU 8051 IDE

Double click on the executable file to start the installation.

Click the Install button.

Finished the installation.

Create a project

Click [Project] -> [New] to create a DancingLEDs project.

I use STC89C52RC microcontroller whcih is developed by STC company and compatible with ATMEL AT89C52RC, so select Type as AT89C52RC.

Create a file and save the following simple example as dancing_leds.asm.

        ORG     00H
        MOV     A, #07FH
LLOOP:  MOV     P2, A
        CALL    DELAY
        RL      A
        JB      A.7, LLOOP
RLOOP:  MOV     P2, A
        CALL    DELAY
        RR      A
        JB      A.0, RLOOP
        SJMP    LLOOP
DELAY:  MOV     R6, #255
DLY1:   MOV     R7, #255
DLY2:   DJNZ    R7, DLY2
        DJNZ    R6, DLY1
        RET
        END

Compile assembly code

Click [Tools] -> [Compile] to compile.

Generate the dancing_leds.hex file after compiling.

Program dancing_leds.hex into STC89C52RC microcontroller.

Before programming dancing_leds.hex into STC89C52RC, you must replace all LF with CRLF. Otherwise, there will be problems after programming STC89C52RC.

Click [Edit] -> [Convert to Windows Format] to convert Unix newline to Windows newline.

The following is an 8051 programmer I use.

I use the following programmer software provided by STC official website to program dancing_leds.hex into STC89C52RC microcontroller. You can download here but it is a Chinese version. I cannot find a English version and support STC89C52RC microcontroller.

Click [Open file] and then select the dancing_leds.hex file.

Select the MCU type (1), and then configure the COM port (2), and then click Download (3). You will see the programmer waiting (4). It is connecting to MCU.

You will see that the programmer shows "Power on" message.

Now power on the board. You will see the program getting downloaded.

Finished programming a MCU.

Demo

沒有留言: