The Cyber-Spy.Com Usenet Archive Feeds Directly
From The Open And Publicly Available Newsgroup
This Group And Thousands Of Others Are Available
On Most IS NNTP News Servers On Port 119.
Cyber-Spy.Com Is NOT Responsible For Any Topic,
Opinions Or Content Posted To This Or Any Other
Newsgroup. This Web Archive Of The Newsgroup And
Posts Are For Informational Purposes Only.
From: firstname.lastname@example.org (keith)
Subject: Re: what port to use onthe microchip 16c74
Date: 15 Jan 2003 05:24:20 -0800
References: <email@example.com> <7064272.n80IE8o7u4@mixdown.org>
NNTP-Posting-Date: 15 Jan 2003 13:24:20 GMT
thx for ur reply eres a copy of the code. what kind of hardware/code
do i need? im still fairly new to pic and electronnics. at the mo i av
the sensor connected to a voltage divieder to a give a 5v on signal 0v
off signal then it is going to a opamp comparator witha ref of 4.8v
then on to the schmitt trigger adn then the pic.
looking forward to ur reply
list p = 16c74
counter equ 0x20
passtst equ 0x21
start clrf counter ;clear counters
movlw 0x80 ;set RB7 as sensor input
bsf INTCON,GIE ;enable global interrupts
bsf INTCON,PEIE ;enable peripheral interrupts
bsf INTCON,RBIE ;enable RB port change interrupt
ISR btfss INTCON,RBIF ;is it a PORTB interrupt
btfsc passtst,1 ;has it fully passed over, 1=yes
INC incf counter ;inc counter
clrf passtst ;clear passtest counter
Andrew Kohlsmith wrote in message news:<7064272.n80IE8o7u4@mixdown.org>...
> > hi, im building a project which is a datalogger for a go kart. one
> > part of the circuit has a magnetic sensor and i want to connect this
> > to the pic. i tried using portb pin 7 as it has interrupt on change
> > but it has not been too sucessfull. a copy of the code im using is
> > attached. the code works when i single step it but when i run it, it
> > gives me results as if the magnet has passed the sensor many times
> > when it has only passed once. i have tried using a schmitt trigger in
> > series with the sensor just to get a clean transition, but it made no
> > difference to my problem.
> Generally you do not want to hook up any external sensor to an interrupt pin
> unless you're really cleaning up the signal and can ensure it will never
> run outside of what you specify.
> I used to use the RBIF to detect line frequency but it would cause no end of
> problems if there was significant line noise at the zero crossings. I gave
> up and polled it. I'd ignore any change that occured "too fast" to be
> real, effectively making a sotware low-pass filter.
> I imagine you're getting either false triggering or bouncing of the magnetic
> pickup. Schmitt-triggering helps with false triggers but if it's bouncing
> you need to basically make a one-shot (in software or hardware) which
> prevents the input from being recognized again once it has tripped.
> Again, without additional hardware I wouldn't recommend using an interrupt
> pin to do this.
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup