replace programmer in the following by programmeD ----- Original Message ----- From: "Peter van Hoof" To: Sent: Thursday, June 24, 2004 8:16 AM Subject: Re: [PIC:] Driving 2 LEDs using PIC 12F675 > If you look in section 9.2.5.1 in the datasheet of the 12f629 you see that > to calibrate the oscilator there is a instruction near the beginnig of your > program "call 3FFh" this calls a subroutine at location 3HHh in program > memory where it expects to find the factory programmed oscilator calibration > factor programmer in a retlw instruction. > > The retlw instruction returns from a subroutine with the value in the w > register, example retlw 80h will return with 80h in the w register > > If you have erased the pic complete at some point in time you will have lost > this factory programmed instruction. Your programmer complains about this in > the message you described. > > If this retlw instruction is not there the pic will happily go about it's > business and execute whatever is in this program location and never returns > to the code you want it to execute. > > The retlw 80h i suggested programming in this location is just the center > value of the calibration and if your timing is not critical this will work > just fine. > > You would put the > org 3FFh > retlw 80h > just before the end statement in your program. > > Kind regards > Peter > ----- Original Message ----- > From: "Emrah Bozkurt" > To: > Sent: Thursday, June 24, 2004 7:49 AM > Subject: Re: [PIC:] Driving 2 LEDs using PIC 12F675 > > > > Hello, > > > > How can I make debunce in the code? And what is it > > exactly? > > > > And where will I exactly put > > org 3ffh > > retlw 80h > > instructions in my code ? Thanks a lot. > > > > Emrah Bozkurt > > > > --- Peter van Hoof wrote: > > > Your program does not seem to have any debounce , > > > this might make the button > > > response very querky > > > > > > Peter > > > > > > ----- Original Message ----- > > > From: "Peter van Hoof" > > > To: > > > Sent: Wednesday, June 23, 2004 10:33 PM > > > Subject: Re: [PIC:] Driving 2 LEDs using PIC 12F675 > > > > > > > > > > I think the calibration instruction on 3ff is > > > wiped > > > > add following instructions to end of your program > > > > org 3ffh > > > > retlw 80h > > > > if this is missing your code will not return > > > > > > > > Peter > > > > > > > > > > > > ----- Original Message ----- > > > > From: "Emrah Bozkurt" > > > > To: > > > > Sent: Wednesday, June 23, 2004 9:49 PM > > > > Subject: [PIC:] Driving 2 LEDs using PIC 12F675 > > > > > > > > > > > > > Hello all, > > > > > > > > > > I have been struggling with a very simple (yet > > > > > impossible) project in which I will drive 2 LEDs > > > using > > > > > 2 switches and a PIC 12F675. > > > > > I could not manage to make the PIC work on the > > > > > breadboard for almost 2 weeks (day and > > > night!)..I am > > > > > using IC-Prog for downloading the hex into PIC. > > > > > Please help me on the possible errors that exist > > > on my > > > > > code. (Maybe the error is on the hardware. If > > > anyone > > > > > accepts, I can immediately send the circuit > > > schematic > > > > > via email) > > > > > My code is below: > > > > > > > > > > ;=========== INITIALIZATIONS > > > ========================= > > > > > > > > > > LIST P=12F675 > > > > > INCLUDE "P12F675" > > > > > TRISIO EQU 85h ; TRISIO REGISTRY > > > IS > > > > > ; INTRODUCED. > > > > > GPIO EQU 05h ; I/O PORTS ARE > > > > > ; INTRODUCED. > > > > > STATUS EQU 03h ; STATUS REGISTRY > > > IS > > > > > ; INTRODUCED. > > > > > CMCON EQU 19h ; COMPARATOR > > > CONTROL > > > > > ; REGISTRY IS > > > > > ;INTRODUCED. > > > > > ANSEL EQU 9Fh ; ANALOG SELECT > > > > > ; REGISTRY IS > > > > > ; INTRODUCED. > > > > > OPTION_REG EQU 81h ; OPTION REGISTER > > > IS > > > > > ; INTRODUCED. > > > > > TMR0 EQU 01h ; TIMER REGISTER > > > IS > > > > > ; INTRODUCED. > > > > > PIR1_COUNT EQU 0Ch ; COUNTER > > > REGISTER IS > > > > > ; INTRODUCED. > > > > > OSCCAL EQU 90h ; OSCCAL REGISTRY > > > IS > > > > > ; INTRODUCED. > > > > > CONFIG EQU 2007h ; CONFIG IS > > > > > ; INTRODUCED. > > > (DURING > > > > > ; TRIAL, I ALSO > > > > > ; COMMENTED > > > > > ; OUT THIS LINE > > > AND > > > > > ; CONFIGURED THE > > > > > ; CONFIG WORD > > > DIRECTLY > > > > > ; FROM > > > > > ; IC-PROG'S FUSES > > > MENU) > > > > > > > > > > ;=====SET INTERNAL OSCILLATOR, DISABLE > > > COMPARATORS > > > > > ;=====AND A/D CONVERTERS =========== > > > > > > > > > > BCF CONFIG, 5 ; GP3 BECAME > > > INPUT AND > > > > > ; MCLR IS > > > CONNECTED TO > > > > > ; Vdd INTERNALLY. > > > > > ;(DURING TRIAL, I > > > ALSO > > > > > ; COMMENTED OUT > > > THIS > > > > > ; LINE AND > > > CONFIGURE > > > > > ; THE CONFIG WORD > > > > > ; DIRECTLY FROM > > > > > ; IC-PROG'S FUSES > > > MENU) > > > > > BCF CONFIG, 3 ; WDT > > > DISABLED.(DURING > > > > > ; TRIAL, I ALSO > > > > > ; COMMENTED OUT > > > THIS > > > > > ; LINE AND > > > CONFIGURE > > > > > ; THE CONFIG WORD > > > > > ; DIRECTLY FROM > > > > > ; IC-PROG'S FUSES > > > MENU) > > > > > > > > > > BSF STATUS, RP0 ; JUMP TO BANK 1. > > > > > CALL 3FFh ; GET THE > > > CALIBRATION > > > > > ; VALUE. > > > > > MOVWF OSCCAL ; CALIBRATE. > > > > > > > > > > BCF STATUS, 5 ; JUMP TO BANK 0. > > > > > CLRF GPIO ; INITIALIZE > > > GPIO. > > > > > MOVLW 07h ; SET COMPARATOR > > > PINS > > > > > ; AS DIGITAL I/O > > > PINS > > > > > MOVWF CMCON ; (Set > > > comparators as > > > > > ; OFF) > > > > > BSF STATUS, 5 ; JUMP TO BANK 1. > > > > > CLRF ANSEL ; SET A/D PINS AS > > > > > ; DIGITAL I/O > > > PINS > > > > > ; (Disable A/D > > > > > ; Converters). > > > > > > > > > > > > > > > ;==== DEFINE INPUT AND OUTPUT > > > PINS==================== > > > > > > > > > > MOVLW 0Ch ; SET GP<3:2> AS > > > > > ; INPUTS. > > > > > MOVWF TRISIO ; AND SET > > > GP<5:4,1:0> > > > > > AS OUTPUTS. > > > > > BCF STATUS, 5 ; JUMP TO BANK 0. > > > > > > > > > > > > > > > ;=========== MAIN PROGRAM ===================== > > > > > > > > > > CHECK_SW1 > > > > > > > > > > BTFSC GPIO, 3 ; IS SW1 BUTTON > > > PUSHED ? > > > > > GOTO LED1_OFF ; IF NOT, GO TO > > > > > ; LED1_OFF. > > > > > CALL LED1_ON ; IF YES, CALL > > > LED1_ON > > > > > ; SUBPROGRAM. > > > > > GOTO CHECK_SW1 ; CHECK SW1 BUTTON > > > > > ; AGAIN. > > > > > > > > > > CHECK_SW2 > > > > > > > > > > BTFSC GPIO, 2 ; IS SW2 BUTTON > > > PUSHED ? > > > > > GOTO LED2_OFF ; IF NOT, GO TO > > > > > ; LED2_OFF. > > > > > CALL LED2_ON ; IF YES, CALL > > > LED2_ON > > > > > ; SUBPROGRAM. > > > > > GOTO CHECK_SW2 ; CHECK SW2 BUTTON > > > > > ; AGAIN. > > > > > > > > > > > > > > > LED1_OFF > > > > > BCF GPIO, 4 ; MAKE LED1 OFF. > > > > > GOTO CHECK_SW2 ; CHECK SW2 > > > > > ; BUTTON. > > > > > > > > > > LED1_ON > > > > > BSF GPIO, 4 ; MAKE LED1 ON. > > > > > RETURN > > > > > > > > > > LED2_OFF > > > > > BCF GPIO, 1 ; MAKE LED2 ON. > > > > > GOTO CHECK_SW1 ; CHECK SW1 > > > > > ; BUTTON. > > > > > === message truncated === > > > > > > > > > > __________________________________ > > Do you Yahoo!? > > Yahoo! Mail is new and improved - Check it out! > > http://promotions.yahoo.com/new_mail > > > > -- > > 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