Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Building/writing programmer for PIC 16F887

Status
Not open for further replies.

Maeki

New Member
Hi All -

I've got a PIC16F887 wired up to a programming circuit with a parallel port interface to a computer running Windows XP.

I've written some basic programming software and a hex -> PIC serial command parser and am 95.01% confident that it's working correctly.

I'm having problems sending the correct sequence of commands to the PIC to be able to read/write program and/or other memory. I believe my attempts to write the Configuration register to disable code protection at 0x2007 have failed.

Does anybody have experience programming this chip manually who would be able to advise/consult me?

This is mainly an exercise for myself to show that I can get this to work (aka 'for fun').
 
You cannot disable code protection by writing to the config locations. The only way to disable code protection is to erase the whole chip.

Mike.
 
Hi All -

I've got a PIC16F887 wired up to a programming circuit with a parallel port interface to a computer running Windows XP.

I've written some basic programming software and a hex -> PIC serial command parser and am 95.01% confident that it's working correctly.

Sorry, but 95.01% confident is no where near close enough - you've got a long way to go.

I'm having problems sending the correct sequence of commands to the PIC to be able to read/write program and/or other memory. I believe my attempts to write the Configuration register to disable code protection at 0x2007 have failed.

As already suggested, you can't disable code protecion (fairly obviously - or it would be of no use), you have to erase the entire device, which removes the code protection as the very last thing it does, when the rest of the chip is wiped.

All the information is in the programming manual for the chip, but it's usually pretty hard to understand, and various ones in the past have contained errors as well - with 'making it up' as the only option :D
 
This is the sequence of events that happens.

1) VDD, VPP, ICSPDAT, ICSPCLK held low.
2) Raise VPP to 11.86V
3) Raise VDD to 4.9V

The chip should be in program/verify mode now. Correct?

4) Issue 16 cycles of ICSPCLK with ICSPDAT high. ~An ICSP "NOOP" to get the line running.
5) Issue "Load Configuration" to move the PC to 0x2000.
6) Issue "Bulk Program Erase" to clear the configuration registers and user memory.
7) Issue 7 or 9 "Increment Address"es to get to the Configuration Register or Calibration Word.
8) Issue "Read Data from Program Memory." This command always reads out zeroes. The manual said that this happens when CP is set.

Am I missing anything?

Also what does it mean when it says the write latches must be reset when programming 0x2000-0x2009? I gather I'm supposed to issue several LDFP commands with all 1s as data, but at what point do I reset the latches?
 
I was playing with a test sequence earlier today, where I write and read back one of the user ID registers.

I found that the register was successfully written to and read from on the third iteration of the following sequence (consistently).

1) Power VPP
2) Power VDD

-- loop begins here.
3) Send No Operation
4) Send Load Configuration
5) Send Bulk Erase Memory
6) Send Load Data for Program Memory
7) Send Begin Programming (Internally Timed)
8) Send Read Data from Program Memory
--- loop ends here.

Every 3rd iteration of the loop, line 8 will successfully read out the value I had written to the Flash.

However if I power down the chip and bring it back into program/verify mode and execute the same sequence without steps 5-7, I am unable to read what I had written the register.

Am I really reading the register or is this a goof and has something to do with the write latches not being reset?
 
hi all
just found this old thread while searching to get some help on programming PIC16F887.

I've bought this pic recently for my project and now I'm having a big trouble programming it. The latest WinPic device list(2007) does not contain this pic. Tried to add this to the devices.ini but failed. PICPgm supports this PIC but when I download the code, verification fails. (Hardware: Multi PIC programmer)
What should I do to program this pic? Does any one have a newer Devices.ini? Thanks in advance..
 
You should get yourself a PICKit2, or build yourself a clone (as you have a programmer so you can program the chip on the clone) - programs like WinPic are unlikely to get updated, where as the PICKit2 is updated regularly by MicroChip, and adds new devices as they are released.
 
There is something wrong with the serial port of my machine I guess. May be with the voltage levels. PICPgm did the job well in my friend's pc.

Ya Im gonna buy a programmer or a clone as soon as possible. But just for the time being I have to you these ugly programmers..

The devices.ini file seems to be v small compared to the file I have. So I just copied the 887 entry to the original file. Hope it will work..

Thank you very much for your replies.. :)
 
Hi Hero...dont know if you solved your problem with the loader but i had the same prob to.
Not eaven Microchips loader was working, but i found a program "PicProg2009" that works.
I use an old Welleman K8048 to connect via ICSP to the pic, and download the code with
PicProg2009...works like charm
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top