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_4MHZ
;***** 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
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_4MHZ
;***** 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