Re: 請問要做shift的動作,最長變數可宣告幾個byte?
|
||||
---|---|---|---|---|
資深會員
|
謝謝,我怕pic記憶體單word byte數問題不能用shift
這樣說來用c 語言不會有這種問題!? 我最後一個bit寫在迴圈之外,因為我先加再移,最後一bit會被移位 所以最後一bit寫到迴圈外,直接加 聽您這麼說,第一bit先移應該不影響,會更方便沒錯
發表於: 2006/7/14 17:01
|
|||
|
Re: 請問要做shift的動作,最長變數可宣告幾個byte?
|
||||
---|---|---|---|---|
版主
|
因該是先將 anglr_data 的資料向左移一位後再加 DATAIN bit
才對。
發表於: 2006/7/14 10:05
|
|||
|
Re: 請問要做shift的動作,最長變數可宣告幾個byte?
|
||||
---|---|---|---|---|
版主
|
你要旋轉的資料長度超過 Long 而且還要有輸入的一個位元,
所以用C來寫會比較辛苦一點,建議用 In-Line Assembly 或利用 C18 所提供的Macro來寫,C18 的 Macro 指令在 H 檔裡有宣告過如下所示: 可以開一的陣列內含五個 unsigned char的buffer, 檢查輸入的位元是 1 還是 0 以設定 C flag ,再利用 RLCF 指令透過for迴圈轉 5 個 Byte (陣列裡) 總共要做39次就可以了。
/*-------------------------------------------------------------------------
發表於: 2006/7/13 14:22
|
|||
|
請問要做shift的動作,最長變數可宣告幾個byte?
|
||||
---|---|---|---|---|
資深會員
|
我想1個bit一個bit連續抓39bit,配合shift動作
不知道使用c18,變數可有辦法 宣告成unsigned long int,再配合shift來完成呢 這樣合乎c嗎?
發表於: 2006/7/13 13:47
|
|||
|