Browsing this Thread:
1 Anonymous Users
|
Re: 請教各位前輩C18要如何宣告才能共用同一塊記憶體空間
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 111130 EXP : 45
|
這要看 p18f4520.asm 裡對 T4CON & T4CONbits 的位址設定。 你的宣告當然會使用兩個記憶體,如要共用要加上 union 的宣告。參考 W401 C18 教育訓練課程的第四章說明。
發表於: 2009/2/24 22:55
|
|
|
請教各位前輩C18要如何宣告才能共用同一塊記憶體空間
|
|
新會員
Joined
: 2008/12/19 13:52 最後登入時間
: 2010/4/12 16:16
Group:
註冊會員
Level : 1 HP : 0 / 5 MP : 1 / 251 EXP : 21
|
請教各位前輩一下:
小弟目前在用C18寫程式,IC使用18F6520 請問要如何宣告才可以做到以下的功能
下面程式我從18F6520.H引用的 extern volatile near unsigned char T4CON; extern volatile near struct { unsigned T4CKPS0:1; unsigned T4CKPS1:1; unsigned TMR4ON:1; unsigned T4OUTPS0:1; unsigned T4OUTPS1:1; unsigned T4OUTPS2:1; unsigned T4OUTPS3:1; } T4CONbits;
我可以對T4CON寫入一個8BIT的資料,也可只對T4CONbits.TMR4ON的位元作改變
為什麼我做以下的宣告組譯後會變成二個不同的記憶體位址 unsigned char LCDBUFA; struct { unsigned FANL:1; unsigned FANM:1; unsigned FANH:1; unsigned MDEF:1; unsigned MHEAT:1; unsigned MFAN:1; unsigned MCOOL:1; unsigned MAUTO:1; } LCDBUFAbits
發表於: 2009/2/24 15:58
|
|
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.