PIC Programming Upload Error

Thread Starter


Joined Oct 4, 2011

Firstly my apologies if this has already been discussed many times, but I am a complete newbie at this.

I need to upload a PIC hex file into a 12F675 chip. I have a Vellman PIC Programmer and Experiment board that I have uploaded various example programs to a 16F627 chip and they all upload OK.

However when I upload the hex file to the chip the upload starts OK and runs through until I get a 'Write Error at 03FF' - 'Write 3480' - 'Read 0000'

Does anyone have any ideas as to what is going wrong. I can send the
readback file if that will help.

Many thanks


Joined Sep 8, 2011
3ff is the end of the flash program memory so it must mean the program is bigger than the available memory in the pic

Thread Starter


Joined Oct 4, 2011
Thanks vrainom I really appreciate your help. :)

I am a iittle confused as the program has been tested and uploaded to this chip so it should be small enough to fit.

The program was not written by me http://www.fancon.cz/slave-flash-trigger/slave-flash-en.html

The code below is the program for the circuit.

Many thanks Steve


Joined Sep 7, 2009
I disassembled it and there is an instruction at 3FF.
<ed>I tried to recompile the code without the line at 3FF, and it was also complaining about the lines at 0x2000, whereas the EEPROM on the PIC12F675 starts at 0x2100, so I changed that too. If you copy the bit that looks like a hex file and save it with a .HEX extension it should burn to the chip, I've no idea if it will work, probably not but maybe worth a try.

Rich (BB code):

