PIC10F222 Failed to program device please help

Thread Starter

karka317

Joined Feb 26, 2019
18
Hello,

Every time I try to program my hex file I get an error:

The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3b
configuration memory
program memory
Address: 0 Expected Value: 25 Received Value: 0
Failed to program device

Even my asm code BUILD SUCCESSFUL, I still get an error and can't program any code.

Do you know where is the problem?

I am using Pickit3 with ICD2 PIC10F222 microcontroller. MPLAB IDE/IPE v5.15

Code:

;**********************************************************************
; This file is a basic code template for assembly code generation *
; on the PIC10F222. This file contains the basic code *
; building blocks to build upon. *
; *
; Refer to the MPASM User's Guide for additional information on *
; features of the assembler (Document DS33014). *
; *
; Refer to the respective PIC data sheet for additional *
; information on the instruction set. *
; *
;**********************************************************************
; *
; Filename: xxx.asm *
; Date: *
; File Version: *
; *
; Author: *
; Company: *
; *
; *
;**********************************************************************
; *
; Files Required: P10F222.INC *
; *
;**********************************************************************
; *
; Notes: *
; *
;**********************************************************************

list p=10F222 ; list directive to define processor
#include p10F222.inc ; processor specific variable definitions

__CONFIG _MCLRE_ON&_CP_OFF&_WDT_OFF&_MCPU_OFF&_IOFSCS_4MHZ53039125_476447592889901_1741486449707974656_n.jpg 52708451_652968651800671_1874061704904572928_n.jpg 52980045_761536164214670_1474212082281873408_n.jpg


;***** VARIABLE DEFINITIONS
TEMP_VAR UDATA
temp1 RES 1 ;DELAY REGISTER1
temp2 RES 1 ;DELAY REGISTER2
temp3 RES 1 ;DELAY REGISTER3
temp4 RES 1 ;DELAY REGISTER4
temp5 RES 1 ;TIMING REGISTER
temp6 RES 1 ;TINING REGISTER



;**********************************************************************
RESET_VECTOR CODE 0xFF ; processor reset vector

; Internal RC calibration value is placed at location 0xFF by Microchip
; as a movlw k, where the k is a literal value.

MAIN CODE 0x000
movwf OSCCAL ; update register with factory cal value


INITIALIZE
MOVLW B'0010'
TRIS GPIO ; INITIALIZE
CLRF ADCON0 ; ADC DISABLE
CLRF GPIO
MOVLW B'00001000'
OPTION ; ENABLE GPIO2 AS A DIGITAL PORT
CLRF GPIO



START:

SCAN1:
BTFSS GPIO,1
GOTO SCAN1
ENSURE:
BTFSC GPIO,1
GOTO ENSURE
CALL LOOP1
COUNTDOWN:
MOVLW 0xFF
MOVWF temp5
MOVLW 0xFF
MOVWF temp6
COUNTDOWN2:
BTFSC GPIO,1
GOTO RELAYACTIVATE
DECFSZ temp5
GOTO COUNTDOWN2
MOVLW 0xFF
MOVWF temp5
DECFSZ temp6
GOTO COUNTDOWN2
GOTO SCAN1

RELAYACTIVATE:
BSF GPIO,0
CALL LOOP1
CALL LOOP1
CALL LOOP1
SCAN2:
BTFSS GPIO,1
GOTO SCAN2
ENSURE2:
BTFSC GPIO,1
GOTO ENSURE2
CALL LOOP1
COUNTDOWN3:
MOVLW 0xFF
MOVWF temp5
MOVLW 0xFF
MOVWF temp6
COUNTDOWN4:
BTFSC GPIO,1
GOTO RELAYDEACTIVATE
DECFSZ temp5
GOTO COUNTDOWN4
MOVLW 0xFF
MOVWF temp5
DECFSZ temp6
GOTO COUNTDOWN4
GOTO SCAN2

RELAYDEACTIVATE:
BCF GPIO,0
RESET

LOOP1:
MOVLW 0x00
MOVWF temp1
MOVLW 0xF0
MOVWF temp2

LOOP2:
DECFSZ temp1
GOTO LOOP2
DECFSZ temp2
GOTO LOOP2
return


END
 

Thread Starter

karka317

Joined Feb 26, 2019
18
I have some faint memories of a frustration like you have encountered. As I recall, I overcame it by manually inserting the programming locations.

View attachment 171047
Still get the same error: :(


The following memory area(s) will be programmed:
program memory: start address = 0x0, end address = 0x3b
configuration memory
program memory
Address: 0 Expected Value: 25 Received Value: 0
Failed to program device

Anything I have tried to change in code, gives the same error.
 
I should have looked more carefully, while it is very hard to tell, I don't think that you have it in the correct location in the programming socket (see below).

For the 10F series, you should be aligned to the far right end and also note the orientation is different than the other chips.
pic programming socket IMG_8937.jpg

If that does not do it, I would eliminate the socket, write the simplest program possible and directly connect the pic3 on a breadboard (and specify the programming locations).
 

Thread Starter

karka317

Joined Feb 26, 2019
18
I should have looked more carefully, while it is very hard to tell, I don't think that you have it in the correct location in the programming socket (see below).

For the 10F series, you should be aligned to the far right end and also note the orientation is different than the other chips.
View attachment 171057

If that does not do it, I would eliminate the socket, write the simplest program possible and directly connect the pic3 on a breadboard (and specify the programming locations).
Thank you for answering, here is how my PIC10F222 is placed

53236083_303326420377573_2127087638585278464_n.jpg 53021195_253702358852142_7860133345336754176_n.jpg 53289772_374657939981740_2117557020256108544_n.jpg
 

Attachments

Yes, but can you see that your orientation is not according to the diagram?? See the white lines on the top of the programming board? You oriented the chip to the line which is appropriate for Dip8/14 and not the 10F - as written on the chip bottom,

I would also add that the programming socket that you show in your picture is very similar if not the same to one that I have and showed in my picture. I bought mine from Banggood and kept the add. They no longer carry it that I can see, but they said that it could NOT program the 10FXX series, but I have, in fact programmed a 10F202 many times, following the diagram.

The same board (or what looks like the same board) is carried elsewhere e.g., https://www.ebay.com/i/202460445443?chn=ps with the same note that it will not program 10Fxx.

So, again, I would recommend that you try it, oriented properly in the programming socket and set the memory range and if it does not work, dump the socket and connect the pic3 directly to the chip on a breadboard and eliminate the socket alltogether.
 

Thread Starter

karka317

Joined Feb 26, 2019
18
Yes, but can you see that your orientation is not according to the diagram?? See the white lines on the top of the programming board? You oriented the chip to the line which is appropriate for Dip8/14 and not the 10F - as written on the chip bottom,

I would also add that the programming socket that you show in your picture is very similar if not the same to one that I have and showed in my picture. I bought mine from Banggood and kept the add. They no longer carry it that I can see, but they said that it could NOT program the 10FXX series, but I have, in fact programmed a 10F202 many times, following the diagram.

The same board (or what looks like the same board) is carried elsewhere e.g., https://www.ebay.com/i/202460445443?chn=ps with the same note that it will not program 10Fxx.

So, again, I would recommend that you try it, oriented properly in the programming socket and set the memory range and if it does not work, dump the socket and connect the pic3 directly to the chip on a breadboard and eliminate the socket alltogether.
Thank you for answer, I have just tried to put my PIC10F222 to different place, but still get the same error...
53289772_374657939981740_2117557020256108544_n.jpg 52883835_1112994432205119_3590922611728580608_n.jpg
 
Top