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

論壇索引


Board index » All Posts




Re: PIC12F629使用ICD2如何進Debugger模式?
資深會員
資深會員


某些特定的ECU無法直接除錯,12F629就是其中之一,必須購買HEADER(AC162050)來除錯~

發表於: 2005/9/9 20:58
頂部


Re: 為何PIC12F629 timer1誤差這麼大, 快吐血了!!!
資深會員
資深會員


您知道內部RC振盪本身的誤差有多少嗎?看了一下data sheet,就算是填入校正值到OSCCAL,也還有大約有2%的誤差。您的誤差還不到1%,真是可喜可賀!

跟timer1關係不大。

勸您快快回頭是岸,外接crystal,情況保證大幅改善。

發表於: 2005/9/9 20:31
頂部


PIC12F629使用ICD2如何進Debugger模式?
新會員
新會員


大家好:
請問 一下, 我在使用MPLAB IDE + HI TECH C編輯程式時, 可以進Programmer模式燒錄, 而進Debugger模式時燒錄時卻有問題,如下:
MPLAB ICD 2 Ready
Resetting Target
Entering Debug Mode
...Programming GOTO 0x00 command
Resetting Target
MPLAB ICD 2 Ready
Entering Debug Mode
ICDWarn0015: Program memory has changed since last program operation? Continue with Debug operation?
Running Target
Entering Debug Mode
ICD0083: Target not in debug mode, unable to perform operation
ICD0069: Unable to run target Entering Debug Mode
MPLAB ICD 2 Ready

我使用內部Oscillator, Config設定如下:
Oscillator Internal RC No Clock
Watchdog Timer Off
Power Up Timer Off
Master Clear Enable External
Brown Out Detect Off
Code Protect Off
Data EE Read Protect Off

是因為使用內部OSC, 才導致無法debug嗎?
該如何解決?

謝謝!

發表於: 2005/9/9 20:03
頂部


為何PIC12F629 timer1誤差這麼大, 快吐血了!!!
新會員
新會員


大家好(我一點也不好):
我用了一顆PIC12F629做計時器, 使用內部OSC 4MHz, GPIO2接LED, 程式如下:
參考http://www.microchip.com.tw/modules/n ... e=flat&order=ASC&start=10
#include <pic.h>

// 每50ms(0.05s)計數一次 
// (4Mhz/4) [1*(50000)] = 50mS (內部振盪器:4MHz, Prescale:1)
#define TMR1H_VALUE 256-(unsigned char)((4000000/4 * 0.05)/256)-1
#define TMR1L_VALUE 256-(unsigned char)(4000000/4 * 0.05) % 256 

#define WARNNING_LED    GPIO2

//**********************************
//* Function Prototype Declaration
//**********************************
void interrupt isr_Sevr void );
void Initial_Timer1Int(void);

// ================================================================
// **** Establish PIC12F629 Configuration Word
// **** == Internal Oscillator No Clock Mode
// **** == Watch-Dog Timer Off
// **** == Power Up Timer Off
// **** == MCLR Enable External
// **** == Brown-Out Detect Enabled
// **** == Code Protect Off
// **** == Data EE Read Protect Off
//__CONFIG  (INTRC_OSC_NOCLKOUT & WDT_OFF & PWRTE_OFF & MCLRE_EXT & BODEN_ON & CP_OFF & CPD_OFF);

unsigned long _50ms 0;
unsigned long _1s 0;
unsigned long _1m 0;
//---------------------------------------------------------------------------


//*********************************
//* program main()
//*********************************
void main(void)
{
    
// 校正內部Oscillator 4Mhz    
    
OSCCAL _READ_OSCCAL_DATA();

    
// Initial GPIO
    
GPIO 0;        // Init GPIO
    
CMCON 0x07;    // Set GP<2:0>(CM<2:0>) to digital IO
    
TRISIO 0b00000011;    // Set GP<1:0> as input and GP<2> as output

    
Initial_Timer1Int();

    while (
1)
    {
        if (
_50ms >= 20)    // 1秒
        
{
            
_50ms 0;
            
_1s++;
        }
        if (
_1s>=60)        // 1分鐘
        
{
            
_1s 0;
            
_1m++;
            
WARNNING_LED = !WARNNING_LED;
        }
    }
}
//---------------------------------------------------------------------------


