Question

1. Which input conditions cause the IF statement to evaluate as true? (some may be more...

1. Which input conditions cause the IF statement to evaluate as true? (some may be more than 1 input pin)

if ( (PINB & 0x20) != 0 ) EXAMPLE: PB5 = 1

if ( (PINC & 0x80) == 0 )

if ( (PIND & 0x01) != 0 )

if ( (PINB & 0x03) == 0 )

if ( (PINB & 0x06) == 4 )

Write a complete program (without Arduino commands) to toggle LED-PD6 if PB0 is pressed, and toggle LED-PD7 if PB1 is pressed.

Homework Answers

Answer #1

Answer :-

if ( (PINB & 0x20) != 0 ) EXAMPLE: PB5 = 1, because 0x20 = 0010_0000 so PB5 must be 1, then only if condition will be true.

if ( (PINC & 0x80) == 0 ) , 0x80 = 1000_0000 so PC7 bit must be 0, then we will get AND operation result as zero. Hence if condition will be true.

if ( (PIND & 0x01) != 0 ), 0x01 = 0000_0001 so PD0 pin must be 1, then AND operation results as 1. Hence if condition will be true.

if ( (PINB & 0x03) == 0 ), 0x03 = 0000_0011 so PB0 and PB1 both should be 0 then AND operation results 0. Hence if condition will be true.

if ( (PINB & 0x06) == 4 ), 0x06 = 0000_0110 so PB1 must be 1 and PB2 must be 0 then AND operation will result 4. Hence if condition will be true.

Dear student, please make me clear about " Not Using Arduino Command". Is it not using arduino functions like "digitalRead() or digitalWrite()". You can comment on this. Thank You.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write an OCaml function named is_square that takes as input an integer, say n, (which may...
Write an OCaml function named is_square that takes as input an integer, say n, (which may be positive or negative) and returns true if that number is square. That is, it returns true if there exists an an integer, say m, if m * m = n. Next, write a function named count_squares that calls count from above to determine the number of squares in a list of integers. For example, count_squares [2;3;5] = 0 count_squares [1;2;3;4;5;6;7;8;9] = 3
Evaluate these two statement given; is it true or false statement. Explain why your answer. 1....
Evaluate these two statement given; is it true or false statement. Explain why your answer. 1. Elastic potential energy can be either positive, zero or negative 2. When a spring is stretched by 2 cm, it has more elastic potential energy than when it is compressed by 2 cm.
Problem 1 Consider the discrete-time LTI system characterized by the following difference equation with input and...
Problem 1 Consider the discrete-time LTI system characterized by the following difference equation with input and initial conditions specified: y[n] - 2 y[n-1] – 3 y[n-2] = x[n] , with y[0] = -1 and y[1] = 0, x[n] = (-1/2)n u[n-2]. ? Write a MATLAB program to simulate this difference equation. You may try the commands ‘filter’ or ‘filtic’ or create a loop to compute the values recursively. ? Printout and plot the values of the input signal, x[n] and...
Which statement about tuberculosis (TB) is true? 1.Meningitis is the leading cause of death from tuberculosis....
Which statement about tuberculosis (TB) is true? 1.Meningitis is the leading cause of death from tuberculosis. 2.Chemotherapy, if made widely available, could eradicate the disease. 3.TB is a common co-morbidity in HIV patients 4.The TB bacillus is difficult to isolate.
Determine the True or False statement in the following: 1 Fingerprint is more accurate than face...
Determine the True or False statement in the following: 1 Fingerprint is more accurate than face recognition authentication. 2 Mathematically it is possible for any hash algorithm to have two different outputs for similar input. 3 Based on something you are authentication type, it is possible for non-authorized person to be authenticated 4  Access control policy is applied after authentication step
1. In underground mining, a mine drift usually undergoes some deformation, which may cause stability problems...
1. In underground mining, a mine drift usually undergoes some deformation, which may cause stability problems to the drift if the ground is not supported properly. a) What is the main objective of providing ground support for stress induced deformation? b) Discuss the interaction between the rockmass and ground support in terms of stress and deformation. c) List the following commonly used ground support systems and their applications: mechanical bolt, grouted bolt, frictional bolt, cable bolt, shotcrete/wire mech. Pay attention...
Which of the following is true with regard to a P-value? (More than one answer may...
Which of the following is true with regard to a P-value? (More than one answer may be correct.) a. The P-value is generated under the assumption that the null hypothesis is true. b. The P- value may be negative in some tests. c. If the P-Value is below 5% in a 5% significance level, then the null hypothesis will be rejected. d. In a left-tailed test if the P-Value is 100%, the sample statistic equals the population value as stated...
Write a method which takes as input an integer, returns true if the integer is prime,...
Write a method which takes as input an integer, returns true if the integer is prime, and returns false otherwise. Do not import anything. If the input is negative, 0 or 1, false should be returned. If the input x is greater than 1, you can test if it is prime (inefficiently) by checking if it is divisible by any integer from 2 up to half of x. If it is not divisible by any of these numbers, then it...
Is each statement True or False: 1) Prions are smaller than viruses, which are affected by...
Is each statement True or False: 1) Prions are smaller than viruses, which are affected by radiation. 2) Prions do not contain genetic information, which is affected by ionizing radiation. 3) Denaturants may affect the tertiary structure of prions. 4)Prions are proteins
Question 3 (1 point) Which of the following reasons is why SR latches are not used...
Question 3 (1 point) Which of the following reasons is why SR latches are not used to store modern memory? Question 3 options: Ability to store 1 bit. Immune to timing issues. Ability to be implemented with gates. Timing issues. Question 4 (1 point) Which of the following differentiates a latch and a flip flop? Question 4 options: Usage of a clock. Cannot toggle. Significantly less gates needed for implementation. Ability to store more than one bit. Question 5 (1...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT