> > -----Original Message----- > > From: Michael Rigby-Jones [mailto:Michael.Rigby-Jones@BOOKHAM.COM] > > Sent: 23 September 2003 15:38 > > To: PICLIST@MITVMA.MIT.EDU > > Subject: Re: ] (automotive) frequency trigger > > Yes, this seems like a reasonable method to implement this, > > if you are happy to use a PIC with a CCP module. 20Hz is > > slow enough that you could easily measure this purely in > > software if you wanted to. > > > > -----Original Message----- > From: Hulatt, Jon [SMTP:jhulatt@MONSTEREUROPE.COM] > Sent: Tuesday, September 23, 2003 4:02 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: ] (automotive) frequency trigger > > How did you do this? Just polling an input pin & using a timer? Or using > the > interupt pin and a timer? > I used a timer, but only to make my main loop isochronous. IIRC the main loop runs in 50 cycles. Each time around the loop an input period counter is incremented and the input from the speed sensor is checked for a rising edge. If a rising edge is found, the counter value is copied to another variable and then cleared. The count is then checked against a limit. If it's lower than this limit, the value is made equal to the limit, if the count is higher it is not changed. A second counter produces the output pulse, and is reloaded by the captured value from the first timer. You application sounds much simpler, no output pulse train to produce. > The code could be interesting, I'd like a look please. What form was the > signal on the MR2 ? My car is a skyline, and they are very likely to be > very > similar. Was is 12v square frequency/speed proportional? (like I am > assuming/guessing) ? > The gearbox sensor gives 4 pulses per wheel revolution*. The sensor itself appears to have an open collector output, and is pulled up to 12 volts within the speedometer. After probing around I found an internal signal in the speedo that was cleaned up and clamped to a 5 volt swing, so the messy level conversion was all done for me. In the MR2's case there is an output from the speedometer that is also open collector, going to the engine and power steering ECU's, where it is pulled up to 5 volts. This is normaly a straight copy of the input pulse train, but is now limited to give a maximum of around 100mph (limiter kicks in somewhere between 112 and 120). The code is written for the slightly obscure 12C672, simply because I had a few of the surface mount variety in my drawer, which made kludging it onto the back of the speedo (playstation modchip style) much easier. I've emailed the code off list to save bloating out this post. Regards Mike *at least that's what I was was told, after calibrating the speedo on the bench with a signal generator taking into account my wheel/tyre rolling circumference, it appears to be reading a fair bit too fast. Really need to finish of my gameboy scope and take a look, I'll post any further findings. ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= Any questions about Bookham's E-Mail service should be directed to postmaster@bookham.com. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads