Skip to content

This repository will help you to program 8051 microcontroller in Linux. More specifically, it is only for the AT89S52 microcontroller.

Notifications You must be signed in to change notification settings

IAMSTANDARD/how_to_program_8051_microcontroller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

How to program the 8051 microcontroller, (AT89S52)


Hardware Requirements

So first off, lets meet the hardware requirements to see whether we have everything required for programming or not. For pogramming the 8051 microcontroller in serial mode. You will need

  • The microcontroller in it's working state or a development board. (with crystal and all the required circuitry)

- A USBASP device, capable of programming.

- A six wire cable, for connecting the USBASP and the microcontroller board together.

- And of course, we also need an USB cable for connecting the microcontroller board and USBASP together.

- And don't forget to power the microcontroller, with a power brick. In some devices, you can even power them with the USBASP. But don't use the USBASP power to run your other hardware. Only use power from your usb port to program the microcontroller.

Post Configuration

  • First, configure the avrdude, to be able to program at89s52 and at89s51 microcontroller. For that follow the instructions from this website.
  • Once that is done the avrdude is ready to be used for programming. You have to repeat this step on any new computer. But once completed, you don't have to do it twice.

Project Setup

Now you need to be able to write software as well right? Well follow the advice and steps from below.

  • Create an empty folder for your project files. Now create a "main.c" file.
  • Any library that you use should be in the same folder in the main or some separate directory. The library file should be ".h" file. And that is mostly it. You may also need to create a make file, But I don't know how to do that yet.

Programming the Microcontroller

  • Open a terminal in the directory, your project resides in.
  • In the terminal, type
sdcc <name of your main file>

And the project will be compiled.

  • Now in the same terminal type out this final command to burn the code into the microcontroller using avrdude.
sudo avrdude -p 8052 -c usbasp -e -U flash:w:'./main.ihx'

About

This repository will help you to program 8051 microcontroller in Linux. More specifically, it is only for the AT89S52 microcontroller.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published