C18編譯器 培訓(xùn)資料課件_第1頁
C18編譯器 培訓(xùn)資料課件_第2頁
C18編譯器 培訓(xùn)資料課件_第3頁
C18編譯器 培訓(xùn)資料課件_第4頁
C18編譯器 培訓(xùn)資料課件_第5頁
已閱讀5頁,還剩70頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

813

C18?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C181MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18

C編譯器動手實驗培訓(xùn)課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C182MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式MPLAB?

C18工具綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C183MPLAB?

C18

C

CompilerHands-On

TrainingPIC18系列的C編譯器兼容

ANSI:1989標(biāo)準(zhǔn)包括周邊許多標(biāo)準(zhǔn)C函數(shù)運行時間庫支持浮點算術(shù)運算支持32位浮點格式浮點格式為Microchip專用有Float和Double兩種類型實際都是32位格式描述MPLAB?

C18工具綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C184MPLAB?

C18

C

CompilerHands-On

TrainingLittle-endian

數(shù)據(jù)存儲方式低字節(jié)放在低地址,高字節(jié)放在高地址支持軟件堆棧編譯器盡量使用軟件堆棧操作騰出硬件堆棧資源給用戶使用支持嵌入行內(nèi)匯編MPLAB-C18

特點?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C185MPLAB?

C18

C

CompilerHands-On

Training對ANSI標(biāo)準(zhǔn)的擴(kuò)充增加的關(guān)鍵詞_asm,

_endasmfar,nearram,

rom不支持64位浮點數(shù)可以選擇禁止自動整型數(shù)升級一般C的數(shù)學(xué)運算操作數(shù)都用16位或更多位數(shù)對于單片機(jī)這樣做可能浪費資源C18在缺省條件下不會自動進(jìn)行整型數(shù)升級?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C186MPLAB?

C18

C

CompilerHands-On

Training數(shù)據(jù)類型和類型修飾?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C187MPLAB?

C18

C

CompilerHands-On

Training標(biāo)準(zhǔn)數(shù)據(jù)類型類型 位長表達(dá)范圍voidcharintfloatdouble—8163232—-128

to

+127-32768

to

327671.7549435e-38

to

6.80564693e+381.7549435e-38

to

6.80564693e+38數(shù)據(jù)類型和類型修飾?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C188MPLAB?

C18

C

CompilerHands-On

Training數(shù)據(jù)類型修飾short適用于

int

型變量

(short

int)定義16位整型數(shù)long適用于

int

型變量

(long

int)定義32位長整型數(shù)long

shortANSI標(biāo)準(zhǔn)的擴(kuò)展定義24位整型數(shù)對應(yīng)于“far

rom”型指針24位的指針可以尋址整個程序空間(2M字節(jié))?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C189MPLAB?

C18

C

CompilerHands-On

Training數(shù)據(jù)類型和類型修飾?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1810MPLAB?

C18

C

CompilerHands-On

Training數(shù)據(jù)類型修飾near數(shù)據(jù)空間

–對應(yīng)的變量放在快速存取區(qū)(access

memory)程序空間

生成16位的地址指針far數(shù)據(jù)空間

–對應(yīng)的變量放在普通數(shù)據(jù)區(qū)(通

過選擇bank存?。┏绦蚩臻g

生成24位的地址指針位變量的定義?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1811MPLAB?

C18

C

CompilerHands-On

Training使用標(biāo)準(zhǔn)C的位域結(jié)構(gòu)形式Struct

{unsigned

timeOut:

1;//超時標(biāo)志unsigned

keyDown:

1;//按鍵標(biāo)志unsigned

switch1:

1;//開關(guān)1狀態(tài)標(biāo)志unsigned

switch2:

1;//開關(guān)2狀態(tài)標(biāo)志unsigned

batLow:

1;//電池電壓低標(biāo)志unsigned:

3;//3個標(biāo)志位無定義}

runFlagBits;使用位變量runFlagBits.keyDown實驗1:

工具的集成?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1812MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

IDE和ICD2步驟:建立一個新的項目并驗證編譯/編程/調(diào)試?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1813MPLAB?

C18

C

CompilerHands-On

Training項目建立

歡迎?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1814MPLAB?

C18

C

CompilerHands-On

Training項目建立第一步:選擇芯片型號?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1815MPLAB?

C18

C

CompilerHands-On

Training?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1816MPLAB?

C18

C

CompilerHands-On

Training項目建立第三步:命名項目輸入或瀏覽選擇項目文件夾你的項目文件名?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1817MPLAB?

C18

C

CompilerHands-On

Training項目建立第四步:添加現(xiàn)有的文件選擇現(xiàn)成的C源程序,加入到本項目中若沒有現(xiàn)成的源程序,此處可以留空,待以后在項目管理窗口內(nèi)添加?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1818MPLAB?

C18

C

CompilerHands-On

Training項目建立第五步:匯總結(jié)束檢查項目設(shè)置情況?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1819MPLAB?

C18

C

CompilerHands-On

Training項目建立成功項目管理窗口點擊鼠標(biāo)選中本欄,?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1820MPLAB?

C18

C

CompilerHands-On

Training按鼠標(biāo)右鍵可以添加文件。同樣適用其它欄目。MPLAB

C18項目中必須添加的

文件C源程序(Source

Files)連接描述文件(Linker

Scripts)項目建立使用Linker

Scripts文件在項目中添加

Linker

Scripts文件Linker

Scripts文件的位置?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1821MPLAB?

C18

C

CompilerHands-On

Training項目建立使用Linker

Scripts文件18f6620.lkr

非ICD調(diào)試時的連接描述文件18f6620i.lkr

用ICD調(diào)試時的連接描述文件?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1822MPLAB?

C18

C

CompilerHands-On

Training?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1823MPLAB?

C18

C

CompilerHands-On

Training編譯環(huán)境設(shè)定源程序編譯選項設(shè)定項目環(huán)境設(shè)定?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1824MPLAB?

C18

C

CompilerHands-On

Training編譯環(huán)境設(shè)定C:\MCC18\h\C:\MCC18\lib\C:\MCC18\lkr\瀏覽選擇相應(yīng)的文件夾?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1825MPLAB?

C18

C

CompilerHands-On

Training?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1826MPLAB?

C18

C

CompilerHands-On

Training項目編譯如果你的源程序如下面最簡之范例,編譯應(yīng)該成功#include

<p18f6620.h>unsigned

char

x1,x2,x3;void

main(void){x1

=

1;x2

=

2;x3

=

x1+x2;while

(1)

{x3++;}}?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1827MPLAB?

C18

C

CompilerHands-On

Training課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1828MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式SFR的訪問:

字節(jié)?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1829MPLAB?

C18

C

CompilerHands-On

Training特殊功能寄存器可以在C代碼中直接訪問,例如TRISD

=

0x0f;if

(PORTB

==

0x55)

{...}位掩碼操作會產(chǎn)生PIC18的位操作:PORTD|=0x40;//bsfPORTD,6PORTD&=0xfe;//bcfPORTD,0SFR的訪問:

多字節(jié)?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1830MPLAB?

C18

C

CompilerHands-On

Training許多多字節(jié)寄存器可以以一個實體來訪問

例如:if

(CCPR2

==

5)

{...}mult_result

=

PROD;注意:

需要順序訪問的多字節(jié)變量(例如:Timers)-順序是不保證的SFR的訪問:

位?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1831MPLAB?

C18

C

CompilerHands-On

Training位

可以用這種語法來引用:SFRbits.bitname例如:PORTBbits.RB0

=

1;INTCONbits.GIEH

=

0;行內(nèi)匯編語法:指定所有的操作數(shù)使用C風(fēng)格的注釋標(biāo)號需要加冒號使用C標(biāo)準(zhǔn)的數(shù)寫法(0x12或18,而不

是H’12’)注意:

帶有行內(nèi)匯編的函數(shù),優(yōu)化會被禁止?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1832MPLAB?

C18

C

CompilerHands-On

Trainingvoid

add5(

void

)

{static

char

local=0;_asm//

foo

+=

5movlbfoomovlw0x5addwf

foo,1,1_endasm}課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1833MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式存儲器片段?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1834MPLAB?

C18

C

CompilerHands-On

Training一個片段是將被連接器放置到一起的目標(biāo)聚集所有的數(shù)據(jù)和代碼會被分配到這些片段中這些片段被連接器分配到存儲器區(qū)域里片段的類型?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1835MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18使用四種片段類型未初始化的數(shù)據(jù)初始化的數(shù)據(jù)udataint

x;idataint

y

=

5;romdata在程序存儲器里的數(shù)據(jù)rom

int

z

=

12;code

程序void

foo

(void){}活動片段?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1836MPLAB?

C18

C

CompilerHands-On

Training任一類型的片段都是活動的宣告會被放入對適當(dāng)類型的活動片段中對于每個C文件,對每種類型的一個默認(rèn)片段

會被建立。.<type>_<object-filename>例如

.code_foo.o,

.idata_bar.o片段的指定?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1837MPLAB?

C18

C

CompilerHands-On

Training要指定一個片段,使用:#pragma

type

[access]

[name[=address]]例如,#pragma

code

my_code_scn#pragma

idata

access

my_idata_scn=0x20省略類型定義后的任何東西都會返回到默認(rèn)片

段。例如,#pragma

udata課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1838MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式PIC18

向量?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1839MPLAB?

C18

C

CompilerHands-On

Training連接器描述向量區(qū)從Linker

0到0x000029復(fù)位向量在

0編譯器啟動代碼放置在這兒中斷向量在0x000008通常在這兒放置分支跳轉(zhuǎn)到中斷處理函數(shù)使能中斷?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1840MPLAB?

C18

C

CompilerHands-On

Training通過全局中斷使能位和特定中斷源的使能位來啟動中斷全局中斷使能位是INTCON寄存器中的GIEH位各中斷源的使能位在INTCONx

和PIEx寄存器中當(dāng)一個中斷發(fā)生時,代碼執(zhí)行會跳轉(zhuǎn)到地址0x000008中斷的處理?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1841MPLAB?

C18

C

CompilerHands-On

Training硬件保存和恢復(fù)BSR,STATUS和WREGINTCONx和PIRx寄存器中的中斷標(biāo)志位用來

區(qū)分多個中斷源中斷返回通過RETFIE編譯器中斷支持?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1842MPLAB?

C18

C

CompilerHands-On

Training編譯器中斷的管理有三個部分:指定中斷函數(shù),用語法:#pragma

interrupt建立向量函數(shù)保留編譯器管理的資源建立一個中斷服務(wù)函數(shù)?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1843MPLAB?

C18

C

CompilerHands-On

Training使用下面語法來宣告一個中斷函數(shù):#pragma

interrupt

name

[save=var1,…,varN]使用一個唯一的臨時數(shù)據(jù)段使用

retfie來返回簡單的現(xiàn)場保護(hù)建立一個中斷服務(wù)向量?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1844MPLAB?

C18

C

CompilerHands-On

Training在中斷服務(wù)向量地址建立一個函數(shù):#pragma

code

high_vector_scn=0x0008void

high_isr

(void);void

high_vector

(void){_asmgoto

high_isr_endasm}#pragma

code中斷服務(wù)程序里的現(xiàn)場保護(hù)?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1845MPLAB?

C18

C

CompilerHands-On

Training中斷服務(wù)ISR

示例?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1846MPLAB?

C18

C

CompilerHands-On

Training宣告一個中斷處理使成為一個函數(shù)調(diào)用:#pragma

interrupt

isr

save=section(“.tmpdata”),

PRODvoid

isr

(void){int

result;result

=

poll_device();/*

do

stuff

w/

result

*/...}目標(biāo)板描述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1847MPLAB?

C18

C

CompilerHands-On

TrainingPIC18F8720

演示板PORTD連接了

8

個LEDADC的模擬通道0(AN0)連接了一個電位器外部中斷0(RB0)連接右上角的按鍵手動復(fù)位(MCLR)連接左下角的按鍵課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1848MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式實驗2:

周邊外設(shè)中斷?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1849MPLAB?

C18

C

CompilerHands-On

Training關(guān)鍵概念:對于周邊外設(shè)的控制,可直接用字節(jié)和位操作訪問SFR編譯器中斷處理在PORTD移位一個高位來順序循環(huán)點亮LED使用TMR2中斷來控制燈移動的速度課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1850MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式PIC18

中斷優(yōu)先級高優(yōu)先級中斷向量地址在

0x000008WREG,STATUS和BSR被自動保護(hù)低優(yōu)先級中斷向量地址在0x000018沒有硬件的現(xiàn)場保護(hù)可被中斷嵌套?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1851MPLAB?

C18

C

CompilerHands-On

Training使能中斷優(yōu)先級?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1852MPLAB?

C18

C

CompilerHands-On

Training默認(rèn)是優(yōu)先級禁止的,所有的中斷都是高優(yōu)

先級的RCON寄存器里的IPEN位用來使能中斷優(yōu)先級1

=中斷優(yōu)先級允許0

=中斷優(yōu)先級禁止中斷優(yōu)先級的選擇?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1853MPLAB?

C18

C

CompilerHands-On

Training每一個支持中斷優(yōu)先級的中斷源都有一個相

關(guān)的IP位來做優(yōu)先級選擇1

=高優(yōu)先級0

=低優(yōu)先級例如,要設(shè)置TMR2中斷到低優(yōu)先級INTCON2bits.TMR2IP

=

0;

/*

低優(yōu)先級

*/注意外中斷INT0一直是高優(yōu)先級的中斷#pragma

interruptlow?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1854MPLAB?

C18

C

CompilerHands-On

Training宣告一個低優(yōu)先級的中斷服務(wù)要使用語法:#pragma

interruptlow

name

[save=[var1…varN]]使用一個唯一的臨時數(shù)據(jù)片段用

RETFIE返回簡單的現(xiàn)場保護(hù)用軟件來保存

WREG,BSR和STATUS低優(yōu)先級中斷示例?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1855MPLAB?

C18

C

CompilerHands-On

Training#pragma

interruptlow

low_isrvoid

low_isr

(void){/*

process

interrupt

*/}Delay延時庫函數(shù)?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1856MPLAB?

C18

C

CompilerHands-On

TrainingDelay延時庫函數(shù)程序:Delay1TCY()Delay10TCY()Delay10TCYx(n)

//Delay100TCYx(n)//Delay1KTCYx(n)

//Delay10KTCYx(n)////延時1個指令周期//

延時10個指令周期

延時10*n個指令周期延時100*n個指令周期

延時1000*n個指令周期延時10000*n個指令周期延時在計算上包括在前面函數(shù)調(diào)用的時間課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1857MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式EEDATA

讀順序?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1858MPLAB?

C18

C

CompilerHands-On

Training確保EEPGD位被清零,來做EEDATA訪問把地址存到EEADR將RD位置1來啟動讀從EEDATA寄存器讀結(jié)果EEDATA讀C程序示例?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1859MPLAB?

C18

C

CompilerHands-On

Training/*

確認(rèn)訪問

EEDATA

*/EECON1bits.EEPGD

=

0;/*

設(shè)置要讀位置的地址

*/EEADDR

=

address;/*

初始化讀,讀過程花一個指令周期

*/EECON1bits.RD

=

1;/*

取得結(jié)果

*/myvar

=

EEDATA;EEDATA

寫順序?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1860MPLAB?

C18

C

CompilerHands-On

Training確保EEPGD被清零來

做EEDATA訪問確保WREN被置1來使能EEDATA寫入要寫的地址放到EEADR把要寫入的值放到EEDATA向EECON2寫入0x55向EECON2寫入0xAA將WR位置1來啟動寫周期等待EEIF標(biāo)志位置位清EEIF標(biāo)志位在步驟5-7過程中,中斷應(yīng)該被禁止EEDATA寫入C程序示例?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1861MPLAB?

C18

C

CompilerHands-On

TrainingEECON1bits.EEPGD

=

0;

/*EECON1bits.WREN

=

1;

/*EEADR

=

addr;

/*EEDATA

=

value;

/*EECON2

=

0x55;

/*指向EEDATA寫使能

*/設(shè)置地址

*/設(shè)置要寫的值

預(yù)寫順序

*/*/*/EECON2

=

0xaa;EECON1bits.WR

=

1;

/*啟動寫

*/while

(!PIR2bits.EEIF)/*等待結(jié)束

*/;PIR2bits.EEIF=0;/*清標(biāo)志位*/課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1862MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式大數(shù)據(jù)存儲目標(biāo)?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1863MPLAB?

C18

C

CompilerHands-On

Training通過指針訪問一個

>

256字節(jié)的目標(biāo)是支持的要建立一個多Bank的目標(biāo)分配目標(biāo)到它自己的片段section建立一個指向目標(biāo)的指針來作訪問在連接器描述文件linker

script里建立一個新的區(qū)

域把這個目標(biāo)的片段section

指派到這個新的區(qū)域里大目標(biāo)示例C文件?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1864MPLAB?

C18

C

CompilerHands-On

Training#pragma

udata

buffer_scnstatic

char

buffer[0x180];#pragma

udatachar

*buf_ptr

=…&buffer[0];//

使用示例buf_ptr[5]

=10;if(

buf_ptr[275]>127

)…大目標(biāo)示例Linker

Script文件改動之前DATABANK

NAME=gpr2DATABANK

NAME=gpr3?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1865MPLAB?

C18

C

CompilerHands-On

TrainingSTART=0x200START=0x300END=0x2FFEND=0x3FFSTART=0x200END=0x37fSTART=0x380END=0x3FF改動之后DATABANK

NAME=bigbufPROTECTEDDATABANK

NAME=gpr3...SECTION

NAME=buffer_scn

RAM=bigbuf課程綜述?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1866MPLAB?

C18

C

CompilerHands-On

TrainingMPLAB?

C18綜述實驗1:工具的集成周邊外設(shè)的訪問存儲器的組織中斷實驗2:周邊外設(shè)中斷中斷優(yōu)先級EEDATA大數(shù)據(jù)存儲目標(biāo)實驗3:中斷優(yōu)先級和多個周邊外設(shè)的控制擴(kuò)展的模式實驗3:

嵌套的中斷的周邊外設(shè)查詢的控制?

2004

Microchip

Technology

Incorporated.

All

Rights

Reserved.813C1867MPLAB?

C18

C

CompilerHands-On

Training關(guān)鍵概念中斷優(yōu)先級EEDATA的訪問多中斷驅(qū)動和周邊外設(shè)的查詢訪問采樣ADC來調(diào)整移動LED的重復(fù)計數(shù)器時鐘選擇FOSC/32AN0是模擬輸入200指令周期延時從開始采樣到開始轉(zhuǎn)換外中斷(INT0)用來改變LED移動的方向

注意INT0一直是高優(yōu)先級的中斷設(shè)置TMR2到低優(yōu)先級保存/恢復(fù)

方向數(shù)據(jù)到EEDATA課程綜述?

2004

M

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論