• 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






DM300027 DEMO CODE
#1
資深會員
資深會員


查看用戶資訊
官方的 source code bug 一堆,我試了幾天,將發現的問題改過

並加入config ,及switch vr 的測試,LED 顯示改得較為美觀。

有 DM300027 DEMOBOARD 想測試的,可以試試看

目前未解決的問題:VR 在 DEBUG MODE 可以操作,但是PROGRMA 到單機之後就會恆為 0,原因不明。



#include "p24fj64ga002.h"

#define XTFREQ          7372800                 //On-board Crystal frequency
#define PLLMODE         2                       //On-chip PLL setting

#define FCY             XTFREQ*PLLMODE        //Instruction Cycle Frequency

#define BAUDRATE         9600       
#define BRGVAL          ((FCY/BAUDRATE)/16)-1 


 
_CONFIG1JTAGEN_OFF GCP_OFF GWRP_OFF BKBUG_OFF COE_OFF ICS_PGx1 FWDTEN_OFF WINDIS_OFF FWPSA_PR128 WDTPS_PS32768 )
 
_CONFIG2IESO_OFF FNOSC_PRIPLL FCKSM_CSDCMD OSCIOFNC_OFF IOL1WAY_OFF I2C1SEL_PRI POSCMOD_XT )

int vr=0;
int main(void)
{
    
CLKDIVbits.RCDIV 0;

    
RPINR18bits.U1RXR 9;    // Make Pin RP9 U1RX
    
RPOR4bits.RP8R 3;        // Make Pin RP8 U1TX


    
LATB 0x00;
    
TRISB 0x0FFF;            // Configure LED pins as output

    
TMR1 0;                // Clear timer 1
    
PR1 0x3D09;            // Interrupt every 250ms
    
IFS0bits.T1IF 0;        // Clear interrupt flag
    
IEC0bits.T1IE 1;        // Set interrupt enable bit
    
T1CON 0x8020;            // Fosc/4, 1:256 prescale, start TMR1

    
U1BRG  BRGVAL;
    
U1MODE 0x8000;         // Reset UART to 8-n-1, alt pins, and enable 
    
U1STA  0x0440;         // Reset status register and enable TX & RX

    
_U1RXIF=0;                    // Clear UART RX Interrupt Flag

    
while(1)
    {
        
int a,b,c;
        
        while (
_U1RXIF==0);            // Wait and Receive One Character
        
U1RXREG;
    
        while(!
U1STAbits.TRMT);        // Echo Back Received Character with quotes
        
U1TXREG a;
        
        if(
== 0x0d){
            while(!
U1STAbits.TRMT);        // Echo Back Received Character with quotes
            
U1TXREG 0x0a;
        }
        
_LATB12=0;
    
        
_U1RXIF=0;                    // Clear UART RX Interrupt Flag
            
}
return 
0;
}


void __attribute__((interruptno_auto_psv)) _T1Interrupt(void)
{
    
IFS0bits.T1IF 0;        // clear interrupt flag
    
//    LATB ^= 0xE000;            //Toggle LED's
    
    
LATB    =((LATB&0XF000)<<1);
    
_LATB12=1;

    if(
_RB5 ==0)_LATB12=0;

    if(
_RB3 ==1){
        
_TRISB3=1;
        if(
vr ==0){_LATB12=0;vr =1;}
        else      {
_LATB12=1;vr =0;}
    } 
}

發表於: 2007/7/13 17:37
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... ]

教育訓練中心

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