Logic gates - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Logic gates

Hello, how can I use logic gates in assembly? for example, apply an AND in a byte that I have defined. For example, if I have the following variable:

variable db ?

This is a 8 bit element, supposing that it have the following content:

11001111

What I want to do is a apply the AND gate to that bit chain, in this way:

11001111//content of my variable
00000001//I want to apply AND with this bit chain

How can I code that in assembly?

Best regards

Comments

  • anthrax11anthrax11 Posts: 511Member
    and [variable], 1
  • CsehCseh Posts: 4Member
    : Hello, how can I use logic gates in assembly? for example, apply an
    : AND in a byte that I have defined. For example, if I have the
    : following variable:
    :
    : variable db ?
    :
    : This is a 8 bit element, supposing that it have the following
    : content:
    :
    : 11001111
    :
    : What I want to do is a apply the AND gate to that bit chain, in this
    : way:
    :
    : 11001111//content of my variable
    : 00000001//I want to apply AND with this bit chain
    :
    : How can I code that in assembly?
    :
    : Best regards
    :
    Dear Karma,
    The assembly programme in case of PIC 16FXXX microcontrollers goes like this:
    movlw B'11001111' ;move binary value 11001111 to w
    andlw B'00000001' ;and binary value 00000001 to w, Result is in w
    Best Regards
    J. Cseh
Sign In or Register to comment.