On Tue, 2003-06-10 at 21:08, Evan Scott wrote: > In an effort to eliminate unsolicited e-mail, I have installed SpamEnder. You must REPLY to this e-mail, without modifying the subject line, so that SpamEnder will release your original message to my Inbox. Upon my approval, future e-mails you send to me will be released automatically. If you do not REPLY to this e-mail, SpamEnder will block all future e-mails from this address and will not give you another opportunity to reply. > > ---------------------------------------------------------- > SpamEnder stops 100% of all SPAM e-mail and NEVER blocks the e-mail you wish to receive. It even comes with a Money Back Guarantee. For more information about SpamEnder, open your browser to http://www.spamender.com/ > ---------------------------------------------------------- > Copyright 2003, Evolvian, Inc. > > Excerpt from original message: > Robert, > > First, a major no-no ... although your method of coding could work, you should > really, really, really (insert infinite loop here :-) use the definitions > from the .inc files already created by Microchip. They're part of the MPLAB > package. Otherwise, the code is difficult to read, and adds major sources of > errors. Especially if, as you say, you're a programmer. :-) > > That said, assuming your code compiles okay and does have the correct register > addresses, if the switch were in it's unpressed state, RA1 would be "1". The > code would loop at BEGIN and the line after that (goto BEGIN). Now, if the > switch were pressed, RA0 goes to "0", so the code sets PORTB to all "1"'s > which would turn on the LED, BUT...assuming the switch "bounces", as is > expected, RA1 would flicker between "1" and "0" for a short time. But long > enough that as it gets to KEEPON, RA1 could be at 0 and would not loop at > KEEPON. It would go straight to clearing portB and exit. It could also loop > at KEEPON a few times before exiting due to the same switch bounce problem. > A few times is very fast, since the internal oscillator is 4Mhz, so you would > not even see the LED come on. > > Quick test... try a really large capacitor at the input to RA1 (Cap +ve to > RA1, cap -ve to gnd). If that solves your problem then you know it's the > bounce issue. > > Cheers, > -Neil > > > > > On Tuesday 10 June 2003 19:47, rrc124+@PITT.EDU scribbled: > > I can't get my inputs to work. I am using a pull up switch, have set all > > pins but 1 to outputs, then tied them to ground. I am using a PIC16F628 > > with the configs set to everything off/disabled except the power up timer. > > I have selected the internal oscillator. I'm a programmer..not EE, so > > that's my weak point but i have been checking the circuit for 3 days and > > can't find what's wrong. The chip works because i got one of those LED > > blinking things to work fine. Guys...thank you so much...it's very > > upsetting when you're just starting out and can't get the easiest thing to > > work. The only odd thing i could find was that my programming software > > (WinPicProg, from Dontronics) generates a different config word then does > > MPLAB with the same settings. > > > > Here is my code: > > > > TMR0 EQU 1 > > OPTION_R EQU 1 > > PORTA EQU 5 > > PORTB EQU 6 > > TRISA EQU 5 > > TRISB EQU 6 > > STATUS EQU 3 > > ZEROBIT EQU 2 > > CARRY EQU 0 > > PCON EQU 0EH > > COUNT EQU 20H > > > > LIST P=16F628 > > ; tells which processor is use ;MPLAB generated __CONFIG > > 0x3F10 > > __CONFIG 0x3D10 ;WinPicProg generated > > > > org 0 > > goto START > > > > ; config section > > > > START bsf STATUS, 5 > > movlw b'11111111' > > movwf TRISA > > movlw b'00000000' > > movwf TRISB > > > > movlw b'00000100' > > movwf OPTION_R > > clrf PCON > > > > bcf STATUS, 5 > > clrf PORTA > > clrf PORTB > > > > ; program starts now > > > > BEGIN btfsc PORTA, 1 > > goto BEGIN > > movlw b'11111111' > > movwf PORTB > > KEEPON btfss PORTA, 1 > > goto KEEPON > > clrf PORTB > > goto BEGIN > > > > END > > > > Here is my circuit: > > GND > > > > [9V+ Battery]--[914 diode]--[7805 Volt Reg]--+ > > > > +-----[10k Res]----+ > > > > A1/PIN 18-----+--[switch]--GND | > > > > Vdd/PIN 14------------------------+ > > > > Vss/PIN 05------------------------GND > > > > B4/PIN 10--[470 Ohm Res]--[LED]--GND > > > > B3/PIN 09--[470 Ohm Res]--[LED]--GND > > > > All other pins set as output, tied to ground. The switch part of the > > circuit allows 4.5V to A1 and when pressed drops the voltage down to 0. I > > checked with my multimeter. Thank you so much everyone. > > > > E-Mail: rrc124@pitt.edu > > > > Robert Campbell > > -- > 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 -- Duane Brantley -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu