M. Amer Iqbal Qureshi



tải về 3.06 Mb.
Chế độ xem pdf
trang132/132
Chuyển đổi dữ liệu09.12.2022
Kích3.06 Mb.
#53945
1   ...   124   125   126   127   128   129   130   131   132
Amer Iqbal - Teach Yourself PIC Microcontrollers for Absolute Beginners-Microtronics Pakistan (2001)

Boot Loader 
Boot loader is a piece of software required to use this technology. It has two components, a firmware that 
resides in your microcontroller and a client program that is installed on your PC. The firmware has to be 
compiled for your particular microcontroller, and the board clock speed. This is a small program, that first 
needs to be uploaded into your microcontroller using a standard programmer. After it is loaded, you do not 
need programmer, unless accidently the firmware in PIC is deleted. 
The other part of boot-loader is installed on your PC, and it accepts the .hex file to be uploaded, which is 
the software the microcontroller is supposed to execute. Your board must be connected to the serial port of 
your computer, and on PIC Lab-II LED Dip Switch SW1 should be off as LEDs interfere with serial com-
munication. 
Now when you press the reset button on PIC Lab-II, or when the power is turned on, the control is first 
transferred to boot loader software in microcontroller, this software, which is loaded in the high memory of 
program area, monitors the serial port if the PC is sending a new software or not. If there is nothing new, 
the boot loader hands over control to the already existing software in microcontroller, which starts function-
ing whatever it is supposed to do. However if a new program is coming the existing program, (leaving boot 
loader) is erased and new program is written into program memory. After that control is transferred to new 
program. This process does not require 12V on MCLR. 
Where to get Boot Loader? 
A large number of companies including microchip is offering the boot loader program, however we have 
found a free to download and very versatile software, called Tiny Boot Loader. This software is included on 
the accompanying CD. The software will consist of pre-compiled hex files for PIC Lab-II board, named as 
PIC18F452_20.hex this is for 18F452 microcontroller, running at 20MHz. The software also contains 
source files, which can be modified for your particular microcontroller if required. 
To load this file into your microcontroller, attach your programmer to the motherboard, and run ICPROG 
locate the relevant hex file in boot loader folder, and transfer it into your microcontroller. That is all that is 
required. Now disconnect the programmer, and connect the serial cable to your computer and PIC Lab-II. 
You will notice an executable application in boot loader folder, TinyBldwin.exe just double click it. Select 
the speed as 115200 (maximum speed) and select your Com Port. Browse the .hex file, you want to run, 
like blink.hex its name and path will appear in the drop-down list box. Unlike ICPROG program code etc 
will not be displayed. Now make sure your Serial port is available, LEDs on PIC Lab-II are disabled. Power 
the PIC Lab-II on, and press the reset button, immediately press ‘W’ on your PC to write the program. The 
Microchip® Self-Programming 
Boot-Loader


Teach Yourself PIC Microcontrollers | www.electronicspk.com | 146 
new software will be transferred into your microcontroller. And start running. If you want to enable LEDs 
now you can do so. Now if you want to update the software, like you have made a few changes, in source 
file and compiled to get new hex file, if file name has not been changed, just open the TinyBldWin.exe, 
press reset on PIC Lab-II and immediately (within 10 sec) press ‘W’ on PC, the new program will be up-
dated. 

tải về 3.06 Mb.

Chia sẻ với bạn bè của bạn:
1   ...   124   125   126   127   128   129   130   131   132




Cơ sở dữ liệu được bảo vệ bởi bản quyền ©hocday.com 2024
được sử dụng cho việc quản lý

    Quê hương