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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/21/06 04:43
Read: times


 
#114659 - Use the c flag to handle bit's
Responding to: ???'s previous message
Hello Ant Cosier,

Learn how to handle bits using the c flag. It very easy.

you said:
What i want to do is if i have value in the accumulator such as 1010 i want to be able to put that value to ports like this. So i would have 1 on p1.0 and zero on p1.1 and 1 on p1.2 and zero on p1.3 and so forth.If any one could help me out i would be greatful thanks
Anaswer
Mov A, #0x0A       ; loads the accumulator with binary 0000 1010

mov c, acc.3       ; Move fourth bit to c flag.
mov P1.0 , c       ; move carry flag result to port 1.0 bit
mov c, acc.2       ; Move third bit to c flag.
mov P1.1 , c       ; move carry flag result to port 1.1 bit
mov c, acc.1       ; Move second bit to c flag.
mov P1.2 , c       ; move carry flag result to port 1.2 bit
mov c, acc.0       ; Move first bit (LSB) to c flag.
mov P1.3 , c       ; move carry flag result to port 1.3 bit

; Port 1 now contains xxxx 0101

Regards,

Charles Bannister


List of 14 messages in thread
TopicAuthorDate
sending data            01/01/70 00:00      
   Masking            01/01/70 00:00      
   Yes Masking            01/01/70 00:00      
      masking            01/01/70 00:00      
         Use the c flag to handle bit's            01/01/70 00:00      
            charles            01/01/70 00:00      
   The procesor does not stop at an 'end' s            01/01/70 00:00      
   bcd            01/01/70 00:00      
      Some routines in the code library            01/01/70 00:00      
      BCD            01/01/70 00:00      
         bcd            01/01/70 00:00      
            Talk to me via skype if you wish            01/01/70 00:00      
   Sending            01/01/70 00:00      
      ORL wont work            01/01/70 00:00      

Back to Subject List