PDA

View Full Version : load .hex file in PIC with hyperterminal



irenuska23
- 31st August 2009, 10:08
Hi all!!

I am doing a project with PIC16F874. I have the .asm code, and I have create a project with MPLAB. Then, I have built it successfully and i have generated the .hex file!!

So, now, I need to load this .hex file in the PIC. I want to do it using the hyperterminal because i haven't any bootloader.

I have configure hyperterminal with 9600bps, 8 - N - 1. then I connect the pic to the pc with a RS232 wire and then i turn on the pic. So, the hyperterminal shows the last program loaded and that the pic has jumped to the code.

In order to load my file, i try to transfer the file, but it doesnt go!

Can you help me, please??

Acetronics2
- 31st August 2009, 10:15
Hi,

No luck in this way !!!

You do need a programmer in all cases ...

- You program a boot loader WITH the Programmer ... then you use Hyperterm, i.e.

OR

- You program your chip with the programmer.

in both cases you DO need a programmer !!!

Have a look to the cost of a PicKit2 ... and do not hesitate !!!


OR you can try PICAXE Chips ... that have a pre-programmed bootloader ( sort of ! )

Alain

irenuska23
- 31st August 2009, 10:19
Thanks a lot Acetronics!!!

what do you mean with "programmer". I have used the MPLAB IDE.


You program a boot loader WITH the Programmer ... then you use Hyperterm, i.e.


How do i program the boot loader?? and how do i use the hyperterminal??

mackrackit
- 31st August 2009, 10:42
MPLAB is an IDE. It is a place to write the code.

When the code is made into a HEX file a compiler is used, MPASM is the one MPLAB uses.

A programmer is hardware to place the code on the chip. Certain voltage levels have to be met on certain pins for the chip to accept the file.

Like Alan said, look at the PicKit2. Very nice.
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805

irenuska23
- 31st August 2009, 11:41
Thanks mackrackit.

i understand it, but i have in the board an integrated circuit to implement it. This is: the MAX232, and then i have configured ports number 6 and 7 as input and output.

with this, i suppose that i can communicate the pic with the pc to load the hex file...

but how do i do this?

aratti
- 31st August 2009, 12:39
Read How easily to build your own programmer @ this link:
http://www.rentron.com/Myke4.htm

This will help you in understanding the programmer subject.

Al.

mackrackit
- 31st August 2009, 14:57
Thanks mackrackit.

i understand it, but i have in the board an integrated circuit to implement it. This is: the MAX232, and then i have configured ports number 6 and 7 as input and output.

with this, i suppose that i can communicate the pic with the pc to load the hex file...

but how do i do this?
You have two pins on the pic labeled PGD and PGC, these are the pins the programmer uses to communicate with the chip. If these are the pins the 232 is connected to you are probably OK. You will need to "bug in" a connection of some kind between the PIC and the 232 to go to the programmer.

The other pin used by the programmer is labeled MCLR. It is best not to have this pin connected to anything during programming. If it is connected to something it will need to be isolated with a diode. Higher voltage is applied to this pin to place the PIC in programming mode.

So what you have is not going to work to get the first program into the chip as Alan mentioned. It might work after a boot loader is used.

Read the link Al provided but I do not recommend building one. Unless you are wanting to build programmers. If you want to write code and program a chip then buy a programmer.

Beware of the ebay stuff though. The money you save will be made up for in time and headaches.

irenuska23
- 1st September 2009, 09:29
thanks a lot to everybody!!

finally, i have achieved it!! mackrackit, your explanation has been very useful because now i have a better idea of how the pic works.

i must say that the pic i am using has been programmed before, so it has installed the boot loader inside. I haven't done it, my colleage did some months ago!. so, now, with the hyperterminal i can load new versions of the code!!

mackrackit
- 1st September 2009, 09:52
thanks a lot to everybody!!

finally, i have achieved it!! mackrackit, your explanation has been very useful because now i have a better idea of how the pic works.

i must say that the pic i am using has been programmed before, so it has installed the boot loader inside. I haven't done it, my colleage did some months ago!. so, now, with the hyperterminal i can load new versions of the code!!
COOL!!!! :D
Have fun!