![]() |
RE: New CDI - opensource project JMJ and Bigboat
Don't tell anybudy, secret information http://www.motelek.net/andere/cdi/
|
RE: New CDI - opensource project JMJ and Bigboat
ORIGINAL: nyemi Old C-code will give you back. No test. Minimum RPM 917(OPTION_REG 0x07). No bugs(<span id="result_box" class="short_text"><span style="background-color: rgb(255, 255, 255);" title="optimalizál">optimization</span></span><span class="short_text" id="result_box"><span title="javitva" style="background-color: rgb(255, 255, 255);">)http://www.rcuniverse.com/forum/js/f...eeth_smile.gif</span></span>. Sorry web translatehttp://www.rcuniverse.com/forum/js/f...ssed_smile.gif.<span class="short_text" id="result_box"><span title="üdvözlettel" style="background-color: rgb(255, 255, 255);"> Link:</span></span><font size="2" color="#000000">http://www.elektroworld.info/ftp/index.php?action=downloadfile&filename=cdinobu g.zip</font><span class="short_text" id="result_box"><span title="üdvözlettel" style="background-color: rgb(255, 255, 255);"> Regards nyemi. </span></span> I'm trying to improve timer2 (ignition delay) by using timer1 instead, because timer1 is 16bit. I'm getting errors when I try to compile the code I posted.. |
RE: New CDI - opensource project JMJ and Bigboat
Whooo that was a good find Rob.....i downloaded those before they go offline haha
|
RE: New CDI - opensource project JMJ and Bigboat
check this Guys Circuit out............it draws only 100ma @ 12volts
http://www.youtube.com/watch?v=hFUa7...eature=related i need it brett |
RE: New CDI - opensource project JMJ and Bigboat
ORIGINAL: kermet Whooo that was a good find Rob.....i downloaded those before they go offline haha |
RE: New CDI - opensource project JMJ and Bigboat
ORIGINAL: Rallyfinnen ORIGINAL: nyemi Old C-code will give you back. No test. Minimum RPM 917(OPTION_REG 0x07). No bugs(<span id=''result_box'' class=''short_text''><span style=''background-color: rgb(255, 255, 255);'' title=''optimalizál''>optimization</span></span><span class=''short_text'' id=''result_box''><span title=''javitva'' style=''background-color: rgb(255, 255, 255);''>)[img][/img]</span></span>. Sorry web translate[img][/img].<span class=''short_text'' id=''result_box''><span title=''üdvözlettel'' style=''background-color: rgb(255, 255, 255);''> Link:</span></span><font size=''2'' color=''#000000''>http://www.elektroworld.info/ftp/index.php?action=downloadfile&filename=cdinobug.zi p</font><span class=''short_text'' id=''result_box''><span title=''üdvözlettel'' style=''background-color: rgb(255, 255, 255);''> Regards nyemi. </span></span> I'm trying to improve timer2 (ignition delay) by using timer1 instead, because timer1 is 16bit. I'm getting errors when I try to compile the code I posted.. |
RE: New CDI - opensource project JMJ and Bigboat
It seems timer1 can only be read and written in two separate 8bit blocks:
TMR1H = 0; // Reset timer1 high bits TMR1L = 0; // Reset timer1 low bits The above gives no errors in compilation, but when the timer value should be compared to the tspk value, then there is a problem.. This does not work: while(TMR1 < tspk); Somehow it needs to be done in steps comparing to TMR1H and TMR1L I think.. Seems the processor is only able to handle 8bit values.. :( Not sure how that could be solved? Changing the array to have the double amount of data blocks, one for TMR1H and one for TMR1L? Suggestions welcome as usual ;) |
RE: New CDI - opensource project JMJ and Bigboat
ORIGINAL: Bigboat ORIGINAL: Rallyfinnen ORIGINAL: nyemi Old C-code will give you back. No test. Minimum RPM 917(OPTION_REG 0x07). No bugs(<span id="" result_box="" short_text=""><span style="" background-color:="" title="" optimalizál="">optimization</span></span><span short_text="" id="" result_box=""><span title="" javitva="" style="" background-color:="">)[img][/img]</span></span>. Sorry web translate[img][/img].<span short_text="" id="" result_box=""><span title="" üdvözlettel="" style="" background-color:=""> Link:</span></span><font size="" color="">http://www.elektroworld.info/ftp/index.php?action=downloadfile&filename=cdinobu g.zip</font><span short_text="" id="" result_box=""><span title="" üdvözlettel="" style="" background-color:=""> Regards nyemi. </span></span> I'm trying to improve timer2 (ignition delay) by using timer1 instead, because timer1 is 16bit. I'm getting errors when I try to compile the code I posted.. EDIT: To clarify what I can understand of the code.. Timer0 is used for rpm calculation, and that determines what position of the tspark array is used for the delay calculation, for example, if the timer0 counter has counted to 10 between triggers, the value from the array tspark [position 10] will be used. The value from the array is then used as a variable called tspk, and compared to timer two. When the timer has reached the value och tspk, a pulse is sent to the output. This determines the delay of the spark. In my opinion, the timers are totally independent of eachother. Maybe the reason for using timer 0 and 2 is because of the compexity of timer 1I mention in my post above..? |
RE: New CDI - opensource project JMJ and Bigboat
Thats wat I mean, there wiil be used two timers and I did know both where 8 bit.
Maybe it's possible to set the ocsilator from 4 to 20 Mhz or use a other pic. I'll write a flowdiagram and ask a friend of my if he can write a new program for us. With a flowdiagram you show wat the pic have todo and how to handle. |
RE: New CDI - opensource project JMJ and Bigboat
Hi Rallyfinnen, Try this: make a word size variable i.e TEST test= TMR1H <<8 ; shift eight steps left test= test + TMR1L ; or include built_in.h to use the Hi and Lo functions Lo(test)=TMR1L; Hi(test)=TMR1H; I posted a question on the MikroC forum and this was the answer I got. Hope it works. |
RE: New CDI - opensource project JMJ and Bigboat
I know what I want to do, but I don't know how to do it ;)
I would like to merge the two values from TMR1L and TMR1H in binary form into the variable tspk, and use it for the delay calculation, but I have no idea how to do this in the code, especially without wasting processor capacity and making the processing delay longer..! Well, I'm not sure binaryform is needed, but they would need to be merged in a way to give them the rigt signifivance, since bit 0-7 is in TMR1L, and bit 8-15 is in TMR1H. Doing this would give the high 16bit resolution value from the timer for the delay calculation. |
RE: New CDI - opensource project JMJ and Bigboat
|
RE: New CDI - opensource project JMJ and Bigboat
Hi Rallyfinnen,
You know what you want to do better then me. You could post your question on the mikroC forum. http://www.mikroe.com/forum/viewforum.php?f=88 |
RE: New CDI - opensource project JMJ and Bigboat
Hi Rallyfinnen,
the example does add the two, timer1.highbyte and timer1.lowbyte. You may have to to read the datasheet on the pic I think you have to read the highbyte first or the lowbyte first. |
RE: New CDI - opensource project JMJ and Bigboat
Thank you for the hints! Below is now what I have been able to put together. The delays for starting revs were using too much memory, so I had to get rid of them and just substitute the same value up to 1832rpm.
I am a bit concerned that there might be a bug in the counter reading though. If the high counter changes during the cycle(s) needed to read the low counter, there might be a glitch in the ignition timing..? if(spark){ t0 = TMR0; TMR0 = 0; //Start new rev count if(ofc > 0) t0=255; //Overflow timer0, we have < 1832 RPM tspk = tspark[t0]; //use table lookup for spark delay T1CON = 0x05; // start TMR1 counter 1:1 using internal clock ??TMR1ON 0x04 or 0x05?? TMR1H = 0; // Reset timer1 high TMR1L = 0; // Reset timer1 low do //start of timing loop {Hi(t1)=TMR1H; // read timer1 Low bits and add to timer variable Lo(t1)=TMR1L; } // read timer1 High bits and add to timer variable while(t1 < tspk); // loop until timeout to send spark PORTB &= 0xee; //sends a ground to the SCR gate Delay_us(1650); // Calculated delay PORTB |= 0x11; //ground off the SCR spark = 0; I will see what happens with this code once I have modified the excel sheet to give new values in the tspark array. |
RE: New CDI - opensource project JMJ and Bigboat
Amazingly, at first test it seems to work :D
Running a curve with a constant 30deg, and it stays at that angle. Now my timing lamp seems to be giving up, but I don't care :) |
RE: New CDI - opensource project JMJ and Bigboat
OK, wat must be change ?
I think I found some help, but I need to know all the problems. 1 - below 1800rpm the ignition is a mess, it must be staddy at (input exelsheet) 2 - low (1800)rpm must be lower like 600rpm 3 - pickup must be variable between (input exelsheet) 4 - more acurate over the total rpm-band 5 - ? |
RE: New CDI - opensource project JMJ and Bigboat
Hi Rob,
I think for us airplane guys we need it to retard the timing for starting. So the prop won't kick. So if the POP is set to 30 degrees it needs to retard the timing to around 5 degrees to start and then go to advanced. Thanks. |
RE: New CDI - opensource project JMJ and Bigboat
ORIGINAL: Bigboat OK, wat must be change ? I think I found some help, but I need to know all the problems. 1 - below 1800rpm the ignition is a mess, it must be staddy at (input exelsheet) 2 - low (1800)rpm must be lower like 600rpm 3 - pickup must be variable between (input exelsheet) 4 - more acurate over the total rpm-band 5 - ? 2. Could be possible by changing timer0 prescaler to 256.. then the lowest point would be abt 600rpm 3. Pickup needs an advance of abt 100us on the maximum rpm with the new code (processor delay has gone up to 90us with the new code) . So lower max rpm needs less advance. ~6deg @10k 4. Yes, mainly on high rpm. I think the old code was good enough for rpm up to 10k if you just add the pre-trigger. The pre-trigger needs to be ~4deg @ 10k using the old code. I think for engines up to 10k max rpm, you can use the old code, and just add the pre-trigger to make it more accurate, and you will have a good ignition also for starting etc. The new code is better for 20k rpm engines. (well, the new code is just a preliminary code, might find problems with it still..) |
RE: New CDI - opensource project JMJ and Bigboat
This is the 'HighRev_beta_code' that seems to work. It has zero delay in tspark since this is the one I sued to measure the processing delay.
#include <built_in.h> void main() { // This code has been changed from the original CDI code, to be able to accurately control ignition up to 20.000rpm. Ignition angle <1832 RPM is unregulated. Processing delay is 90us. Pretrigger needs to be set at ~16deg for 20k max RPM! const unsigned int tspark[]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // Data type changed to int for 16bit timer values short int spark=0; unsigned int tspk, t0,t1; unsigned int ofc; //Holds number of overflows TRISB = 0x0E; // set RB1,2,3 for input, all others for output RB0=SCR RB4=Strobe PORTB = 0x11; // set gate to SCR high i.e pin 6 of PIC +strobe OPTION_REG = 0x06; // tmr0 SOURCE INT CLOCK, 1:128 PRESCALER INTCON = 0x00; //Disable interrupts +Resets interrupt flags T1CON = 0x05; // start TMR1 counter 1:1 using internal clock 1MHz TMR1H = 0; // Reset timer1 high TMR1L = 0; // Reset timer1 low TMR0 = 0; // Reset timer0 PR2 = 255; // This is how far timer2 counts before overflow while(1){ //Loop forever ofc=0; // Reset overflow teller INTCON = 0x00; // Disable interrupts + Resets interrupt flags while(PORTB & 0x02){ //Wait for low pulse on Hall switch if (INTCON&4) { // Overflow ofc++; //Increase overflow counter INTCON = 0x00; // Resets interrupt flags } // End IF spark = 1; } //North pole of magnet has passed if(spark){ t0 = TMR0; TMR0 = 0; //Start new rev count if(ofc > 0) t0=255; //Overflow timer0, we have < 1832 RPM -Use 1832rpm delay for this tspk = tspark[t0]; //use table lookup for spark delay T1CON = 0x05; // start TMR1 counter 1:1 using internal clock 1MHz TMR1H = 0; // Reset timer1 high TMR1L = 0; // Reset timer1 high do //start of timing loop {Hi(t1)=TMR1H; // read timer1 Low bits and add to timer variable Lo(t1)=TMR1L; } // read timer1 High bits and add to timer variable while(t1 < tspk); // loop until timeout to send spark PORTB &= 0xee; //sends a ground to the SCR gate Delay_us(1650); // Calculated delay PORTB |= 0x11; //ground off the SCR spark = 0; } // end if(spark) } // end while(1) } // end main //Sam<br type="_moz"/> |
RE: New CDI - opensource project JMJ and Bigboat
Oeps......The guy burn the code down.......:eek:
The calculation is wrong and not the way has to be. He mention also the timer (!!), why not use timer1 I hope he will rewrite the code into a simple way. First contact, he want ad buttons and lcdscreen to setup the CDI. I think this is not wat we want for now, we have already the hardware but not good software. |
RE: New CDI - opensource project JMJ and Bigboat
Yeah, I'm sure I made mistakes, I'm not a programmer so I'm amazed I could even get it compiled ;)
However, from the tests with timing light on the engine, it seems to work. If i set the ignitin to 30deg, it seems to stay at 30 (trigger at 47, and stock ignition firing at 40 without contoller. Also tried with a variable curve now, and the timing is changing. However, as I mentioned before, the timing light is only working intermittantly now so I can't get consistant readings.. Hope he comes up with a nice stable and efficient code. I was thinking that a rev-limiter might be a nice feature.. shold be quite easy to incorporate in the code I think? |
RE: New CDI - opensource project JMJ and Bigboat
Two guys are intrest to help !!
The firts wiil ad a rs232 so we can program/optimize/readout online/realtime !! I'm happy and hope they help us to complete the CDI / TCI |
RE: New CDI - opensource project JMJ and Bigboat
Hi Rob,
That will be nice.Thanks. |
RE: New CDI - opensource project JMJ and Bigboat
This is great news Rob! Hope they can get the features figured out.. We needed this. Thanks!!!
John:D:D:D |
| All times are GMT -8. The time now is 04:12 AM. |
Copyright © 2026 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.