limiting to "no less than" zero


Results 1 to 31 of 31

Threaded View

  1. #26
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: limiting to "no less than" zero

    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
    Last edited by Heckler; - 18th September 2011 at 04:26.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts