I have a strange problem. Im making a program that I need to use a 32.768khz crystal on the timer1 input to get accurate timing. So I have set up timer1 in this fashion. However this uses the same pins as the programming clock and data and since i have MCLRE off in my config, I cant seem to reprogram the chip.
I've tried 3 different chips and every time i flash this program onto one of them the program goes on OK but then no matter what I do PicKit2 will not find the chip any more.
Even taking the chip out of the circuit and connecting it directly to the PicKit2 does not allow it to recognise the chip. Ive tried selecting the chip manually and erasing but it didnt work. The program is still there.
Im thinking the timer1 configuration is interfering with the communication with the progammer, and becuase MCLR is disabled, pulling MCLR low does not stop the program.
Does any1 know if there is a way for me to erase these chips cos otherwise they are pretty much dead since the program is not complete.
config:
code:Code:__CONFIG _CONFIG1H, _INTIO2_OSC_1H __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H __CONFIG _CONFIG3H, _MCLRE_OFF_3H __CONFIG _CONFIG4L, _LVP_OFF_4L
Code:DEFINE OSC 8 DEFINE LCD_DREG PORTB DEFINE LCD_DBIT 0 DEFINE LCD_RSREG PORTB DEFINE LCD_RSBIT 5 DEFINE LCD_EREG PORTB DEFINE LCD_EBIT 4 DEFINE LCD_BITS 4 DEFINE LCD_LINES 2 DEFINE LCD_COMMANDUS 2000 DEFINE LCD_DATAUS 50 OSCCON.4=1 ' 8Mhz Internal Clock OSCCON.5=1 OSCCON.6=1 ADCON0=%00000000 ' ADC off ADCON1=%01111111 ' All I/O digital T0CON=%10010111 ' Timer0: 16-bit, 1:256 scaler, 1=128uS, 1sec=7813 T1CON=%00001111 ' Timer1: 16-bit, 32.768 kHz external clock, $FFFF=2 sec RF_IN VAR PORTA.7 SOLENOID VAR PORTA.2 LED VAR PORTA.3 UP var PORTA.1 DOWN var PORTA.4 ENTER VAR PORTA.5 BLANK1 VAR PORTA.0 BLANK2 VAR PORTA.6 pulse var word temp var word hours var byte mins var byte input RF_IN INPUT UP INPUT DOWN INPUT ENTER INPUT BLANK1 INPUT BLANK2 LOW SOLENOID HIGH LED hours=0 mins=0 PAUSE 500 LED=0 main: gosub set_time ' Rest of the program to go here end set_time: LCDOUT $FE,1,$FE,2," Set Hours" LCDOUT $FE,$C0," ",dec2 hours,":",DEC2 mins set_time_loop: IF UP=1 then gosub wait_release hours=hours+1 if hours=24 then hours=0 LCDOUT $FE,$C0," ",dec2 hours,":",DEC2 mins endif IF DOWN=1 then gosub wait_release hours=hours-1 if hours=255 then hours=23 LCDOUT $FE,$C0," ",dec2 hours,":",DEC2 mins endif IF ENTER=1 then gosub wait_release LCDOUT $FE,1,$FE,2 RETURN endif goto set_time_loop wait_release: pause 20 waitloop: if UP=1 or DOWN=1 or ENTER=1 then goto waitloop pause 20 return





Bookmarks