Thursday, December 25, 2008

Run your first PIC16F84A program on simulator

You can start to test the PIC16F84A flasher program on the simulator.

The simulator is a program that simulates Microcontroller code execution and other electronic component behavior.

One good simulator I 've tried and I recommend is Labcenter Proteus 7.

You can install it and try the hardware components and software program and debug them for run-time errors and functioning errors. All this before building the real-world application on the board. This approach is very useful and can reduce developing time and frustration and eliminate situations such as you connect the circuit and get no action at all. You then wonder
what 's wrong. And you can get lost debugging hardware and software and don 't know where to
start from.

This introduction is to show the advantages of using the simulator before building your circuit board.

Let 's get started ..........

1- Install the simulator ( Labcenter Proteus 7 ).

2- Run the program ISIS.

3- Draw the components of the flasher application as in this screen-shot.

4- After you copy the code from the previous post into a file named Flasher.ASM, add the source

file as follows ;

- From the source menu , select Define Code Generation Tools ...

- Choose the MPASMWIN from the scroll menu as the screen-shot,

- Add the source form the source menu --- > Add/Remove Source files ...

and choose the code generation tools MPASMWIN and the source file Flasher.ASM

Now you have successfully configured the source file and code generation tools for code


5- You can now compile the program by choosing the Source menu ---> Build All .

If every thing goes right, you should get the screen

6- You will notice that a Flaher.HEX file has been generated in the working folder.

7- Now double-click on the PIC16F84A component in your design , you get the window,

Choose the Flasher.HEX and set the Processor Clock Frequency to 4MHz.

8- Now press the play button to start debugging and running the program.

Now , you see the led flashing . Congratulations !!! The program is running.

We can start to build our first real-wold circuit....

If you like this blog you can support us by many ways:
   1. Leave comments stating your point of view about this article.

   2. Buy our book on Amazon Learn By Making.

   3. Click on links of our sponsors without adding any extra cost on you if you make purchase from them. Actually, many of these offers are totally free.
  4. Visit our new website

Thank you for visiting our blog.


A Abu-Ghazala said...

Hello World

I was wondering where could I find a PIC microcontroller in Egypt ( RadioShack or El-Nekhely), because I am starting in the field of robotics and I want to try with a microcontroller before I start designing my own.
Thank You

MicroMonitor said...

السلام عليكم و رحمة الله و بركاته
يمكنك شراء
PIC Microcontroller
من النخيلى و الجمال أرخص من
RadioShack and Ram
وبصفة عامة محلات باب اللوق بالتحرير
كما يمكنك تجربة الدائرة على
قبل بنائها فعلياً

You can buy PIC Microcontroller from Gammal and El-Nekhely and Ram.
You can try your circuit on Proteus 7 simulator before building the real circuit board.