//***********************************************
//*          Interrupt Service Routine            *       
//***********************************************
void interrupt isr_Sevr void )
{
    
//GIE = 0;        // INTCON<7> Disables all interrupts
    
if (TMR1IF)        // PIR1<0>
    
{
        
TMR1H TMR1H_VALUE;
        
TMR1L TMR1L TMR1L_VALUE;
        
TMR1IF 0;
        
_50ms++;
    }
    
//GIE = 1;        // INTCON<7> Enables all unmasked interrupts
}
//---------------------------------------------------------------------------


//***********************************************
//*         Initial Timer1 Interrupt
//***********************************************
void Initial_Timer1Int(void)
{
    
TMR1H TMR1H_VALUE;
    
TMR1L TMR1L_VALUE;
    
// Enable Timer1
    
T1CON 0b00000001;    // Enable Timer1, Internal Clock(Fosc/4), LP Oscillator is Off, 
                        // 1:1 Prescale Value, Timer1 is On ignore !T1G
    
    
TMR1IE 1;        // PIE1<0> Enable Timer1 Interrupt
    
PEIE 1;        // INTCON<6> Enables all unmasked peripheral interrupts
    
GIE 1;        // INTCON<7> Enables all unmasked interrupts
    
TMR1IF 0;        // PIR1<0> TMR1 register overflowed (must be cleared in software)
}

為何1分鐘就會快個0.5秒, 真傷腦筋

發表於: 2005/9/9 19:46
頂部


Re: 要如何設定12F/629之內部震盪?
新會員
新會員


參照:

Ryang 寫道:
直接寫暫存器的位置。

asm("movwf 0x30");



OSCCAL位址不是0x90嗎?
還是只是舉例說明用法...

發表於: 2005/9/9 18:11
頂部


Re: 要如何設定12F/629之內部震盪?
新會員
新會員


原來方法這麼多種, 了解了.
多謝^_^

發表於: 2005/9/9 18:08
頂部


Re: 那裡可以買到 BFMP 燒錄器?
新會員
新會員


ICSP应该可以自己搭电路连ICD2烧得吧。

發表於: 2005/9/9 17:53
頂部


Re: 要如何設定12F/629之內部震盪?
新會員
新會員


刚才翻了一下pic12f6x.h文件(PICC16的安装目录下面)。做了段小程序,自己看看反汇编。

#include "pic.h"

__CONFIG ( PROTECT & BOREN & MCLREN & PWRTEN & WDTDIS & INTIO );

void main(void)
{
OSCCAL = _READ_OSCCAL_DATA();

while(1){};
}

_READ_OSCCAL_DATA是.h文件中的宏定义。
#define _READ_OSCCAL_DATA() (*(unsigned char(*)())0x3FF)()

反汇编:
7: OSCCAL = _READ_OSCCAL_DATA();
3FA 1283 BCF 0x3, 0x5
3FB 23FF CALL 0x3ff
3FC 1683 BSF 0x3, 0x5
3FD 0090 MOVWF 0x10

是不是比自己写明确多了,嘻嘻,偶这样的懒人总是喜欢找些懒办法的。

發表於: 2005/9/9 17:42
頂部


Re: 要如何設定12F/629之內部震盪?
版主
版主


直接寫暫存器的位置。

asm("movwf 0x30");


或加入"_"。

#asm
clrf _STATUS
clrf _PORTB
bsf _STATUS,5
clrf _TRISB
#endasm

發表於: 2005/9/9 17:37
頂部


Re: 要如何設定12F/629之內部震盪?
新會員
新會員


前导"_"

發表於: 2005/9/9 17:30
頂部



« 1 ... 6939 6940 6941 (6942) 6943 6944 6945 ... 7522 »



:::

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... ]

教育訓練中心

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