## What is and gate of

33 posts / 0 new
Author
Message

Hello sir

What is and gate of

225&150=128

What do you mean by ‘and gate’? Do you to figure out the bitwise AND of your two numbers? If so, convert them to binary and do a bitwise AND. No ‘gate’ involved.

Hello sir

I get AND gate of 225&150=128 what does 128 mean

RRITESH wrote:

Hello sir

what does 128 mean

That means bit 7 is set!

Hello sir

What does this mean

if i have 225rs & 150rs=128rs

I don’t know what you mean by 225rs. What is rs?

Convert to binary:
11100001 is 225 decimal
10010110 is 150 decimal
10000000 is128 decimal

Bitwise AND is 1 & 1 = 1 all other combinations are 0
Note AND is a boolean operation - it only works on binary numbers

RRITESH wrote:

Hello sir

What does this mean

if i have 225rs & 150rs=128rs

I have no idea, where are you getting these questions?

225 is 11100001
150 is 10010110

When you perform AND only when both numbers have 1 Iin both input values do you get a 1 in the output so it is 10000000 which in decimal is 128.

And an "and gate" is a device, usually an electronic circuit, that gives you an active output when all the inputs are active. An active state is usually interpreted as "1" as opposed to inactive of "0."

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. Hello sir

What is application of and gate

To perform an AND operation.

EDIT and before you ask, while AND has many (infinite?) uses one of the most famous is in a "half-adder" which is kind of the core of all CPU operation: So this adds two bits. The "sum" (S) output is the exclusive OR of the inputs while the "carry" (C) is the AND of the two inputs. This is a half adder in reality it becomes a "full adder" when it can also take a carry input from the previous bit addition: This now uses two AND gates.

(in reality this would all be done with NAND gates but the above shows the logic of the design).

Last Edited: Mon. Aug 19, 2019 - 09:14 AM

Hello sir

Where it is used what is gate

I knew you would ask that which is why I just added an EDIT to post #11

If you don't yet know this then why does it actually matter to you?

Anyway at a higher level in C you might use something like:

```if ((sensor_input == true) && (volume > 0)) {
sound_alarm();
}```

In this code "&&" is performing the very same "logical AND" operation - it's combining the binary result of two other tests into a composite test. if (condition1 AND condition2) ...

Hello sir

Gate is used in adder circuit in cpu and where it is used in cpu

No, you missed my point. an adder is one of the 1,000,000,000,000 different uses you might apply an AND gate to.

If you really want to know most logic devices only actually implement a single type of gate (and "NAND" is the common one - that is negated AND) but it's common to start by defining logic in terms of common elements like OR, AND and EOR. Then you can convert such a design into NAND only. For example a half-adder implemented in NAND alone is: The other common form of design uses only NOR (negated OR).

But again why does ANY of this matter to you - unless you are working with FPGAs then most programmers don't need to know about any of this at this kind of level. You just buy an AVR and it has an ALU that can do SHIFT, ADD, SUB, MUL, AND, OR, EOR - how it actually implements those does not matter. The key thing is that those operations are available so that the C code you write can use them.

Hello sir

Which gate are used in cpu for for loop

Why don't you look yourself? If I write a simple AVR program like:

```#include <avr/io.h>

int main() {
uint8_t i;
DDRB = 0xFF;
while(1) {
for (i = 0; i < 200; i++) {
PORTB = i;
}
}
}```

then when built the LSS file shows this generates:

```0000007a <main>:
#include <avr/io.h>

int main() {
uint8_t i;
DDRB = 0xFF;
7a:	8f ef       	ldi	r24, 0xFF	; 255
7c:	84 b9       	out	0x04, r24	; 4
while(1) {
for (i = 0; i < 200; i++) {
7e:	80 e0       	ldi	r24, 0x00	; 0
PORTB = i;
80:	85 b9       	out	0x05, r24	; 5

int main() {
uint8_t i;
DDRB = 0xFF;
while(1) {
for (i = 0; i < 200; i++) {
82:	8f 5f       	subi	r24, 0xFF	; 255
84:	88 3c       	cpi	r24, 0xC8	; 200
86:	e1 f7       	brne	.-8      	; 0x80 <main+0x6>
88:	fa cf       	rjmp	.-12     	; 0x7e <main+0x4>
```

The first part of the for() loop is:

```		for (i = 0; i < 200; i++) {
7e:	80 e0       	ldi	r24, 0x00	; 0
```

that says that "i" will be held in R24 and is initialised to 0 (the "i = 0;" part of the for loop). The main part of the fo() loop is the bit that does "i++" and the test "i < 200" which is shown by:

```  82:	8f 5f       	subi	r24, 0xFF	; 255
84:	88 3c       	cpi	r24, 0xC8	; 200
86:	e1 f7       	brne	.-8      	; 0x80 <main+0x6>
```

Now it is a strange fact that the AVR does not have an "ADD immediate" instruction, only "SUBtract Immediate" but that's because you can achieve the equivalent of ADD using SUB anyway. To add one is the same as SUB tracting -1 and -1 is represente din binary by 0xFF. So

```  82:	8f 5f       	subi	r24, 0xFF	; 255
```

is doing ADD 1 (that is SUB (-1)). That operation in the ALU will be performed by full adders. It then does:

```  84:	88 3c       	cpi	r24, 0xC8	; 200
```

which is a COMPARE 200. A compare is effectively a subtraction where the only result is the setting of the Carry flag, Zero flag and so on. So this will only set Z when R24 is equal to 200. Finally it then does:

`  86:	e1 f7       	brne	.-8      	; 0x80 <main+0x6>`

which is a conitional branch that only performs the branch when the Z flasg is not set. On the occasion that R24 reached 200 the CPI will have left the Z flag set so the branch will not be taken.

Hello sir

Which gate is used in factorial

I just showed you how to anaylse this so now do the same procedure yourself.

Note however that the C language does not have a "factorial" operation as such. Even if it did the C compiler would just break this down into multiplication operations anyway. If you use a small AVR like a "Tiny" range one their ALU does not even have MUL operation so they will actually do MUL by repeated shift and ADD operations. At the end of the day all operations (MUL, SUB, OR, AND, etc) that an ALU does are all odne just by some combination of transistors and often they will be in a NAND configuration.

Hello sir

How to make i2c with gate

Hello sir

is #include is written in gate

Hello sir

how to make troll with gate

Letting the smoke out since 1978

Hello sir,

what is microcontroller

Hello sir

micro controller is logic gate for making electronic devices

RRITESH you appear to be a troll. Almost everything you have asked on this site (in multiple threads) could have been answered if you bother to spend 10 second with www.google.com.

Only post questions here AFTER you have read some Google result and there is something about it you do not understand.

Moderator.

You guys are talking to an AI bot, I think...

Number 5 is alive and needs more "ENNputtttt"!

Cliff, that’s 10 minutes of your life that you won’t regain!

Which gate are used in cpu for for loop

Usually it is the front gate, which should probably be locked now.    Maybe you were confused by eating too many fruit loops.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

These are the sort of questions that belong on Quora.

Four legs good, two legs bad, three legs stable.

If you know my whole story, you're an accomplice. Keep your mouth shut. 