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!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu