gnupic: Re: [gnupic] in-circuit debugger


Previous by date: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] gpsim --"invalid file register" error, Robert Pearce
Next by date: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] in-circuit debugger, Robert Pearce
Previous in thread: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] in-circuit debugger, Maxim Wexler
Next in thread: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] in-circuit debugger, Robert Pearce

Subject: Re: [gnupic] in-circuit debugger
From: Byron A Jeff ####@####.####
Date: 5 Feb 2007 21:32:17 +0000
Message-Id: <20070205213145.GA3478@cleon.cc.gatech.edu>

On Mon, Feb 05, 2007 at 11:12:29AM -0700, Maxim Wexler wrote:
> >
> >Which suggests to me that the real PIC in the hardware is not seeing the
> >switch like the simulated one does. You say it's debounced in hardware -
> >what circuit are you using? Have you verified that the actual voltage at
> >the actual PIC pin does swing from 0 to 5V when you press the button?
> >--
> >Rob Pearce                       http://www.bdt-home.demon.co.uk
> >
> >
> <blushes>
> There are two faults. 1) the switch(NO-PB with a pullup to 5V and a
> diode/cap/R combo between it and RB5) was mis-wired. 2) the logic is
> backwards -- you have to push the button and hold it in order to see the
> display.

Maxim,

There's no need to debounce in hardware. That's why having microcontrollers
are useful.

Let's start from scratch:

On the hardware side wire only the switch and the pullup. Leave all the rest
of the debouncing hardware off. So wire one side of the switch to ground,
one side of the pullup to +5V, and the two loose ends to RB5. Keeping the
hardware simple eliminates errors.

On the software side you debounce by using a simple timeout. You already
are using a delay routine (mighty fine work by whoever wrote it! ;-) Use it
to debounce. When the switch changes set another counter value (we'll pick
the value in a minute). Set up the value to decrement in the delay loop
(again we'll pick the decrement point in a bit). Finally before you check 
the switch, you check that debounce counter to see if it's zero. A cool
PIC trick for this is to move the counter to itself using movf. It'll set
the Z flag if it's zero without changing the value of the register. If the
register is not zero then you don't check the switch. Instant debounce.

BAJ

Previous by date: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] gpsim --"invalid file register" error, Robert Pearce
Next by date: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] in-circuit debugger, Robert Pearce
Previous in thread: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] in-circuit debugger, Maxim Wexler
Next in thread: 5 Feb 2007 21:32:17 +0000 Re: [gnupic] in-circuit debugger, Robert Pearce


Powered by ezmlm-browse 0.20.