Decoding Nissan style Mitsi Electric 360 slot cam sensors

For discussing and developing different RPM/Position decoders using our superior modular architecture! One thread per pattern, please.
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by MotoFab »

EssEss wrote:this sounds like a level issue. opto's are usually open-collector - therefore you need a pullup somewhere.

what is 'connect both' ?
I was thinking a hi-Z output as well. Especially when Hoodey said he had the sensor outputs 'connected together', you know, like can be done with open collector outputs for a 'wired or' output. But I was also thinking that enough folks have experimented with the Nissan sensors that the output was documented. ? ? ?

Hoodey, are you using the 'interrupt on change' port inputs? And are you having the problem when both the cam and crank signals are connected to the processor on separate input pins? If so, you might have to account for an interrupt occurring while one interrupt is being serviced.

- Jim
HOODEY
DIP8 - Involved
Posts: 17
Joined: Mon Aug 17, 2009 4:03 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by HOODEY »

Hoodey, are you using the 'interrupt on change' port inputs?

Yes.


And are you having the problem when both the cam and crank signals are connected to the processor on separate input pins?

Yes. RCO and RB6


If so, you might have to account for an interrupt occurring while one interrupt is being serviced. I have tested the interrupt routine in the simulator and it works like a charm.


The ECU has the pull up resistor so when I look at the cam and crank signal there are nice 5 volt pulses.
User avatar
EssEss
LQFP112 - Up with the play
Posts: 244
Joined: Thu Sep 10, 2009 9:23 am
Location: Dayton, OH

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by EssEss »

Like Jim says, are you getting overlapping interrupts ?

if you're using a pic18, you can at least attempt to classify each int into a high/low priority scheme and service both at the same time (depending on the source). If you're using a pic16 - then you're sol - you can't preempt an interrupt on that platform.
HOODEY
DIP8 - Involved
Posts: 17
Joined: Mon Aug 17, 2009 4:03 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by HOODEY »

Guys I am not controlling the engine. I am simply using the TDC and position information. If i have the TDC and spark pulse information feeding the port as soon as I connect the position information to the timer the engine stumbles.

I remove the pic8f452 from the board and I had no problems. This proved that the signals are not being shorted on the board.

Code: Select all

    

    movf PORTB,W							                               ; Save current port value to w
    movwf RBNEW                     ; Save port b reading
    xorwf RBSAV, F                   ; XOR last port value with new port value    


The handler is pretty comprehensive. As soon as port B interrupt occur it is compared with the previous value. The xorwf into RBSAV will result in byte showing any pins that have changed. I quickly clear the interrupt flag and deal with the pins that have changed in the routine before leaving.


The key interrupts are spark pulse interrupt and and TDC interrupt and these do not occur at the same time.

Thanks for the repsonses guys. I got none on the megasquirt forum.
User avatar
EssEss
LQFP112 - Up with the play
Posts: 244
Joined: Thu Sep 10, 2009 9:23 am
Location: Dayton, OH

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by EssEss »

swap with another pic to make sure that you didn't destroy the input previously.
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by MotoFab »

HOODEY wrote:Guys I am not controlling the engine. I am simply using the TDC and position information. If i have the TDC and spark pulse information feeding the port as soon as I connect the position information to the timer the engine stumbles.
Sorry for not keeping up, I prolly don't understand what the 3 inputs are. I apologize, could you explain them again?

Code: Select all

    movf PORTB,W							                               ; Save current port value to w
    movwf RBNEW                     ; Save port b reading
    xorwf RBSAV, F                   ; XOR last port value with new port value    
The handler is pretty comprehensive. As soon as port B interrupt occur it is compared with the previous value. The xorwf into RBSAV will result in byte showing any pins that have changed. I quickly clear the interrupt flag and deal with the pins that have changed in the routine before leaving.
I'm thinking an xor will evaluate to true on both the positive-going and negative-going edges of the signal, without any differentiation, could that be something?


The key interrupts are spark pulse interrupt and and TDC interrupt and these do not occur at the same time.
I'm sure I'm not getting something, are you polling for the input changes, or using the interrupt on change peripheral?


Thanks for the repsonses guys. I got none on the megasquirt forum.
Sure thing.
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by jharvey »

HOODEY wrote:The ECU has the pull up resistor so when I look at the cam and crank signal there are nice 5 volt pulses.
Hmmm, can the PIC be pulling the signal high, perhaps add a diode to make sure current only goes one way.
HOODEY wrote:Thanks for the repsonses guys. I got none on the megasquirt forum.
No problem. One thing that might help is to post pictures, or even a schematic of the setup.
HOODEY
DIP8 - Involved
Posts: 17
Joined: Mon Aug 17, 2009 4:03 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by HOODEY »

A resistor in series with the position signal solves the problem.

I am seeing an ignition timing of 65 degrees at idle but I believe it should be
15 degrees. I have adjusted the value. Wondering why I getting such a high value.Rpm looks correct. Windowing should be 10btdc to 50atdc.Still need to verify.


My assumption is that the 0-1 transition of the reference pulse is 120 is TDC.
A 1-0 transition is the start of the spark.My assumption must be wrong as I am getting more time between the spark and TDC than is expected.


My assumption is that if I am on cylinder 1 compression 120btdc then cylinder 6 is at TDC on the power stroke.


http://bajanchameleon.com/knock_nissan.wmv

The first screen shows on line 3,4 (debugging)

time between spark and TDC,Time between sparks
Average of time to tdc(8values),ignition timing corrected,cylinder firing


Each instruction is 100ns with the timers set to a pre-scaler of 1:8
User avatar
jharvey
1N4001 - Signed up
Posts: 1607
Joined: Tue Jun 10, 2008 5:17 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by jharvey »

Sounds like the PIC was driving the signal high. The resistor prevent it from being able to drive it hard enough to bugger the signal. Can you disable the pull up?

Good job with getting it reading the signal(s).
HOODEY
DIP8 - Involved
Posts: 17
Joined: Mon Aug 17, 2009 4:03 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by HOODEY »

I am seeing an ignition timing of 65 degrees at idle but I believe it should be
15 degrees.


Anyone care to explain this? I think I have the solution but I am looking for feedback from others.
Locked