Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/10/04 13:50
Read: times


 
#70119 - RE: branching ports through memory mapping
Responding to: ???'s previous message
I'm not too sure of what you're trying to achieve - you may wish to tell us what the application is. Anyway...

If you're looking to test a bit by using a bit number then one method is the following:
mov R4,#0 ;has the bit# to test
loop:
; test bit
mov a,r4 ;get the bit number to test
call get_mask ;grab the mask
anl a,P2 ;test mask with the port
jnz l1 ;skip if the bit was == 1
call bit_was_clear ;process the bit as it was 0
l1
inc r4 ;next bit#
cjne r4,#2,l1 ;loop it
...
...

;
;
; A has the bit number 0..7. Return the bit
; mask for the supplied number
;
get_mask
anl a,#07h ;no more than 0..7 allowed
mov dptr,#bit_masks
movc a,@a+dptr
ret

bit_mask
db 1,2,4,8,16,32,64,128




List of 7 messages in thread
TopicAuthorDate
branching ports through memory mapping            01/01/70 00:00      
   RE: branching ports through memory mapping            01/01/70 00:00      
      RE: branching ports through memory mapping            01/01/70 00:00      
         RE: branching ports through memory mapping            01/01/70 00:00      
            Simplifying            01/01/70 00:00      
   RE: branching ports through memory mapping            01/01/70 00:00      
      Plz close this thread            01/01/70 00:00      

Back to Subject List