• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: dspic 4011 程式執行後 會自動停止
#2
新會員
新會員


查看用戶資訊
在主程式的RETURN前一行加上 While(1);
如此程式不會自動停止了

發表於: 2008/9/18 11:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


dspic 4011 程式執行後 會自動停止
#1
新會員
新會員


查看用戶資訊
大家好
我是dspic的新手
我是用dspic 4011
板子是app009
程式是用修改MC LV Lab2的程式
#include "p30F4011.h"
#define FCY  10000000
#define MILLISEC FCY/10000
#define S9 PORTBbits.RB6

unsigned char SSTIndex 0;
void DelayNmSec(unsigned int N);
void InitTMR1(void);

const 
unsigned int SixStepTable[] = 
                   {
0x0016,  0x0014 };

void __attribute__((__interrupt__)) _T1Interrupt(void)
{
    
IFS0bits.T1IF 0;
    
OVDCON = (int)SixStepTable[SSTIndex++];
    if (
SSTIndex == 2)
        
SSTIndex 0;
    return;        
}

int main(void)    
{

    
ADPCFG 0xFFF8;
    
PWMCON1 0x0F77;
    
PTCONbits.PTEN 1;
    
InitTMR1();

for(;; )
    {
        
OVDCON 0;
        while (
S9);    
        
DelayNmSec(30);
        while (!
S9);    
        
DelayNmSec(30);
        
T1CONbits.TON 1;    // turn on T1
        
while (S9);    
        
DelayNmSec(30);
        while (!
S9);    
        
DelayNmSec(30);
        
T1CONbits.TON 0;    
    }

    return ;
}

void DelayNmSec(unsigned int N)
{
    
unsigned int j;
    while(
N--)
         for(
j=0;MILLISEC;j++);
    return;
}

void InitTMR1(void)
{
    
TMR1 0x0000;
    
PR1 =  65535;
    
T1CON 0x0000;
    
IFS0bits.T1IF 0;
    
IEC0bits.T1IE 1;
    return;
}

按下按鈕 執行大約15妙後
就會停止
請問各位先進們
是程式的問題
還是電路板的不一樣所造成的
我該怎麼解決
先謝各位

發表於: 2008/9/8 15:44

Edited by Ryang on 2008年09月10日 08:28:07
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... ]

教育訓練中心

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