RCU Forums - View Single Post - CDI gr8flyer55
View Single Post
Old 09-22-2012 | 10:58 AM
  #364  
jakestew
Senior Member
 
Joined: Aug 2011
Posts: 144
Likes: 0
Received 0 Likes on 0 Posts
From: Moscow, ID
Default RE: CDI gr8flyer55


ORIGINAL: gr8flyer55
As the magnet approaches the sensor (notice I said Approaches!!) you get a series of sparks, with my hearing it sounded like 4 or 5 sparks!!!

After that series of sparks, it fires only as the magnet approaches the sensor, not after it leaves it. Not good!
That is pretty much how I programmed it. If you used the default value for MSD_Start_Spark it would fire 5 sparks on the very first fire.

I am also using the falling edge for the sensor interrupt. That means it will trigger as the magnet approaches. I figured that doing it this way would give a degree or so of extra time vs waiting for the magnet to leave. I also figured the hall trigger would be more reliable than the hall settling.

If you want to change this then change...
OPTION_REG = 0b00000000; // pullups on, falling edge, Tmr0
to
OPTION_REG = 0b01000000; // pullups on, rising edge, Tmr0

Also change...
else if(INTCONbits.INTF){ **** GP2 SENSOR INPUT *****/
if(GPIObits.GP2 == 0){
to
else if(INTCONbits.INTF){ **** GP2 SENSOR INPUT *****/
if(GPIObits.GP2 == 1){


Remember that the hall switch is active low, so falling edge = magnet approaching and rising edge = magnet leaving. I don't really know enough to tell what difference this change will make. The way I understand, using the rising edge will work the same, except that it will be 1-2 degrees later.