PIC Vietnam

PIC Vietnam (http://www.picvietnam.com/forum/index.php)
-   dsPIC - Bộ điều khiển tín hiệu số 16-bit (http://www.picvietnam.com/forum/forumdisplay.php?f=29)
-   -   Khởi tạo dsPIC (http://www.picvietnam.com/forum/showthread.php?t=927)

falleaf 09-02-2007 07:56 PM

Khởi tạo dsPIC
 
Một điều vô cùng đơn giản, đó là khởi tạo cho dsPIC. Các bạn có thể tìm thấy nội dung này trong file .h tương ứng với các con dsPIC mà các bạn sử dụng (trong C30).

Điều này có vẻ hơi ngớ ngẩn, nhưng F nghĩ là cần thiết để ghi chú.


Code:

/* -------------------------------------------- */
/* Macros for Device Configuration Registers    */
/* -------------------------------------------- */

/* FOSC */
#define _FOSC(x) __attribute__((section("__FOSC.sec,code"))) int _FOSC = (x);

/* FWDT */
#define _FWDT(x) __attribute__((section("__FWDT.sec,code"))) int _FWDT = (x);

/* FBORPOR */
#define _FBORPOR(x) __attribute__((section("__FBORPOR.sec,code"))) int _FBORPOR = (x);

/* FBS */
#define _FBS(x) __attribute__((section("__FBS.sec,code"))) int _FBS = (x);

/* FSS */
#define _FSS(x) __attribute__((section("__FSS.sec,code"))) int _FSS = (x);

/* FGS */
#define _FGS(x) __attribute__((section("__FGS.sec,code"))) int _FGS = (x);

Vì cách .h nó viết dài tới mấy nghìn dòng, nên F chú thích luôn nó nằm ở khoảng dòng 3500, các bạn tìm từ đó để biết thêm các thông số chi tiết.

Chúc vui.


Múi giờ GMT. Hiện tại là 04:22 PM.

Tên diễn đàn: vBulletin Version 3.8.11
Được sáng lập bởi Đoàn Hiệp.
Copyright © PIC Vietnam