• 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: dsPIC33FJ256MC710 PORT輸出的問題
#3
資深會員
資深會員


查看用戶資訊
這是我的程式設定

#include <p33FJ256MC710.h>

#if defined(__dsPIC33F__)
_FOSCSEL(FNOSC_FRC);            // Internal FRC oscillator
_FOSC(FCKSM_CSECMD OSCIOFNC_OFF  POSCMD_NONE);  
                
// Clock Switching is enabled and Fail Safe Clock Monitor is disabled
                // OSC2 Pin Function: OSC2 is Clock Output
                // Primary Oscillator Mode: XT Crystanl
_FWDT(FWDTEN_OFF WINDIS_OFF );

#define GetSystemClock()        (80000000ul)      // Hz
#define PLL                38
#define GetInstructionClock()    (GetSystemClock()/2)
#define GetPeripheralClock()    GetInstructionClock()
#define Fcy     GetInstructionClock()
#define FCY        GetInstructionClock()
#define BAUD_RATE       (115200)
#define BaudRate (Fcy/(16*BAUD_RATE))-1
#include <stdio.h>
#include <libpic30.h>

void InitClock(void) {
    
PLLFBD PLL;    // M = 40
    
CLKDIVbits.PLLPOST 0;    // N1 = 2
    
CLKDIVbits.PLLPRE 0;    // N2 = 2
    
OSCTUN 0;
    
CLKDIVbits.DOZE=0;
    
RCONbits.SWDTEN 0;
// Clock switch to incorporate PLL
    
__builtin_write_OSCCONH(0x01);    // Initiate Clock Switch to 
    // FRC with PLL (NOSC=0b001)
    
__builtin_write_OSCCONL(0x01);        // Start clock switching
    
while (OSCCONbits.COSC != 0b001);    // Wait for Clock switch to occur    

    
while(OSCCONbits.LOCK != 1) {};
}

void initial_set(void){
    
ODCA 0;
    
TRISAbits.TRISA6 0;
    
__C30_UART=2;
    
U2BRG BaudRate;
    
U2MODEbits.UARTEN 1;
}

int main(void){
    
InitClock();
    
initial_set();
    
printf("nr開始準備接收資料");
    while(
1){
    
asm volatile("bset PORTA,#1");    
    
asm volatile("bclr PORTA,#1");
}

OSCCON 經ICD3看到
NOSC = 0x01;
COSC= 0x01;
PLLPOST =0;
PLLPRE =0;
DOZE = 0;

InitClock這段是從範例程式直接擷取下來的
Uart2的輸出是正常顯示 並無亂碼
在示波器下看的 _RA1的H/L頻率最高是1MHz(當PLLFBD 設定為43的時候)

因為FIN=7.38Mhz
所以設定為 Fcy = (1/2)((7.38*38)/(2*2)) 所以得到大約為40MPIS的值。

但因為從示波器上看到切換頻率最多只能到1Mhz 所以一直覺得很奇怪。

因為看起來我程式設定上應該沒有錯,但是IO速度就是沒辦法超過,故來問之。

發表於: 2009/6/19 18:04
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsPIC33FJ256MC710 PORT輸出的問題
#2
版主
版主


查看用戶資訊
你確定妳的 dsPIC33F 是跑在 40 MIPS 嗎? 會不會是 PLL 的公式有算錯,I/O 全速跑起來最快可到 20Mhz。

發表於: 2009/6/19 14:40
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


dsPIC33FJ256MC710 PORT輸出的問題
#1
資深會員
資深會員


查看用戶資訊
因為最近有用到dsPIC33FJ系列,想試著來跑SW SPI,但是後來發現IO速度好像挺慢的,因此用示波器看,發現真不快,因此試著用組合讓它單純跑H/L 狀態,發現最多只能跑到1Mhz左右的速度,因此想請問看看,dsPIC33FJ的IO速度真的只能到這樣嗎? 有辦法能讓它的輸出速度變快嗎?

測試環境:

FRC PLL /FOSC 80Mhz/Fcy 40MIPs

使用C30來測試。

發表於: 2009/6/19 9:42
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... ]

教育訓練中心

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