Question

State the voltages you expect to appear on PORTB pins(7 to 0) in each of the...

  1. State the voltages you expect to appear on PORTB pins(7 to 0) in each of the following cases:

portb = 0x47;

portb = 47;

portb = 11b;

portb = 101;

portb= 0b01010101;

  1. If a variable called my_counter is declared as follows:-

unsigned char my_counter;

  • How many bytes of RAM will the variable occupy?
  • What is the minimum and maximum values the variable could have?
  1. A variable called count has the value 20. What value does it have after the following statement has been executed?

count = count >> 2;

  1. There is a difference between logical operators(!, || , &&) and bitwise operators (~, |, &). What values does portb have after the following statements are executed.

portb = 0x01 || 0x06;

portb = 0x01 | 0x06;

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer :-

portb = 0x47; i.e. in binary it is 0100_0111 hence pins 3, 4, 5 and 7 will have zero voltage and pins 0, 1, 2 and 6 will have voltage label as Vcc.

portb = 47; i.e. in binary it is 0010_1111 hence pins 4, 6 and 7 will have zero voltage and pins 0, 1, 2, 3 and 5 will have voltage label as Vcc.

portb = 11b; hence pins 0 and 1 will have Vcc and rest all pins have zero potential.

portb = 101;i.e. in binary it is 0110_0101 hence pins 1, 3, 4 and 7 will have zero voltage and pins 0, 2, 5 and 6 will have voltage label as Vcc.

portb= 0b01010101; pins 0, 2, 4 and 6 have Vcc and 1, 3, 5 and 7 will have zero voltage label.

  1. If a variable called my_counter is declared as follows:- unsigned char my_counter;
  • How many bytes of RAM will the variable occupy? unsigned char have one byte of memory.
  • What is the minimum and maximum values the variable could have? minimum when all 8-bits are zero in one byte so minimum value is zero. Maximum when all 8-bits are 1 i.e. 1111_1111 in binary. Hence 255 in decimal.
  1. A variable called count has the value 20. What value does it have after the following statement has been executed?

count = count >> 2; This operation on count will make count to be divisible by 2 as right shift operation is equivalent of divide by two. Thus count = 10.

  1. There is a difference between logical operators(!, || , &&) and bitwise operators (~, |, &). What values does portb have after the following statements are executed.

portb = 0x01 || 0x06;

portb will have value equal to 0x01 since logical operator gives either 0 or 1. Here 0x01 and 0x06 are non-zero numbers, so logical operator will give 1, hence portb = 0x01.

portb = 0x01 | 0x06;

here bitwise ORed value of 0x01 and 0x06 will be stored in variable portb. 0x01 = 0000_0001 and 0x06 = 0000_0110. The bitwise ORed value is 0000_0111 i.e. 0x07 in hex, hence portb = 0x07.

Add a comment
Know the answer?
Add Answer to:
State the voltages you expect to appear on PORTB pins(7 to 0) in each of the...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C programming lab: Description: In this lab you will write a program that will contain two...

    C programming lab: Description: In this lab you will write a program that will contain two functions, setlsbs() and getlsbs(). These functions will use bitwise operators to embed and extract "hidden" bits in a character array. Write a program to test your functions as follows: Obtain a random number seed from the command line of your program using command line arguments. Initialize an array p of 8 unsigned char with random numbers from 0 to 255 Initialize a separate unsigned...

  • State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator...

    State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator moves it from the back toward the front of a list b) The body of a do-while loop is always executed at least once. c) If p points to the array element a[j], then p + i points to a[i+j]. d) Any number of pointer variables may point to the same object. In terms of both execution speed and memory usage usually iterative solutions...

  • Problem 1 1 def modify(word.ch). word == word + ch return word print('new word is', word)...

    Problem 1 1 def modify(word.ch). word == word + ch return word print('new word is', word) To run the function modify() defined above, we make the following call: result = modify('course', 's') Find and fix the errors in the function definition, lines (1) to (4), such that after the call is executed: • Variable result has the value 'courses' • 'new word is courses' is printed out. For each error found and fixed, you must indicate the following: • line...

  • Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal...

    Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal '2', a string literal "2", and the numeric literal 2 are identical and stored the same way though they are different types. 3 Since comments do not affect the program execution, you don't need to have it at all. 4. After the following statements are executed, the value of the variable rem is 3. 1. A preprocessor directive line starts with a pound sign...

  • Objectives You will implement and test a class called MyString. Each MyString object keeps track ...

    Objectives You will implement and test a class called MyString. Each MyString object keeps track of a sequence of characters, similar to the standard C++ string class but with fewer operations. The objectives of this programming assignment are as follows. Ensure that you can write a class that uses dynamic memory to store a sequence whose length is unspecified. (Keep in mind that if you were actually writing a program that needs a string, you would use the C++ standard...

  • I've posted 3 classes after the instruction that were given at start You will implement and...

    I've posted 3 classes after the instruction that were given at start You will implement and test a PriorityQueue class, where the items of the priority queue are stored on a linked list. The material from Ch1 ~ 8 of the textbook can help you tremendously. You can get a lot of good information about implementing this assignment from chapter 8. There are couple notes about this assignment. 1. Using structure Node with a pointer point to Node structure to...

  • You will write the following files: mystack.h - contains the class definition for the mystack class....

    You will write the following files: mystack.h - contains the class definition for the mystack class. mystack.cpp - contains the definitions for member functions of the mystack class. inpost.cpp - contains your convert() function. inpost.h - contains the function prototype for convert() so that the main() can call it. Each of the files (with the exception of inpost.h) is described in more detail below. All header files should contain header guards to prevent them from being included multiple times in...

  • Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be...

    Don't attempt if you can't attempt fully, i will dislike a nd negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book tit le, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an...

  • Don't attempt if you can't attempt fully, i will dislike and negative comments would be given...

    Don't attempt if you can't attempt fully, i will dislike and negative comments would be given Please it's a request. c++ We will read a CSV files of a data dump from the GoodReads 2 web site that contains information about user-rated books (e.g., book titnle, publication year, ISBN number, average reader rating, and cover image URL). The information will be stored and some simple statistics will be calculated. Additionally, for extra credit, the program will create an HTML web...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT