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.
Locked
deviousKA
QFP80 - Contributor
Posts: 43
Joined: Tue Apr 01, 2008 10:36 pm
Location: Id, USA
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by deviousKA »

I dont follow C too quickly with all the squiggly lines, but I see you do have some sync code already using the inner slot + outer slot of the CAS.

You shouldnt have to verify all inner slots (in order) to get a usable sync, just find a single distinct (longest?) pulse, that should be adequate. Also look into output compare for the division, your code should only need to be a few lines in total for what you want to do, and run mostly in hardware.
User avatar
Fred
Moderator
Posts: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by Fred »

seank wrote:plus I have had too many people tell me I cant do it.
Awesome, my kind of man! :-)

Devious :

I think provided the ONLY thing he does in the ISR is increment a counter for it then it will be OK to some RPM. Maybe not enough for the skyline motor, but probably enough for the v8.

With the counter counting he can get full sync just by seeing how many have come past in the window (as you well know, sorry for telling daddy how to suck eggs).

Sean is also (rightly) concerned about the spark accuracy when only triggering once per event. I'm not sure its definitely an issue, but it's worth trying out IMO. He can always abandon the idea and go back to counting slots if it doesn't work out at higher rpm.

Thanks for your posts too btw! :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
deviousKA
QFP80 - Contributor
Posts: 43
Joined: Tue Apr 01, 2008 10:36 pm
Location: Id, USA
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by deviousKA »

http://www.kopfweb.de/Downloads/K9S12X.pdf

DL that pdf and then open S12ECT16B8V2 document, it looks to have all of the information for setting input capture/output compare.

Im not all too familiar with the S12 (never really used one yet), or C programming, or this code in general, but setting up output compare to divide the external clock (CAS input in this case) is just a matter of setting up a few control registers and getting the interrupts configured properly.

EDIT:, Missed a couple posts there looks like. I hope I dont come across too strong of language or anything, im no super expert myself just sharing ideas. In no way am I saying Sean's method was bad or wrong.

I generally do not read enough before I make a post also.....
User avatar
SleepyKeys
LQFP144 - On Top Of The Game
Posts: 549
Joined: Mon Feb 11, 2008 10:52 pm
Location: Arizona
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by SleepyKeys »

Not at all, I appreciate your input.

The trick would be to getting it to "hardware divide" mode after its synced. Cant just have start dividing by 8 right off the bat. Once synced it can be put into "hardware divide" mode. Then I'll have to think of a way to check up on it, and make sure nothing was missed/added.

-sean
You snooze, you lose!
User avatar
Fred
Moderator
Posts: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by Fred »

deviousKA wrote:I hope I dont come across too strong of language or anything
Not at all man, the only person regularly in danger of doing that is me ;-)

I think you might be talking about the accumulator feature as discussed earlier in the thread. If so, the way I would use it (as also discussed earlier in the thread) is to just have it counting and check the count on the main slot edges to determine which one you are on. That should mean no load, simple code and instant sync. Just the fine grained triggering is missing, but that might be a pipe dream anyway.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
deviousKA
QFP80 - Contributor
Posts: 43
Joined: Tue Apr 01, 2008 10:36 pm
Location: Id, USA
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by deviousKA »

Fred wrote: I think you might be talking about the accumulator feature as discussed earlier in the thread. If so, the way I would use it (as also discussed earlier in the thread) is to just have it counting and check the count on the main slot edges to determine which one you are on. That should mean no load, simple code and instant sync.
Yeah, ive just been looking into that in the last few hours and it seems using the output compare in that fashion (disconnected from output pin, and toggling software interrupt) is pretty simple to do with this MCU. I have done this with AVR's to decode the nissan CAS, functioning as a ignition demultiplexer.

Its really difficult to come to grips with the amount of resources and performance this s12 with the xgate has. I want to mess with one bad but the cost is a bit prohibitive right now, maybe have to wait till Christmas.

Good example of input capture, output compare with examples in C,
http://www.ee.nmt.edu/~erives/308_07/Notes16.pdf
User avatar
Fred
Moderator
Posts: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by Fred »

deviousKA wrote:I have done this with AVR's to decode the nissan CAS, functioning as a ignition demultiplexer.
Feel free to post your code :-)

I see what you mean now about using the OC function.

Grepping the code shows two links to that site already ;-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
BenFenner
LQFP144 - On Top Of The Game
Posts: 360
Joined: Wed Jul 09, 2008 3:15 pm

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by BenFenner »

deviousKA wrote:Why are you needing to do this though?
He's doing it for all of us Nissan folk (some GM people too?). ;)
User avatar
SleepyKeys
LQFP144 - On Top Of The Game
Posts: 549
Joined: Mon Feb 11, 2008 10:52 pm
Location: Arizona
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by SleepyKeys »

BenFenner wrote:
deviousKA wrote:Why are you needing to do this though?
He's doing it for all of us Nissan folk (some GM people too?). ;)
Exactly! 90/10 between niss and gm users who will appreciate the decoder. Only 1 engine from GM used the niss cas wheel.

Hopefully I'll have time tonight to look over our timer options.

deviousKA- like fred said feel free to post your code :)

Thank,
seeean
You snooze, you lose!
User avatar
Fred
Moderator
Posts: 15433
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Decoding Nissan style Mitsi Electric 360 slot cam sensors

Post by Fred »

http://www.ms3efi.com/viewtopic.php?f=6&t=15

copy and paste the link as always.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Locked