Page 30 - PIC18F4550微處理機C語言設計實務
P. 30
PIC18F4550 ฆஈଣዚ C ႧԊணࠇྼਕ
bank1, bank2, bank3:
ίݔԬ PIC ӻΐ༁ࠦdRAM ʱϓεࡈᅲπኜࢫbankdה˸܁ѓᜊᅰࣛd
ν؈ίᜊᅰۃࠦ̋ɪ bank1dڌͪ༈ᜊᅰٙЗѧ݊׳ί RAM bank1d߰̋ɪ bank2d
ڌͪ༈ᜊᅰٙЗѧ݊׳ί RAM bank2 ԱϤᗳપf߰ᜊᅰӚϞܵйܸ֛ bankdۆ׳ί
bank0 א݊͟ᇜᙇኜԸӔ֛f
Էνj
unsigned char var0;
ڌͪᜊᅰ var0 ׳ί RAM bank0 א͟ᇜᙇኜԸӔ֛f
unsigned char bank1 var1;
ڌͪᜊᅰ var1 ׳ί RAM bank1f
unsigned char bank2 var2;
ڌͪᜊᅰ var2 ׳ί RAM bank2f
߰ᜊᅰٙൖ˙ࠦԸႭd̙˸ʱމΌਹᜊᅰeਜਹᜊᅰၾ̮ίᜊᅰdΌਹᜊᅰ
݊܁ѓίՌό̮ٙᜊᅰd̥ࠅίΝɓࡈᏦࣩ༁ࠦٙΌՌόே̙˸ٜટԴ͜d߰Չ
˼ٙᏦࣩࠅԴ͜வࡈΌਹᜊᅰdۆ݊ࠅί܁ѓࣛ̋ɪ externdਗ਼Չൖމ̮ίᜊᅰʑ̙
˸Դ͜dΪމЦٙ͜াኳ݊ዹͭЦٙ͜dה˸Դ͜ɪேൖމΝɓࡈᜊᅰfਜਹᜊᅰ
ۆ݊܁ѓίՌόʫdɰ̥Ϟ܁ѓٙԟࡈՌό̙˸Դ͜dՉ˼ٙՌόேʔঐԴ͜dᕎ
කəԟࡈՌόʘܝdᜊᅰఱʔΎϞࣖf̮ίᜊᅰۆڌͪ༈ᜊᅰ݊܁ѓίՉ˼ٙᏦࣩ༁
ࠦd߰ซࠅπ՟Չ˼ᏦࣩٙΌਹᜊᅰdۆ̀ࠅࠠอ܁ѓԨίۃࠦ̋ɪ externdᜫᇜ
ᙇኜٝ༸Ϥᜊᅰٙॆ͍܁ѓ݊ίՉ˼ٙᏦࣩdᇜᙇኜɰਗ਼ՉൖމΝɓࡈᜊᅰf
1-3-3 陣列與字串
■ 一維陣列
ίɓࡈफॴʕϞ 30 ЗΝኪdϞഹΝᗳۨٙ༟ࣘdԷν֑Τא݊ϋᙧ͵א̻݊
ѩϓᐶഃഃd̀܁ѓ 30 ࡈᜊᅰԸᎷπהϞኪ͛ٙᗫ༟ࣘdிϓᕼɽٙᜊᅰᅰඎf
C ႧԊԶ৬ΐarrayٙණΥ༟ࣘۨ࿒܁ѓd˸॰ˏindexٙ˙όஷ੬݊ኪ
אࢭਂމᗆйʔΝኪ͛ٙ༟ࣘʫ࢙d܁ѓ৬ΐٙࣸόνɨj
༟ࣘۨ࿒ Τ၈ [ ɽʃ ];
20