Forget about the debounce , thought you where toggling on button push but you are just switching the outputs on. Check out the retlw on top of memory though (calibration instruction) like i stated in my other email Peter ----- Original Message ----- From: "Peter van Hoof" To: Sent: Wednesday, June 23, 2004 10:37 PM Subject: Re: [PIC:] Driving 2 LEDs using PIC 12F675 > 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. > > > > > > LED2_ON > > > BSF GPIO, 1 ; MAKE LED2 ON. > > > RETURN > > > > > > END ; END OF PROGRAM. > > > > > > > > > Thanks a lot in advance. Please reply (cc) to: > > > emrah_bozkurt@yahoo.com > > > > > > Emrah Bozkurt > > > > > > > > > NOT: I disabled WDT, BODEN, MCLR, CP, CDP and used > > > Internal RC Oscillator GP4. This created 3194h for the > > > CONFIG WORD. I tried to do this setting on the program > > > and the IC-Prog's FUSES menu alone. Also I disabled > > > the Comparators and A/D converters to have a whole set > > > of digital I/Os. > > > > > > The IC-Prog verifies after it downloads, but PIC never > > > works on the breadboard. I dont know why! > > > Also, IC-Prog is giving "Internal Oscillator Value is > > > missing! Do you want me to take the value from address > > > '3FFFh'?" message during the download. And I choose, > > > YES. Then it goes ahead sucessfully, but it still does > > > not work on the breadboard as I said before. > > > > > > > > > > > > > > > > > > __________________________________ > > > Do you Yahoo!? > > > Yahoo! Mail is new and improved - Check it out! > > > http://promotions.yahoo.com/new_mail > > > > > > -- > > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu