• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users






Re: 比較判斷程式debug
#7
版主
版主


查看用戶資訊
如果你有 Include Microchip 的 INC 擋的話,那請將 statua,z 改為大寫,打開 INC 擋你揪知道的,MPASM 大小寫有區分。

NDF EQU H'0000'
TMR0 EQU H'0001'
PCL EQU H'0002'
STATUS EQU H'0003'

發表於: 2007/3/22 9:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 比較判斷程式debug
#6
初級會員
初級會員


查看用戶資訊
那請教版主,我的程式(請看之前的文章_已修改過)是作當兩個值做比較,測試中我嘗試強迫DATAI_H=0X15且MSB=0X15時,Zero Config不會為1,我也另外設定DATAI_H=0X15且MSB=0X10==>Zero Config=0,Carry Config=0,都與我所預期的不一樣,請問一下,這是什麼原因呢?

發表於: 2007/3/21 18:16
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 比較判斷程式debug
#5
版主
版主


查看用戶資訊
旗號用來做比較是不用刻意去設定的。如果是做減法的話就需考慮C旗號的設定(PIC用2's做減法)

發表於: 2007/3/21 18:00
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 比較判斷程式debug
#4
初級會員
初級會員


查看用戶資訊
感謝各位大大的指點,目前這個判斷程式我已經修改的差不多了,只是又遇到了一個問題是在程式中我所有的判斷依據都是根據STATUS Register裡C,Z的狀態作判斷,可是目前遇到一個小問題,那就是不論數值的大小STATUS的值都不改變,這是我那邊還需要再設定,或是我疏忽了呢?或是應該這樣問,要如何設定STATUS Register?

發表於: 2007/3/21 10:26
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 比較判斷程式debug
#3
版主
版主


查看用戶資訊
Microchip 在 Dtat Sheet 有關 BTFSS 指令的描述:

Syntax: [ label ] BTFSS f,b
Operands: 0 ≤ f ≤ 127 , 0 ≤ b < 7
Operation: skip if (f<b>) = 1 ; 測試位元=1時,跳過下一個指令進而執行第二個指令。

Status Affected: None
Description: If bit ‘b’ in register ‘f’ is ‘0’, the next
instruction is executed.
If bit ‘b’ is ‘1’, then the next instruction
is discarded and a NOP is
executed instead, making this a
2 TCY instruction.

發表於: 2007/3/16 16:42
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 比較判斷程式debug
#2
中級會員
中級會員


查看用戶資訊
btfss DATAI_H,7
goto heat
movlw MSB

最高位元為1時 執行 movlw MSB
最高位元為0時,跳到go to heat


發表於: 2007/3/16 14:53
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


比較判斷程式debug
#1
初級會員
初級會員


查看用戶資訊
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
; Calcomp
;******* DATAI>Amb Set GPIO_5 High
;******* DATAI<=Amb Set GPIO_4 High
;********************************************
compare
btfsc DATAI_H,7 ; [DATA_H(7)=H]=-xC
goto heat
movlw MSB
subwf DATAI_H,W ; DATAI_H-Amb(5'C)
btfsc status,z
goto heat ; when DATAI = Amb
btfss status,c
goto heat ; when DATAI < Amb
goto system ; when DATAI > Amb
;::::::::::::::::::::::::::::::::::::::::::::::::::::::
system
nop
bsf GPIO,0 ; Set GPIO_0 High
goto start ; Read Temperature Sensor Data again
heat
nop
bcf GPIO,0 ; Set GPIO_0 Low
goto start ; Read Temperature Sensor Data again
end

發表於: 2007/3/16 14:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







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.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------