New CDI - opensource project JMJ and Bigboat
#1251
Member
Join Date: Sep 2006
Location: Steenwijkerwold, NETHERLANDS
Posts: 34
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Probably mentioned earlier is this topic but how should i adjust the variable resistor R3on the 2.3 version programmer?
As far as i can see the only difference between 2.2 and 2.3 is the variable resistor R3 and the added resistorR6 between D7 and ground.
Am i wright?
As far as i can see the only difference between 2.2 and 2.3 is the variable resistor R3 and the added resistorR6 between D7 and ground.
Am i wright?
#1252
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
The adjustment should be set at 10k ohms for most if not all the chips you will be programming. I have mine set at 10k and it works perfectly. That setting was mentioned on the RCD site I believe in the questions and answers section in one paragraph, so I followed that suggestion and it has been working.
You are right, the addition of the parts you mentioned are the only differences between 2.2 and 2.3 versions.
I hope this info is of some help to you.
John
You are right, the addition of the parts you mentioned are the only differences between 2.2 and 2.3 versions.
I hope this info is of some help to you.
John
#1254
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Rob,
Have you got your computer working again?
I saw you had problems with a virus..I hate those problems..
When you have a PCB for the new chip ready, I'll build one and test it. I saw back on page #49 that you posted the test function added back into Nyemi's code.. nice work.
I wish I could get my c code compiler to work..still can't make hex files.
John
Have you got your computer working again?
I saw you had problems with a virus..I hate those problems..
When you have a PCB for the new chip ready, I'll build one and test it. I saw back on page #49 that you posted the test function added back into Nyemi's code.. nice work.
I wish I could get my c code compiler to work..still can't make hex files.
John
#1255
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
I wish I had known he was using that long of a cable with the programmer! Oh well.. I plug the board right into the port on the back of my computer..no cable... I always wondered how it would work with a long cable..now I know! It doesn't !!
Thanks Rob !
John
Thanks Rob !
John
#1256
Senior Member
Thread Starter
Join Date: Dec 2005
Location: Alkmaar, NETHERLANDS
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Just wat you say.....the pc works, but it's hopeless without all my programs I use.
Now I have to reinstall the software and make all the settings.
Long weekend, maybe I can get it work.
I think I must wait a wile to make a new PCB [8D][:-].....sssstttttttt
Now I have to reinstall the software and make all the settings.
Long weekend, maybe I can get it work.
I think I must wait a wile to make a new PCB [8D][:-].....sssstttttttt
#1258
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Charlie, the problems I am having now are new to me. After I load the new project into Mikro-c compiler, I used to be able to scroll down the menu and select Build. Now it is greyed out and can't be selected. I'm not sure what I am doing wrong, but I had compiled our code before with it.
Another thing is, when it does work and I select where to save the file to, it does make the rest of the small files for configuration and all that, but the hex file is always missing from the file list when I look for it later.
Should I reinstall it and wipe out all the files I had made with it earlier? It's about the only thing I haven't tried.
John
Another thing is, when it does work and I select where to save the file to, it does make the rest of the small files for configuration and all that, but the hex file is always missing from the file list when I look for it later.
Should I reinstall it and wipe out all the files I had made with it earlier? It's about the only thing I haven't tried.
John
#1259
Senior Member
Thread Starter
Join Date: Dec 2005
Location: Alkmaar, NETHERLANDS
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Open project or make new project.
Copy/past the code into the screen and now you can make the hex (build)
BTW, it's also possible the work with MpLab IDE
http://www.test.gompy.net/mplab_v8.zip
Copy/past the code into the screen and now you can make the hex (build)
BTW, it's also possible the work with MpLab IDE
http://www.test.gompy.net/mplab_v8.zip
#1261
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
I was going to file, load c code, then click the menu to set chip and frequency of the oscillator, then build.
John
John
#1262
Senior Member
RE: New CDI - opensource project JMJ and Bigboat
Thats I think is the problem. Goto Project/Open Project and select your file with the .mcppi extention. Once its open then you can goto Program/edit program and change the fuses. Then compile.
#1263
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Charlie..
I got the compiler working now..thanks..
I tried rob's code back on page 49 with the test function added to Nyemi's code...programmed ok but won't work on my timer boards.. Was that complete code? Something seems wrong with it so I reprogrammed Nyemi's original fixed code for the hall effect and it works, but he has no test function in that code.. It works though so I guess I'll use that till he returns with the test function added back in.
John
I got the compiler working now..thanks..
I tried rob's code back on page 49 with the test function added to Nyemi's code...programmed ok but won't work on my timer boards.. Was that complete code? Something seems wrong with it so I reprogrammed Nyemi's original fixed code for the hall effect and it works, but he has no test function in that code.. It works though so I guess I'll use that till he returns with the test function added back in.
John
#1264
Senior Member
RE: New CDI - opensource project JMJ and Bigboat
Hi John,
Glad to see you got everything working. When I get time I will take a shot at adding th test fuction to Nyemi's code for the 16F628a and post it.
regards
Charlie
Glad to see you got everything working. When I get time I will take a shot at adding th test fuction to Nyemi's code for the 16F628a and post it.
regards
Charlie
#1265
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Thanks Charlie..
I noticed in the original code with test function that there were a few more lines referring to the test mode lines..didn't see it in what Rob posted. I also tried adding the lines back into it without success following previous code as examples. I love the wait on high pulse from hall effect of the new Nyemi code however and hope we can get the test function added back to that.
I also tried working with the excell sheet to make a new curve..that worked fine on the screen, but when I pressed the button to write c-code, it did nothing..made no file, asked no questions as to where I wanted to save it or even a filename.
I am using Open Office version 3.1 and when I load the excell sheet into it, I get a message about macros being embedded in the sheet that can't be executed due to the level of security the program is setup for.
How do I change that so the code writing function macro can be executed???
John
I noticed in the original code with test function that there were a few more lines referring to the test mode lines..didn't see it in what Rob posted. I also tried adding the lines back into it without success following previous code as examples. I love the wait on high pulse from hall effect of the new Nyemi code however and hope we can get the test function added back to that.
I also tried working with the excell sheet to make a new curve..that worked fine on the screen, but when I pressed the button to write c-code, it did nothing..made no file, asked no questions as to where I wanted to save it or even a filename.
I am using Open Office version 3.1 and when I load the excell sheet into it, I get a message about macros being embedded in the sheet that can't be executed due to the level of security the program is setup for.
How do I change that so the code writing function macro can be executed???
John
#1266
Senior Member
Thread Starter
Join Date: Dec 2005
Location: Alkmaar, NETHERLANDS
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Not only macro's to create the curve are inside the sheet but also visual basic tp create the code.
I don't know if OO can handle this both options from Exel.
I don't know if OO can handle this both options from Exel.
#1267
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Thanks Rob.. I'm sure that is the problem I have with the excel sheets.. I have Microsoft office here somewhere and will be installing it shortly on my computer. Then I can do some serious curve generation for my chips.
Did you change output pins on your edited Nyemi code? I tried your code and it programmed ok but doesn't function when I plug the 16f628 chip into the timer board..no output at all. Maybe I missed something in the compiler?
John
Did you change output pins on your edited Nyemi code? I tried your code and it programmed ok but doesn't function when I plug the 16f628 chip into the timer board..no output at all. Maybe I missed something in the compiler?
John
#1268
Senior Member
Thread Starter
Join Date: Dec 2005
Location: Alkmaar, NETHERLANDS
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
In and output pins arent changed in Nyeni-program.
I think I forgot this line
if (PORTB.F3) test(); //If test jumper is on jump to test function
It must to be write between the two lines below.
INTCON = 0; // clear INTCON
if (PORTB.F3) test(); //If test jumper is on jump to test function
// Delay Algorithm~ 65uS (16x4=64uS) Taken into account in completing the table!!
I think this must be fixe the problem.
I think I forgot this line
if (PORTB.F3) test(); //If test jumper is on jump to test function
It must to be write between the two lines below.
INTCON = 0; // clear INTCON
if (PORTB.F3) test(); //If test jumper is on jump to test function
// Delay Algorithm~ 65uS (16x4=64uS) Taken into account in completing the table!!
I think this must be fixe the problem.
#1269
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Rob, that line is in the program...I tried it again, still no action to the cdi. Did anyone test this on a timer and cdi board?
I tried 3 different chips and all same results...wonder what is going on..
I tried adding the test function back into his code also, adding that line and the first few test routine lines..got no errors compiling it, but still no functions. It seems to be going into a dead program loop. Ran it in the compiler to watch execution of each line..it stops after line 10 or 11... with a message "declared variable "i" but not called." I see the line it is declared..
John
I tried 3 different chips and all same results...wonder what is going on..
I tried adding the test function back into his code also, adding that line and the first few test routine lines..got no errors compiling it, but still no functions. It seems to be going into a dead program loop. Ran it in the compiler to watch execution of each line..it stops after line 10 or 11... with a message "declared variable "i" but not called." I see the line it is declared..
John
#1270
Senior Member
Thread Starter
Join Date: Dec 2005
Location: Alkmaar, NETHERLANDS
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
The problem, this week the backlight of my laptop is again broken (3x now) and I don't have install all the software on the desktop I use for now.
I hope next week to get my laptop back or get new from the store.
Maybe someone else will test the code for you.
I hope next week to get my laptop back or get new from the store.
Maybe someone else will test the code for you.
#1271
Senior Member
RE: New CDI - opensource project JMJ and Bigboat
Here is Nyemi's code with the test function. However there are some things that are different. The spark is generated at the leading edge of the magnet as opposed to the trailing edge. With portB.3 held high at startup test function is entered at 7500 rpm. IF portB.2 and 3 are then 300 rpm is obtained. Also PortB pullups are disabled. So a pull up resistor is needed at portB.1 for input.
void test() { //Generate test signal
while (1){
PORTB ^= 0x11; // sends a ground to the SCR gate
Delay_us(56); // send delay 56us scr
PORTB ^= 0x11; // ground off the SCR
if (PORTB & 0x04) delay_ms(200); // 300 rpm
else delay_ms(8); // 7500 rpm
} // end while (1) loop
} // end function test
void main()
{
const char tspark[]={ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 25, 25, 26, 27, 29, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 50, 50, 51, 52, 53, 54, 53, 54, 55, 53, 54, 55, 52, 52, 53, 54, 52, 53, 54, 54, 55, 50, 51, 52, 52, 53, 48, 48, 49, 50, 50, 51, 45, 45, 46, 46, 47, 47, 48, 45, 45, 46, 46, 47, 48, 48, 49, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60,
60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106, 107, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112};
char tspk,spark, t0;
CMCON = 0x07; // delete comparator module
TRISA = 0x00; // delete PORTA input
PORTA = 0x00; // PORTA low signal
TRISB = 0x0E; // set RB1 for input, all others for output
PORTB = 0x00; // set gate to SCR low i.e pin 6 of PIC, set gate to Strobelight ( TCI Output) high i.e pin 10 of PIC
OPTION_REG = 0x87; // set to 07=1:256 PRESCALER, 06=1:128 PRESCALER - tmr0 SOURCE INT CLOCK, Initial RPM:07=917rpm 06=1836rpm
TMR2 = 0;
PR2 = 255; // TMR2 Maximum Value 255x16uS=4,080mS
T2CON = 0x07; // start TMR2 counter 1:16 1 Table value:16uS (07=16uS)
INTCON = 0; // clear INTCON
if (PORTB.F3) test(); //If test jumper is on jump to test function
while(1){ //Loop forever
// Delay Algorithm~ 65uS (16x4=64uS) Taken into account in completing the table!!
while(1) // loop forever
{
while(PORTB ^ 0x00) // wait for high pulse on Hall switch
{
spark = 1;
} // North pole of magnet has passed
while(spark)
{
t0 = TMR0;
TMR0 = 0; // start new rev count
if(INTCON&4) tspk=255; // During the initial delay. 255x16uS=4,080mS
else tspk = tspark[t0]; // use table lookup for spark delay
T2CON = 0x07; // start TMR2 counter 1:16 1 Table value:16uS (07=16uS)
TMR2= 0; // clear spark timer
while(TMR2 < tspk); // loop until timeout to send spark
PORTB ^= 0x11; // take ground off the SCR
delay_us(40); // 500 us delay ( CDI= 500uS) (TCI=3300uS)
PORTB ^= 0x11; // sends a ground to the SCR gate
spark = 0;
INTCON = 0; // clear INTCON
} // end while spark loop
} // end loop forever
} // end of program
}
//nyemi
void test() { //Generate test signal
while (1){
PORTB ^= 0x11; // sends a ground to the SCR gate
Delay_us(56); // send delay 56us scr
PORTB ^= 0x11; // ground off the SCR
if (PORTB & 0x04) delay_ms(200); // 300 rpm
else delay_ms(8); // 7500 rpm
} // end while (1) loop
} // end function test
void main()
{
const char tspark[]={ 0, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 23, 25, 25, 26, 27, 29, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 48, 50, 50, 51, 52, 53, 54, 53, 54, 55, 53, 54, 55, 52, 52, 53, 54, 52, 53, 54, 54, 55, 50, 51, 52, 52, 53, 48, 48, 49, 50, 50, 51, 45, 45, 46, 46, 47, 47, 48, 45, 45, 46, 46, 47, 48, 48, 49, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 56, 57, 57, 58, 58, 59, 59, 60,
60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 68, 69, 69, 70, 70, 71, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 87, 88, 88, 89, 89, 90, 90, 91, 91, 92, 92, 92, 93, 93, 94, 94, 95, 95, 96, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 100, 101, 101, 102, 102, 103, 103, 104, 104, 104, 105, 105, 106, 106, 107, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112, 112};
char tspk,spark, t0;
CMCON = 0x07; // delete comparator module
TRISA = 0x00; // delete PORTA input
PORTA = 0x00; // PORTA low signal
TRISB = 0x0E; // set RB1 for input, all others for output
PORTB = 0x00; // set gate to SCR low i.e pin 6 of PIC, set gate to Strobelight ( TCI Output) high i.e pin 10 of PIC
OPTION_REG = 0x87; // set to 07=1:256 PRESCALER, 06=1:128 PRESCALER - tmr0 SOURCE INT CLOCK, Initial RPM:07=917rpm 06=1836rpm
TMR2 = 0;
PR2 = 255; // TMR2 Maximum Value 255x16uS=4,080mS
T2CON = 0x07; // start TMR2 counter 1:16 1 Table value:16uS (07=16uS)
INTCON = 0; // clear INTCON
if (PORTB.F3) test(); //If test jumper is on jump to test function
while(1){ //Loop forever
// Delay Algorithm~ 65uS (16x4=64uS) Taken into account in completing the table!!
while(1) // loop forever
{
while(PORTB ^ 0x00) // wait for high pulse on Hall switch
{
spark = 1;
} // North pole of magnet has passed
while(spark)
{
t0 = TMR0;
TMR0 = 0; // start new rev count
if(INTCON&4) tspk=255; // During the initial delay. 255x16uS=4,080mS
else tspk = tspark[t0]; // use table lookup for spark delay
T2CON = 0x07; // start TMR2 counter 1:16 1 Table value:16uS (07=16uS)
TMR2= 0; // clear spark timer
while(TMR2 < tspk); // loop until timeout to send spark
PORTB ^= 0x11; // take ground off the SCR
delay_us(40); // 500 us delay ( CDI= 500uS) (TCI=3300uS)
PORTB ^= 0x11; // sends a ground to the SCR gate
spark = 0;
INTCON = 0; // clear INTCON
} // end while spark loop
} // end loop forever
} // end of program
}
//nyemi
#1272
Senior Member
Join Date: Nov 2005
Location: Hamburg,
PA
Posts: 805
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Charlie, I am going to download your code and compile it.. Was there a reason you switched it back to firing at the leading edge instead of leaving it the way it was? If I read the code right, It is almost a duplicate copy of our old code...but I'll try it.
I was successful at adding the test routine back into Nyemi's code.. I was getting confused with the routines and sub-routines calling different instruction lines. I think I understand most of what I did now...hopeing it all works so I can erase the 15 other copies of code for the chips..too many on my hard drive, and it's getting tough naming them all different to tell them apart.
John
I was successful at adding the test routine back into Nyemi's code.. I was getting confused with the routines and sub-routines calling different instruction lines. I think I understand most of what I did now...hopeing it all works so I can erase the 15 other copies of code for the chips..too many on my hard drive, and it's getting tough naming them all different to tell them apart.
John
#1273
Senior Member
Thread Starter
Join Date: Dec 2005
Location: Alkmaar, NETHERLANDS
Posts: 548
Likes: 0
Received 0 Likes
on
0 Posts
RE: New CDI - opensource project JMJ and Bigboat
Normaly you take the ricing edge to start counting.
You never know when the magnet leave the hallfeeld.
====
delay_us(40); // 500 us delay ( CDI= 500uS) (TCI=3300uS)
====
The delay is in this line 40 us and not 500 or 3300 !!
====
if (PORTB.F3) test(); //If test jumper is on jump to test function
while(1){ //Loop forever
// Delay Algorithm~ 65uS (16x4=64uS) Taken into account in completing the table!!
while(1) // loop forever
{
====
Twice while, why ??
You never know when the magnet leave the hallfeeld.
====
delay_us(40); // 500 us delay ( CDI= 500uS) (TCI=3300uS)
====
The delay is in this line 40 us and not 500 or 3300 !!
====
if (PORTB.F3) test(); //If test jumper is on jump to test function
while(1){ //Loop forever
// Delay Algorithm~ 65uS (16x4=64uS) Taken into account in completing the table!!
while(1) // loop forever
{
====
Twice while, why ??
#1274
Senior Member
RE: New CDI - opensource project JMJ and Bigboat
Hey Guys,
This is the reason for the change. With the test function and the pullups enabled when powering up the board the test function is entered. The only way I found not to do that is to disable the internal pull up resistors. For the when the timer board fires that was the only way I could get it to work with the internal pullups disabled. I will play around with it some more.
This is the reason for the change. With the test function and the pullups enabled when powering up the board the test function is entered. The only way I found not to do that is to disable the internal pull up resistors. For the when the timer board fires that was the only way I could get it to work with the internal pullups disabled. I will play around with it some more.