請教一個觀念,關於ADRESH+ADRESL
|
||||
---|---|---|---|---|
新會員
|
請教各位版友,
目前小弟採用PIC12F675,採用10BIT AD轉換後靠右將值放置在ADRESH及ADRESL~ 但小弟想將這二個值合在一起運算,即~ ADRESULT(16bits) = ADRESH(8bits)+ADRESL(8bits) 小弟的程式寫法如下~ int ADRESULT ; ADRESULT=ADRESH; ADRESULT<<8; ADRESULT|=ADRESL; 這樣的寫法對嗎?個人很懷疑~所以上來請教,若遇到這樣的問題,程式要如何寫才是正確的? 曾有搜尋過相關的題目,有版友是用以下方式完成 word temp; temp =((word)(ADRESH<<8)); temp |=(word)(ADRESL); 我曾經寫在程式試過,但complier時發生錯誤,訊息好像是指沒有定義word指令,complier我是用hi-tech c
發表於: 2008/8/28 15:14
|
|||
|