Rich (BB code):
gpdasm -p PIC12F675 dis
000000:  2846  goto    0x46
000004:  00a0  movwf    0x20
000005:  0803  movf    0x3, w
000006:  00a1  movwf    0x21
000007:  1283  bcf    0x3, 0x5
000008:  190b  btfsc    0xb, 0x2
000009:  280d  goto    0xd
00000a:  180c  btfsc    0xc, 0
00000b:  282e  goto    0x2e
00000c:  2800  goto    0
00000d:  30cd  movlw    0xcd
section removed because of post size limit
0001d3:  128b  bcf    0xb, 0x5
0001d4:  110b  bcf    0xb, 0x2
0001d5:  30cd  movlw    0xcd
0001d6:  0081  movwf    0x1
0001d7:  1683  bsf    0x3, 0x5
0001d8:  1281  bcf    0x1, 0x5
0001d9:  1283  bcf    0x3, 0x5
0001da:  168b  bsf    0xb, 0x5
0001db:  0008  return
0001dc:  01aa  clrf    0x2a
0001dd:  082a  movf    0x2a, w
0001de:  00ab  movwf    0x2b
0001df:  29e0  goto    0x1e0
0001e0:  29e1  goto    0x1e1
0001e1:  1105  bcf    0x5, 0x2
0001e2:  0fab  incfsz    0x2b, f
0001e3:  29df  goto    0x1df
0001e4:  00ab  movwf    0x2b
0001e5:  09ab  comf    0x2b, f
0001e6:  29e7  goto    0x1e7
0001e7:  29e8  goto    0x1e8
0001e8:  1505  bsf    0x5, 0x2
0001e9:  0fab  incfsz    0x2b, f
0001ea:  29e6  goto    0x1e6
0001eb:  0faa  incfsz    0x2a, f
0001ec:  29dd  goto    0x1dd
0001ed:  01aa  clrf    0x2a
0001ee:  082a  movf    0x2a, w
0001ef:  00ab  movwf    0x2b
0001f0:  29f1  goto    0x1f1
0001f1:  29f2  goto    0x1f2
0001f2:  1505  bsf    0x5, 0x2
0001f3:  0fab  incfsz    0x2b, f
0001f4:  29f0  goto    0x1f0
0001f5:  00ab  movwf    0x2b
0001f6:  09ab  comf    0x2b, f
0001f7:  29f8  goto    0x1f8
0001f8:  29f9  goto    0x1f9
0001f9:  1105  bcf    0x5, 0x2
0001fa:  0fab  incfsz    0x2b, f
0001fb:  29f7  goto    0x1f7
0001fc:  0faa  incfsz    0x2a, f
0001fd:  29ee  goto    0x1ee
0001fe:  0008  return
0001ff:  3014  movlw    0x14
000200:  00aa  movwf    0x2a
000201:  1505  bsf    0x5, 0x2
000202:  14a4  bsf    0x24, 0x1
000203:  308e  movlw    0x8e
000204:  00a5  movwf    0x25
000205:  30fd  movlw    0xfd
000206:  00a6  movwf    0x26
000207:  10a4  bcf    0x24, 0x1
000208:  1ca4  btfss    0x24, 0x1
000209:  2a08  goto    0x208
00020a:  1105  bcf    0x5, 0x2
00020b:  14a4  bsf    0x24, 0x1
00020c:  308e  movlw    0x8e
00020d:  00a5  movwf    0x25
00020e:  30fd  movlw    0xfd
00020f:  00a6  movwf    0x26
000210:  10a4  bcf    0x24, 0x1
000211:  1ca4  btfss    0x24, 0x1
000212:  2a11  goto    0x211
000213:  0baa  decfsz    0x2a, f
000214:  2a01  goto    0x201
000215:  0008  return
000216:  2220  call    0x220
000217:  082d  movf    0x2d, w
000218:  042e  iorwf    0x2e, w
000219:  1d03  btfss    0x3, 0x2
00021a:  2220  call    0x220
00021b:  082f  movf    0x2f, w
00021c:  0430  iorwf    0x30, w
00021d:  1d03  btfss    0x3, 0x2
00021e:  2220  call    0x220
00021f:  0008  return
000220:  14a4  bsf    0x24, 0x1
000221:  3077  movlw    0x77
000222:  00a5  movwf    0x25
000223:  30ec  movlw    0xec
000224:  00a6  movwf    0x26
000225:  10a4  bcf    0x24, 0x1
000226:  1505  bsf    0x5, 0x2
000227:  1ca4  btfss    0x24, 0x1
000228:  2a27  goto    0x227
000229:  14a4  bsf    0x24, 0x1
00022a:  3077  movlw    0x77
00022b:  00a5  movwf    0x25
00022c:  30ec  movlw    0xec
00022d:  00a6  movwf    0x26
00022e:  10a4  bcf    0x24, 0x1
00022f:  1105  bcf    0x5, 0x2
000230:  1ca4  btfss    0x24, 0x1
000231:  2a30  goto    0x230
000232:  0008  return
000233:  1105  bcf    0x5, 0x2
000234:  14a4  bsf    0x24, 0x1
000235:  3077  movlw    0x77
000236:  00a5  movwf    0x25
000237:  30ec  movlw    0xec
000238:  00a6  movwf    0x26
000239:  10a4  bcf    0x24, 0x1
00023a:  1ca4  btfss    0x24, 0x1
00023b:  2a3a  goto    0x23a
00023c:  1405  bsf    0x5, 0
00023d:  1505  bsf    0x5, 0x2
00023e:  15a4  bsf    0x24, 0x3
00023f:  30ff  movlw    0xff
000240:  00ac  movwf    0x2c
000241:  11a4  bcf    0x24, 0x3
000242:  1da4  btfss    0x24, 0x3
000243:  2a42  goto    0x242
000244:  1105  bcf    0x5, 0x2
000245:  1005  bcf    0x5, 0
000246:  2229  call    0x229
000247:  2229  call    0x229
000248:  2871  goto    0x71
0003ff:  3480  retlw    0x80
002000:  0004  dw    0x4  ;unknown opcode
002001:  0004  dw    0x4  ;unknown opcode
002002:  0001  dw    0x1  ;unknown opcode
002003:  0001  dw    0x1  ;unknown opcode
002007:  3f84  addlw    0x84
Last edited:

Thread Starter


Joined Oct 4, 2011
Thanks markd77, what I found out was that I did not erease the bulk code and data before I wrote the program to the chip. I assumed that the checkbox which said 'erase before write' would do that.

I will give it a try and see what happens!

Many thanks for your help



Joined Nov 28, 2008
On the 12F675, Address 0x3FF is the last word in the flash memory and has been used by Microchip to store a certain, chip specific calibration value, which if you chose to use it, can set the internal oscillator frequency of the PIC to within one or a few percents of the stated clock frequency.

So unless you know what this value is for the chip in hand and have make a copy of it, chances are you are going to overwritten it with a meaningless value. I think the Vellman Programmer is just over protective in this respect and does not allow the value to be lost.

I have removed this particular part in your HEX code so you can program it to the 12F675. Rename the text filename to 675.hex after download.