残った配線を取り付けました。
iPhone 002

盗難防止装置っぽいですね。
iPhone 003

PIC12F683を使ったCDIとしてはこれを最後にしたいのですが、、、
やっぱ8pinで作ると、なんだか気持ち良いですね。
この制限された能力でなんとかやりきる感覚。

YPVSコントローラは結構作成に準備がかかります。
以前作っていた時の環境を再構築する必要がありますから。

しっかしオスばっかり使うからメスが余る、、、。
iPhone 001

ちょっとこれ、調達を考えないとツライなぁ。


CDIをYPVS付きに改変するにあたり、大きくH/W側が変更になるのでチェンジログ的なエントリーを残しておきます。
いつものごとくいつまであるかは分かりません。

回路図はこちら
http://urana.info/rilassaru/pic/2013-10-16cdi12f.pdf

プロジェクトファイルはこちら
http://urana.info/rilassaru/pic/2013-10-16cdi12f.zip
点火時期設定ファイルはこちら
http://urana.info/rilassaru/pic/2013-10-16cdi12f.xls 
【アーカイブはこちらに移動しました】

パワーカーブはこちら
http://urana.info/rilassaru/fuchs20131007.pdf
このパワーチェックをした時の点火時期はこちら
e38d2a2a147dda6e01
パワーカーブは7000〜7500が凹んでいるのか、5000〜7000が凸っているのか。
この時BJチャンバーを付けていて、感覚的には凹んでいる様な。
7000位からパワーカーブのギザギザが発生してますから、きれいには回って無い感じがします。
SNSにあるカエゥさんのグラフを見ると8000位からギザギザしてますので、1000回転位差がありますね。

そーいえば、、、購入以来一回もエアクリ掃除してないな、、、

2.2uFのコンデンサについては、普通にイケてますが、費用対効果(1.5uFと200円差くらい)としてはどうかなってところです。
場所も結構とりますしね。
ただ、このトルク感は自分的には好きです。


メインコードは以下の通り。
いつものごとくBSDライセンスなんで、まぁ適当に無許可無承諾で使ってください。
保障は全くございません。
  [コードを表示する]
/** -----------------------------------------------------------------
 CDI12F
 build:   2013/10/16 version 1.2
 author:  Rilassaru
------------------------------------------------------------------ */

#include <htc.h>
//#include <string.h>
#define _XTAL_FREQ 8000000 	// 8MHz
#define SCR_OPEN	300		// SCR open time(us)

#define TRUE 1
#define FALSE 0
#define ON 1
#define OFF 0
#define UINT8	unsigned char
#define UINT16 unsigned int
#define UINT32 unsigned long

__CONFIG(
	FOSC_INTOSCIO &	// Internal osc.
	WDTE_OFF &		// Disable watch dog timer
	PWRTE_ON &		// Enable power on timer
	BOREN_ON &		// Enable brown out
	MCLRE_OFF &		// Disable ~MCLR
	CP_OFF &			// Disable Code protection
	IESO_OFF &		// Disable IE switch over
	FCMEN_OFF			// Disable Fail safe clock
	);

UINT16	gRPM = 0;
UINT8	gFirstSpark = TRUE;
UINT8 	gSW1 = 0;
#define	SW_BUF	256

/** -----------------------------------------------------------------
Ingition timing data
------------------------------------------------------------------ */
#define MIN_RPM	20	// from 2000rpm
#define MAX_RPM	120	// to 12000rpm
// Config value for TMR2
const UINT8 gtblT2CON[2][120]={
//  0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9    0    1    2    3    4    5    6    7    8    9
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0x3D,0x35,0x35,0x2D,0x2D,0x25,0x25,0x25,0x1D,0x74,0x6C,0x6C,0x64,0x64,0x5C,0x5C,0x54,0x54,0x4C,0x4C,0x44,0x44,0x44,0x3C,0x3C,0x3C,0x34,0x34,0x34,0x34,0x34,0x2C,0x2C,0x2C,0x2C,0x2C,0x24,0x24,0x24,0x24,0x24,0x24,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0x3D,0x35,0x35,0x2D,0x2D,0x2D,0x25,0x25,0x25,0x25,0x1D,0x74,0x6C,0x6C,0x64,0x5C,0x5C,0x54,0x54,0x54,0x4C,0x4C,0x4C,0x44,0x44,0x44,0x44,0x3C,0x3C,0x3C,0x3C,0x3C,0x34,0x34,0x34,0x34,0x34,0x34,0x2C,0x2C,0x2C,0x2C,0x2C,0x2C,0x2C,0x2C,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x1C,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,}
};

