Quantcast
Channel: MEL PICBASIC Forum
Viewing all articles
Browse latest Browse all 4790

can't reprogram 12F615

$
0
0
Hello,
I having a heck of a time reprogramming a board with a 12F615 on it. The first program will download and verify just fine. After that, there are errors in different program memory locations:
Address: 00000000 Expected Value: 00002851 Received Value: 00002810
Programming failed

I suspect that I need to use my pickit2 instead of my pickit3...but I've also tried an ICD2 and an ICD3. my pickit2 is back at home.

I read through this: (the 2nd post)
http://www.microchip.com/forums/m576596-print.aspx

and then I set my icsp data and clock pins to be inputs instead of outputs - I'm not using them for anything else, there is nothing connected to them except the programming header. Also, I put in the pause command early in the program.

I figured that had to be what was going on.. programmed a new chip with the modified code...but I still can't reprogram

here is the program. I've got a thermistor voltage divider coming into GP2 and I've got GP4 controlling a fet acting as a low side switch. 10K pullup on MCLR, and the 5 pin programming header, and thats it.

Code:

@        __CONFIG _CP_OFF & _WDT_OFF & _BOR_OFF & _MCLRE_ON & _PWRTE_OFF & _INTRC_OSC_NOCLKOUT & _IOSCFS_4MHZ

'CLEARWDT                                                'picbasic will insert watchdog clears throughout the program

'    Hardware configuration
'    ======================
PAUSE 1000

DEFINE OSC 4                                        'tell picbasic how fast the clock is

DEFINE ADC_BITS 10                                ' Set number of bits in result (8, 10 or 12)
DEFINE ADC_CLOCK 3                                ' Set clock source (rc =3)
DEFINE ADC_SAMPLEUS 50                        ' Set sampling

ADCON0 = %10001000                                'RIGHT JUSTIFIED, VDD reference
ANSEL  = %00000100                                'GP2 is analog



GPIO = 0                                                'pins are set low, BEFORE assigning output pins to be outputs

TRISIO.0= 1  '0 = output                'GPIO.0 = PIN7        (icsp DATA)
TRISIO.1= 1                                                'GPIO.1 = PIN6  (ICSP CLOCK)
TRISIO.2= 1                              'GPIO.2 = PIN5  analog input
TRISIO.3= 1  'GP3 = input only        'GPIO.3 = PIN4
TRISIO.4= 0                        'GPIO.4 = PIN3 
TRISIO.5= 0                          'GPIO.5 = PIN2 
       


POWERSWITCH VAR GPIO.4

TESTLED VAR GPIO.5

ADvalue VAR WORD


Main:

ADCIN 2, ADvalue

IF ADvalue > 275 THEN

        POWERSWITCH = 0
        pause 200

        POWERSWITCH = 1
        pause 75

ELSE

        POWERSWITCH = 1

ENDIF

goto Main                                                'loop back up to main
   
END


Viewing all articles
Browse latest Browse all 4790

Trending Articles