Subject: Re: [PIC]: MPLAB 16F628 config errors Paul wrote: > Having written some simple code in assembler and build it into hex > within MPLAB v6.30 (build successful) I keep failing to burn it into a > PIC. What programmer do you use ? > Having repeatedly got the error message below > I have manually set the > config bits to the correct settings and still get the same error > message.... This is my first experience with MPLAB v6 as I have used an > older v5 version before. > > The burner... What "burner" ? [Paul] Burner is WARP 13a. I have used it to burn 100s of PIC 16f628s but has not been used on this PC before, yet seems to comm. No problem. > has successfully worked with imported hex files so I know the > burned itself works WITH this version of MPLAB and the 16f628.. Any suggestions?? Is the output below an "error message" ? If so, what are the "errors" ? Ah, wait, I think I understand, the "expected/received" are column headers, right ? > Configuration Bits Errors > > Configuration Setting...Expected....Received > > Oscillator......... INTRC I/O ....LP > Code Protect...... Off ........All > Master Clear Enable...Enabled......Disabled > Data EE Read Protect ..Disabled ....Enabled Now, if this is just a short test program, you could just as well post the code... [Paul] I have since downloaded and installed MPLAB v5.7 and get exactly the same problem as with MPLAB v6.3(i.e. Configuration bits not programmed). This happens with several programs I have tried to burn. Here is a sample ;----------------------------------------------------------------------- --; ; FLAT628.ASM Flatshifter that stores rpm value in EEPROM ; ;----------------------------------------------------------------------- --; LIST P=16F628 ; tells which processor is used INCLUDE "p16f628.inc" ; defines various registers etc. Look it over. ERRORLEVEL -224 ; supress annoying message because of tris ERRORLEVEL -302 ; " " " " page change __CONFIG _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _WDT_OFF &_BODEN_OFF & _LVP_OFF #define PB1 PORTB, 2 ; Pushbutton #1, clutch pedal #define PB2 PORTB, 3 ; Pushbutton #2, set button #define LED1 PORTB, 4 ; LED #1 #define LED2 PORTB, 5 ; LED #2 ; register usage: CBLOCK H'20' combo ; holds combination count ; general count register codevalue ; holds code value cntmsec ; used to count milliseconds ENDC ORG 0 ; start a program memory location zero goto main ; jump over other routines ;----------------------------------------------------------------------- --; ;----------------------------------------------------------------------- --; init: clrf PORTA clrf PORTB movlw D'7' movwf CMCON movlw B'00010000' ; RA4 input, others outputs tris PORTA movlw B'00001100' ; RB4, RB5 input, others outputs tris PORTB clrf PORTB ; LEDs blanked movlw B'00100000' ; pull-ups enabled ; prescaler assigned to RA4 option return ;----------------------------------------------------------------------- --; ; Read a byte from the data EEPROM at address given in W ; ;----------------------------------------------------------------------- --; readee bsf STATUS,RP0 ; change to page 1 movwf EEADR ; set up eeprom address from W bsf EECON1,RD ; set the read bit movf EEDATA,W ; return value in W bcf STATUS,RP0 ; back to page 0 return ;----------------------------------------------------------------------- --; ; This routine writes a byte to data EEPROM ; ; set up EEADR and EEDATA before entry ; ;----------------------------------------------------------------------- --; writee: bsf STATUS,RP0 ; enter page 1 bsf EECON1,WREN ; enable write movlw H'55' ; magic sequence movwf EECON2 movlw H'AA' movwf EECON2 bsf EECON1,WR eeloop: btfsc EECON1,WR ; wait for WR to go low goto eeloop ; not yet bcf EECON1,WREN bcf STATUS,RP0 ; return to page 0 bcf PIR1,EEIF ; clear the interrupt flag return ;----------------------------------------------------------------------- --; ; Enter Code ; ;----------------------------------------------------------------------- --; entercode: movlw 1 ; flash once call flashleds waitboth: btfss PB2 ; wait until pushbutton 2 up goto waitboth call engine return ;----------------------------------------------------------------------- --; ; Delay Subroutines ; ;----------------------------------------------------------------------- --; micro4 addlw H'FF' ; subtract 1 from 'W' btfss STATUS,Z ; skip when you reach zero goto micro4 ; more loops return onesecond: ; a subroutine that delays for 1 sec call msec250 call msec250 call msec250 call msec250 return msec5 movlw D'5' ; 5 msec delay entry point goto nmsec msec20 movlw D'20' ; 20 msec delay entry point goto nmsec msec25 movlw D'25' ; 20 msec delay entry point goto nmsec msec250: ; a subroutine to delay 250 msec movlw D'250' ;*** N millisecond delay routine *** nmsec: movwf cntmsec ; delay for N (in W) millisec msecloop: movlw D'248' ; 1 usec for load call micro4 ; this instruction is 995 usec nop ; 1 usec decfsz cntmsec,f ; 1 usec, (2 if skip taken) goto msecloop ; 2 usec, loop = 995+5 = 1 msec return ;----------------------------------------------------------------------- --; ; Flash the LEDs, number of flashes in W on entry ; ;----------------------------------------------------------------------- --; flashleds: movwf count flashloop: movlw B'00110000' movwf PORTB call onesecond + 2 ; 1/2 sec on movlw 0 movwf PORTB call onesecond + 2 ; 1/2 sec off decfsz count, f goto flashloop return ;----------------------------------------------------------------------- --; ; Revlimit, number of flashes in W on entry ; ;----------------------------------------------------------------------- --; revlimit: movwf count revloop: movlw B'00110011' movwf PORTB call msec20 ;on movlw 0 movwf PORTB call msec5 ;off decfsz count, f goto revloop return ;----------------------------------------------------------------------- -------------- ; RPM monitor routine ;----------------------------------------------------------------------- ------------- engine: bcf INTCON, T0IF ;clear timer zero interupt flag clrf TMR0 ;zero timer call msec25 movf TMR0, W ;get TMR0 value and put into w return ;----------------------------------------------------------------------- --; ; Get combo value and place it in EEPROM location 0 ; ;----------------------------------------------------------------------- --; setcombo: call entercode ; get desired press combination bsf STATUS,RP0 movwf EEDATA ; set up data and address movlw 0 movwf EEADR call writee ; save combo in EEPROM movlw 2 ; flash leds 2 times call flashleds ; ( one additional when entering main ) return ;----------------------------------------------------------------------- --; ; The Main routine ; ;----------------------------------------------------------------------- --; main: call init ; initialize registers etc. movf PORTB, W ; check if both buttons pressed on power-up andlw B'00001100' ; look at buttons, (will give 0's if down) btfsc STATUS, Z ; skip if both not presssed call setcombo ; if both press set the combination movlw 0 ; get combo from EEPROM address 0 call readee movwf codevalue ; save it mainloop: call engine subwf codevalue, W ; is it same as code? btfsc STATUS, C ; zero set if yes goto mainloop bsf PB1 btfsc PB1 goto mainloop movlw 1 ; sucess, unlocking procedure would ... call revlimit ; be placed here. goto mainloop org 0x2100 ; this is location of EEPROM data dw H'C8' ; the initial value of location 0 ... ; is set to D'200' end ; end of program Regards Paul Evans Regards Jan-Erik. -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu