Microcontroller Simulation Project with Proteus for beginners

In this Microcontroller Simulation Project with Proteus for beginners tutorial, we will shows you how to write program in assembly language for PIC16F84A microcontroller that turns on a single LED in Proteus.

But first, if you liked Proteus, check out our other Proteus tutorial such as AM Circuit Design using Proteus and Testing Arduino circuit and program using Proteus.

Now let start the Microcontroller Simulation Project in Proteus.

Creating a project in Proteus is very easy for beginners. After you have the software open, click on the New Project. Then create a new project in Proteus by providing some project name and save it to some folder. An example is shown below

Click Next. We require a schematic so select Create a schematic from the selected template and choose default or any size you want.

Click Next. We do not require a PCB so select Do not create a PCB layout and click next again.

We do require a Firmware so select Create a Firmware Project and select PIC16 as Family, PIC16F84A as Controller, MPASM(MPLAB) as the Compiler.

Clicking next will bring up the source code editor window and the schematic window. Go to the Schematic and add the following components-

  • 9C04021A3300FLHF3 (330ohm resistor)
  • 9C08052A1002JLHFT (10K ohm resistor)
  • CRYSTAL
  • LED-GREEN

The PIC16F84A micro-controller is already added so no need to add that part.

Draw the schematic as shown-

 

Click on the VCC power and change it to +5V

Programming

Now switch over to the Source Code by clicking on the Source Code tab. The Source code editor shows a default template. Delete the template code and Copy the following code below into it.

This is as shown.

Code Explanation

The part “processor 16f84A” tells which microcontroller is being used. The “include <p16f84A.inc>” part is a directive that tell to use the p16f84A microcontroller include file. The __config directive specifies various configuration aspect of the microcontroller such as the type of the oscillator, whether watch dog timer is on or off, whether the Power-Up timer is on or off and code protection is on/off. Then Org 0 tells the assembler to assemble all subsequent code starting at address 0. The next instruction it reads is the main so the program control goes to main. The instruction movlw B’00000000′ tells to load working register with 000000000. The instruction tris PORTB tells to make the Port B direction as output. Then the sequence of instruction movlw B’00000001′ and movwf PORTB directs to turn on the line 0 of the Port B.

After you have written the code, go to Build>Build Project or click on the Build icon in the toolbar.

Go back to the Schematic and click on the PIC16F84A to open its properties. Check that the debug.cof is selected as this is the file that will be used for simulation of the microcontroller.

Go back to the Schematic and click on the PIC16F84A to open its properties. Check that the debug.cof is selected as this is the file that will be used for simulation of the microcontroller.

Click OK and go back to the schematic and run the simulation.

That’s it. The LED is now turned on.

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Leave a Reply

Your email address will not be published. Required fields are marked *

AM Circuit Design using Proteus

AM Circuit Design using Proteus

Robot Motor control using Arduino

Robot Motor control using Arduino