Browsing this Thread:
1 Anonymous Users
|
尋找 orange0915 前輩!!
|
|
高級會員
Joined
: 2007/3/24 9:21 最後登入時間
: 2018/3/21 10:42
Group:
註冊會員
Level : 7 HP : 0 / 163 MP : 24 / 8156 EXP : 53
|
我想問ㄧ下前輩因為我現在的ad值進來會ㄧ直改變 所以我現在程式第一筆資料要放在A4第二筆後才放在A2裡 *A4=A2;意思就是*A4接收A2舊的資料 新的資料放入A2 我ㄧ直在測試指標部分好像有問題正在研究中!!不知道前輩能否給ㄧ下建言
//****************************************************** // calculate //******************************************************** void calculate(int A2,int *A4) { int b; int e,a; a=1; b=(A2-*A4);
e=b/a; if(e>205) //10bit 1v=1023/5=205 { RB1=0; } else { RB1=1; } *A4=A2; }
//*************************************** //* Program Main ( ) * //*************************************** void main(void) { int A4, temp,A2; unsigned int j; Init_IO(); Init_Adc(); while(1) {
A2D(); // Get 10-bit A/D result from CH1 A4=temp; /temp is AD value for(j=1;j<65534;j++) { A2=temp;
calculate(A2,&A4); } } }
發表於: 2007/6/28 16:59
|
|
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.