WinPic

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.

Winpic_main

 

2. Code: Here we switch to the window witch show code in hex .

winpic_code

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.

winp_dewice

 

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)

winpi_options
It’s obligatory  to check a option of setting programmable tension of 13V om MCLR pin.Other settings i have lived as default.

8 Interface

winpic_interface

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.

winpic_mesage

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.

winpic_new_code

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.

winpic_download

If programing is seceded we get the message  from the point 2 on the bottom of the next illustration.

MpLab

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.

MpLab_new

 

After that you must click on view> project to see the project window and to add the working window for program writing..

Mplab_add_files_select

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.

Mplab_start_template
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.
mplab_ledon_code

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
Mnemonic Description
NOP No operation
OPTION Load OPTION register with contents of W
SLEEP Go into standby mode
CLRWDT Reset watchdog timer
TRIS f Move W to port control register (f=1..3)
MOVWF f Move W to f
CLRW Clear W to 0 (a.k.a CLR x,W)
CLRF f Clear f to 0 (a.k.a. CLR f,F)
SUBWF f,d Subtract W from f (d = f − W)
DECF f,d Decrement f (d = f − 1)
IORWF f,d Inclusive OR W with F (d = f OR W)
ANDWF f,d AND W with F (d = f AND W)
XORWF f,d Exclusive OR W with F (d = f XOR W)
ADDWF f,d Add W with F (d = f + W)
MOVF f,d Move F (d = f)
COMF f,d Complement f (d = NOT f)
INCF f,d Increment f (d = f + 1)
DECFSZ f,d Decrement f (d = f − 1) and skip if zero
RRF f,d Rotate right F (rotate right through carry)
RLF f,d Rotate left F (rotate left through carry)
SWAPF f,d Swap 4-bit halves of f (d = f<<4 | f>>4)
INCFSZ f,d Increment f (d = f + 1) and skip if zero
BCF f,b Bit clear f (Clear bit b of f)
BSF f,b Bit set f (Set bit b of f)
BTFSC f,b Bit test f, skip if clear (Test bit b of f)
BTFSS f,b Bit test f, skip if set (Test bit b of f)
RETLW k Set W to k and return
CALL k Save return address, load PC with k
GOTO k Jump to address k (9 bits!)
MOVLW k Move literal to W (W = k)
IORLW k Inclusive or literal with W (W = k OR W)
ANDLW k AND literal with W (W = k AND W)
XORLW k Exclusive or literal with W (W = k XOR W)

 

One led on

You will get the all information about Pic on Michrochip page and in the datasheet for 18f4455.

Illustration about system components:

Nova Bitna slika

Nova Bitna slika

To light one LED on ledShemaPic

 

 

on  MCU  you must do next steps. At first you have to connect hardware elements to MCU

esentialShemaPIC to provide base for work.

And then you may write (MpLab)  and insert (WinPic) program code in it.

 

Introduction

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.

 

Click on photo to redirect to Web page

Forum Recent Replies

Google Analytics Stats

generated by GADWP