const UINT8 gtblPR2[2][120]={
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF2,0xE1,0xEE,0xDE,0xF1,0xE1,0xFA,0xE8,0xD7,0xFA,0xF7,0xFD,0xF2,0xF9,0xEF,0xF8,0xEC,0xF6,0xEA,0xF6,0xEB,0xFA,0xF1,0xE8,0xFB,0xF1,0xE8,0xFF,0xF6,0xED,0xE4,0xDC,0xF8,0xEF,0xE7,0xDF,0xD7,0xF9,0xF0,0xE8,0xE0,0xD8,0xD1,0xFC,0xF3,0xEA,0xE2,0xDA,0xD2,0xCA,0xC3,0xFA,0xF1,0xE8,0xDF,0xD6,0xCE,0xC6,0xBE,0xB6,0xAE,0xFB,0xF0,0xE6,0xDB,0xD1,0xC7,0xBE,0xB5,0xAB,0xA2,0x9A,0x91,0x89,0x81,0xF2,0xE2,0xD2,0xC3,0xB5,0xA6,0x9D,0x95,0x8C,0x84,0x7B,0x73,0x6B,0x63,0x5C,0x54,0x4D,0x46,0x3F,0x38,0x31,0x2A,0x23,0x1D,0x16,},
{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF2,0xE2,0xF1,0xE1,0xF6,0xE6,0xD9,0xF6,0xE8,0xDB,0xCF,0xF5,0xF8,0xFC,0xEE,0xF3,0xFD,0xF3,0xFF,0xF5,0xEC,0xFB,0xF4,0xEC,0xFF,0xF7,0xF0,0xE9,0xFF,0xF8,0xF1,0xEB,0xE4,0xFE,0xF7,0xF1,0xEB,0xE5,0xDF,0xFE,0xF8,0xF2,0xEC,0xE6,0xE0,0xDB,0xD6,0xFB,0xF5,0xEF,0xEA,0xE4,0xDF,0xDA,0xD5,0xD0,0xFF,0xF9,0xF4,0xEE,0xE9,0xE4,0xDF,0xDA,0xD5,0xD0,0xCC,0xC7,0xC3,0xFE,0xF9,0xF3,0xEE,0xE9,0xE4,0xDF,0xDA,0xD5,0xD1,0xCC,0xC7,0xC3,0xBF,0xBB,0xB6,0xB2,0xAE,0xAA,0xFA,0xF4,0xEF,0xE9,0xE4,0xDF,0xDA,0xD5,0xCD,0xC5,0xBD,0xB6,}
};

/** -----------------------------------------------------------------
           1|VDD    PIC12F683    VSS|8
  IN SW1-> 2|GP5             GP0/AN0|7 -x OPEN
 OUT SCR<- 3|GP4             GP1/AN1|6 -> OUT LED
  OPEN  x- 4|GP3/~MCLR  GP2/AN2/CCP1|5 <- IN  PULSE (Input capture)
------------------------------------------------------------------ */
#define SCRGATE	GP4
#define LED		GP1
#define SW1		GP5

/** -----------------------------------------------------------------
 void main(void)
------------------------------------------------------------------ */
void main(void)
{
	OPTION_REG = 0b10000010;	// No PU
	WPU        = 0b00000000;	// No PU
	OSCCON     = 0b01110000;	// 8MHz
	TRISIO     = 0b00100100;	// GP5(I)/GP4(O)/GP3(O)/GP2(I)/GP1(O)/GP0(O)
	ANSEL      = 0b00000000;	// Disaboe all ADC
	CMCON0     = 0x7;			// Disable comparator
	ADCON0     = 0b00000000;	// not use
	CCP1CON    = 0b00000000;	// CCP1 reset

	SCRGATE = 0;

	// Initialize Input capture
	CCP1CON = 0b00000101;	// Every rising edge
	CCP1IF  = 0;			// IF reset

	// Set Timer1
	T1CON  = 0b00010100;	// T1CKPS 1:2
	TMR1IF = 0;
	TMR1L  = 0;
	TMR1H  = 0;
	
	// Set Timer2
	T2CON = 0;
	TMR2IF = 0;
	PR2 = 0;
	
	// Initialize interrupt setting
	GIE = 1;
	PEIE = 1;
	TMR1IE = 1;		// Timer1 intterupt on
	TMR2IE = 1;		// Timer2 intterupt on
	TMR1ON = 1;		// Timer1 start
	CCP1IE = 1;		// Capture interrupt on

	LED = 1;
	__delay_ms(5000);
	LED = 0;

	// Main loop
	while(1) {
		int count = 0;
		for(int ii = 0; ii < SW_BUF; ii++) {
			count += SW1;
		}
		gSW1 = ((count >= (SW_BUF/2)) ? 1 : 0);
		LED = gSW1;
		//LED = 1;
	}
}


/** -----------------------------------------------------------------
  void interrupt ISR(void)

------------------------------------------------------------------ */
void interrupt ISR(void)
{
	
	// Interrupt from Input capture
	if(CCP1IF) {
		signed char deg;
		UINT16 ccpr1;

		// Reset Timer1
		TMR1H=0;
		TMR1L=0;
		
		// RPM
		ccpr1 = ((CCPR1H * 0x100)|CCPR1L) + 1;
		gRPM = (UINT16)(600000UL/ccpr1);
		
		if((MAX_RPM > gRPM) && (gRPM >= MIN_RPM)){
			PR2   = gtblPR2[gSW1][gRPM];
			T2CON = gtblT2CON[gSW1][gRPM];
		} else {
			T2CON = 0;
		}
		CCP1IF = 0;
	}

	// Timer1: Timeout means engine stop
	if(TMR1IF) {
		gFirstSpark = TRUE;
		gRPM = 0;

		// Reset intterupt
		TMR1IF = 0;
	}

	// Timer2: Timeout then SCR on
	if(TMR2IF) {
		// Stop Timer2
		TMR2ON = 0;
		SCRGATE = !gFirstSpark;
		__delay_us(SCR_OPEN);
		SCRGATE = 0;
		gFirstSpark = FALSE;

		// Reset intterupt
		TMR2IF = 0;
	}

}

/*---------------------------------------------------------------------------------
Copyright 2012-2013 Rilassaru All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this list
   of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this
   list of conditions and the following disclaimer in the documentation and/or
   other materials provided with the distribution.
 * Neither the name of the IshiSoft nor the names of its contributors may be used
   to endorse or promote products derived from this software without specific prior
   written permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

*/