Here is my test code and the debug results below...
Code:
DEFINE DEBUG_REGG PORTA 'set debug port to porta
DEFINE DEBUG_BIT 0 'use pin a0 of porta for debug
DEFINE DEBUG_BAUD 2400 'set baud rate to 2400
DEFINE DEBUG_MODE 0 'communicate in true mode
valA var byte
valB var byte
resultA var byte
resultB var byte
resultC var byte
resultD var byte
Carry var bit
vala=51
valb=50
resulta=vala-valb
Carry = STATUS.0
debug "resultA : 51-50=",dec resulta," Carry=",dec carry,13,10
resultb=valb-vala
Carry = STATUS.0
debug "resultB : 50-51=",dec resultb," Carry=",dec carry,13,10
resultC=vala+valb
Carry = STATUS.0
debug "resultC : 51+50=",dec resultc," Carry=",dec carry,13,10
vala=55
valb=201
resultD=vala+valb
Carry = STATUS.0
debug "resultD : 55+201=",dec resultd," Carry=",dec carry,13,10
end
and the Debug results...
resultA : 51-50=1 Carry=1
resultB : 50-51=255 Carry=0
resultC : 51+50=101 Carry=0
resultD : 55+201=0 Carry=1
Bookmarks