• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問16F84a.H是丟在那都找不到還是要正式板才有
#2
版主
版主


查看用戶資訊
程式裡有說要使用特定的 : PCW v2.619 Compiler,所以你要先有這個編譯器,不然你要修改成適合 Hi-Tech PICC or CCS 的程式。
Microchip 的 C18 只支援 PIC18Fxxxx 系列,目前不支援 PIC16Fxxx 系列的元件,所以你使用錯了 C Compiler所以編譯就會錯了。

發表於: 2008/2/13 8:49
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問16F84a.H是丟在那都找不到還是要正式板才有
#1
新會員
新會員


查看用戶資訊
請善心人事幫忙小弟是門外漢想diy玩玩
網路diy一個c語言的pic16f84a用的檔案我要
組譯成hex可是灌了以下的程式
MPLAB IDE v6.10
MPLAB IDE v7.20
MPLAB IDE v7.61
MPLAB IDE v8.0

MPLAB-C18 v3.12
MPLAB-C18 v3.15
都找不到~16F84a.H~這個檔案(有人知道那裡有嗎)
用MPLAB IDE都無法成功跑出路徑都ok
跑出以下錯誤
Make: The target "C:\me\ignition_tci_84.o" is out of date.
Executing: "C:\MCC18\bin\mcc18.exe" -p=16F84A "ignition_tci_84.c" -fo="ignition_tci_84.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 60
Error: unsupported processor 16F84A
Error executing C:\MCC18\bin\mcc18-traditional. Unknown error [errno = 0]
Halting build on first failure as requested.
BUILD FAILED: Wed Feb 13 07:02:31 2008



要組譯的檔案如下
//***************************************************************************
//******
//****** Digital Transistorized Ignition (TCI version). SPORTDEVICES SEP/29/2007
//******
//****** NOTE: use compiler: PCW v2.619
//******
//****** Digital parts: PIC16F84a, XTAL 4MHz
//****** Complete schematic: www.sportdevices.com/ignition/ignition_TCI_84.htm
//****** To ask any question: jandani@sportdevices.com
//******
//******
//****************************************************************************

#include <16F84a.H>
#fuses XT,NOWDT,PUT
#use fast_io(a)
#use delay(clock=4000000)
#define pickup PIN_B0 //pin 6
#define coil PIN_A2 //pin 1
#define LED PIN_A4 //pin 1
#use rs232(baud=19200, xmit=PIN_A3, rcv=PIN_A1)


//setup values
#define prescaler 7 //2^7=128
#define dwell_time 4000 //us
#define delay_multiple 8 //8 us, min 3 us
#define low_rpm_pulse true //does it generate pulses at low rpm?
#define low_rpm_multiple 40 //us, to calculate degrees at low rpm (8 * 2.5 = 40)
#define silent_time 1000 //silent time after spark to avoid false triggers
#define pulse_polarity 0 //0-activates low
#define min_rpm 200 //min rpm value, if lower the program starts again
#define min_period 31
//********
#define max_period (60000000/128/min_rpm) //(2^prescaler)

const byte ignition0[64]={
15,15,16,16,17,17,18,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,49,75,101,106,108,110,112,
114,116,118,119,121,123,125,127,129,131,133,135,137,138,140,142,144,146,148,150,152,154,156,157,159,161,163,165,167,169,
171,173,174,176,182};


#byte TMR0=0x01
#byte STATUS=0x03
#byte PORTA=0x05
#byte PORTB=0x06
#byte INTCON=0x0b
#byte OPTION_REG=0x81

#define perl make8(per,0)
#define perh make8(per,1)

int tmr0h,del;
int16 per,per_ant,dwell,per_tmp;
boolean first=true,second=true;

#byte W_TEMP=0x7f
int STATUS_TEMP;

#int_global
void int_tmr0()
{
//PUSH
#asm
movwf W_TEMP //store W and STATUS
swapf STATUS,w
movwf STATUS_TEMP
#endasm

if(tmr0h<0xff) tmr0h++;

bit_clear(INTCON,2);
if(tmr0h>(max_period/256+1))
{
//timeout is needed to prevent coil to burnout
first=true;
output_low(coil); //turn off the coil (residual spark will result)
}

//POP ****************************
#asm
swapf STATUS_TEMP,W
MOVWF STATUS
SWAPF W_TEMP,F
SWAPF W_TEMP,W
#endasm
}

void check_dwelltime()
{
if (!input(coil)) //is activated yet, if so-> don't waste time
{
if(tmr0h<max_period/256)
{
per=make16(tmr0h,TMR0);
if(per>dwell) output_high(coil); //start dwell time now
}
}
}

void wait_pulse()
{

#if pulse_polarity==0
while (!input(pickup)); //wait line goes high
while (input(pickup)) check_dwelltime(); //wait line goes low
#else
while (input(pickup)); //wait line goes low
while (!input(pickup)) check_dwelltime(); //wait line goes high
#endif

per=make16(tmr0h,TMR0);
TMR0=0; tmr0h=0;
}

void main(){

INTCON=0xa0; //T0IE=1
OPTION_REG=prescaler-1; //PULLUP on, 2^prescaler=128
set_tris_a(0x01);
set_tris_b(0x01); //PIN B0 input (curve selector)

#ifdef LED
output_low(LED);
delay_ms(50);
output_high(LED);
delay_ms(100);
#endif

dwell=0xffff; //first time

while (true)
{

//first pulse is not processed because the period can not be calculated until the second pulse
if(first) { wait_pulse(); first=false; second=true;}

wait_pulse();
if(second) {per_ant=per; second=false;}

output_high(coil); //start dwell time (if not started yet)

if ((per>=min_period)&&(per<min_period+sizeof(ignition0)))
{
del=perl-min_period;
#ifdef curve_sel
if(input(curve_sel))
del=ignition1[del];
else
#endif
del=ignition0[del];

del=del-8; //delay adjust (substract 8*4=32 us)
//do delay
#asm
bucle: #endasm
delay_cycles(delay_multiple-3);
#asm
decfsz &del,f
goto bucle
#endasm
}

else
{
if (per>=max_period) first=true; //if rpm is too slow, engine is stoped

#if low_rpm_pulse
else
if (per>=min_period+sizeof(ignition0))
{
per_tmp=per;
#asm
bcf 03,0
incf &per_tmp,F
incf &per_tmp+1,F
loop2: #endasm
delay_cycles(delay_multiple-3);
#asm
decfsz &per_tmp,f
goto loop2
decfsz &per_tmp+1,f
goto loop2
#endasm

}
#endif
}

output_low(coil); //fire or turn off the coil

dwell=per-(per_ant-per)-(dwell_time/128); //per - increment - dwell time
per_ant=per;

per=make16(tmr0h,TMR0);
dwell=dwell+per; //consider the delay from ref

delay_us(silent_time); //time after spark to avoid false triggers
} //while
} //main







發表於: 2008/2/13 7:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------