WinPic is software tool for inserting programs into mcu.
You may download it at next page.
Lets start with explanations of icons in main window:
3. Open hex file: shows the window for selecting of Hex file (hex code).
4. Program device: her we start downlouding of the program to MCU.
5. Verify device: WinPic offers as possibility to check if the MCU is ok.
6. Read device: And we can also read existent program from MCU.
2. Code: Here we switch to the window witch show code in hex .
1. Device config: In this window is possible to change MCU configuration. I leave this window unchanged an i make settings in start start of the code.Here i just select the MCU.
7 Options : Here we must show to the WinPic in which file is initializiation for MCU. We can get it into Device file in installaton packet MpLab software.
(C:\Program Files\Microchip\MPLAB IDE\Device)
It’s obligatory to check a option of setting programmable tension of 13V om MCLR pin.Other settings i have lived as default.
In this window programator kind is selected and on which port it will be connected.for transferring of the program to the MCU. It offers as also option of testing of all three lines which we use for programing. This are: programing tension (13V), clock pulse and program line.
9. Mesagges: WinPic has also window where it writes all data about current processes.
And now demonstration how new program is transfered:
1.When we choose icon which is on the illustration marked like point 1, Open hex file we get window Load hex file.
2-.Under point 2 the program selecting is illustrated
3.Then we have to click on Open as it shows point 3.
·Downloading of program is activated by clicking on Program device icon.
If programing is seceded we get the message from the point 2 on the bottom of the next illustration.
At first download MpLab on the botom of next page.
It is Integrated Development Environment (IDE). In simple words: software tool for writing and debugging programs for Pic MCU.
MPLAB Integrated Development Environment (IDE) is free development tool for writing program code for Michrochip MCU in assembler language.. It’s simple for use and it includes debugging.And it also ofers upgrade for “c” language with limited code size and MCU simulator. In simple word Mp Lab compiles over code into hey file.
Lets go to writing of code . At first you must create new project and save it to the specific folder by clicking on project> new.
After that you must click on view> project to see the project window and to add the working window for program writing..
It is the project source file made by notepad text editor. File must have .asm file extension name. Yes at first you create normal Notepad document and then you change file name to asm.This one has only the configurations bits for my MCu. It could be blank But in this way i made my template of configuration bits.
Once it is inserted into MpLab IDE then we continue to write program in it.
In this way you will make your work surface. As i have mentioned before. With it you have basis for further program writing and from it then hex document will be created.
I have to comment that this was my way of working and i do not know other way, but i believe that other ways of proceeding exist. Ok, I’m saying it for third time: in the same page i have then continued wit program writing which i have
equip it with program comments. Here i will write just some specifications for program understanding and syntax illustration of assembler language.
First line of a code in picture below is the last line of one picture before. here you may see how i continue writing code from my template asm file which i have added to the project before as template. The variable definitions follows. Then i start with program.
Here is code to switch led on on 7. pin of port d.
Here i will get some freedom to to express my opinion what implementation of program should be. From my point of view it is serial jumping between memory cells and changing it’s content in base of specific needs. Now i may conclude this explanation with compiling of program. It is executed by clicking on Build all icon.
12-bit PIC instruction set
||Load OPTION register with contents of W
||Go into standby mode
||Reset watchdog timer
||Move W to port control register (f=1..3)
||Move W to f
||Clear W to 0 (a.k.a CLR x,W)
||Clear f to 0 (a.k.a. CLR f,F)
||Subtract W from f (d = f − W)
||Decrement f (d = f − 1)
||Inclusive OR W with F (d = f OR W)
||AND W with F (d = f AND W)
||Exclusive OR W with F (d = f XOR W)
||Add W with F (d = f + W)
||Move F (d = f)
||Complement f (d = NOT f)
||Increment f (d = f + 1)
||Decrement f (d = f − 1) and skip if zero
||Rotate right F (rotate right through carry)
||Rotate left F (rotate left through carry)
||Swap 4-bit halves of f (d = f<<4 | f>>4)
||Increment f (d = f + 1) and skip if zero
||Bit clear f (Clear bit b of f)
||Bit set f (Set bit b of f)
||Bit test f, skip if clear (Test bit b of f)
||Bit test f, skip if set (Test bit b of f)
||Set W to k and return
||Save return address, load PC with k
||Jump to address k (9 bits!)
||Move literal to W (W = k)
||Inclusive or literal with W (W = k OR W)
||AND literal with W (W = k AND W)
||Exclusive or literal with W (W = k XOR W)
You will get the all information about Pic on Michrochip page and in the datasheet for 18f4455.
Illustration about system components:
To light one LED on
on MCU you must do next steps. At first you have to connect hardware elements to MCU
to provide base for work.
And then you may write (MpLab) and insert (WinPic) program code in it.
This page will give instructions for beginners in microcontroler use with examples on Pic MCU .
At first you will learn on an code example application to switch one led on.
For that you will need to connect MCU to electric supply and essential electronic to make him alive.
Then you well proceed with building of programmator hardware
and learn how to use software to write and debug programs.
And at final how to put program into MCU with programing software.
Also you will improving you knowledge with A/D conversion of an analog input, making of PWM generator
and at list you will get instructions how to communicate (RS232) with PC.
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals.