Question

(i) Explain two advantages of writing the software (firmware) for a microcontroller in ‘C’ as oppose...

(i) Explain two advantages of writing the software (firmware) for a microcontroller in ‘C’ as oppose to using assembly.


(ii) For the decimal number 77 determine the 8 bit binary value and the corresponding hexadecimal number.


(iii) For the PIC16 family of microcontrollers how many bits wide is the Program Counter. Explain the purpose of the program counter





(iv) If the PIC microcontroller is clocked by a 1MHz crystal, calculate the instruction clock (internal clock) frequency and hence how many instructions are executed per second.

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

1.Advantages of writing the software for a microcontroller in ‘C’

  • ‘C’ is compiled language always runs fast than assembly.
  • Standardized language because it is easier to port to different compilers or target devices compare to assembly.
  • Many compilers are available in ‘C’.
  • Usable at the hardware level as well as higher abstraction levels.

2. Decimal Number is ‘ 77 ’

     8 bit binary value is ‘ 01001101 ‘

     Hexadecimal value is ‘ 4D ‘

3. The actual hardware inside the program counter holds 22-bits + 1-bit which is always 0 instructions are 24-bits long, but the program memory is actually 32-bits wide. The compiler adds 0 to the 22-bit program counter to make it 23-bits. The 22-bit program counter holds the binary value b010 (decimal 2) then 0 is added to this value which makes it b0100 (decimal 4) b0100 accesses the instruction located at byte range 4-7. The program counter is incremented by b0010 (decimal 2). The 22-bit program counter now holds the value b0100 (decimal 4). When the 0 is added to the 22-bit program counter, the new address to be accessed is b01000 (8-11 bytes).

Purpose of the Program Counter: Program Counter (PC) keeps track of the program execution by holding the address of the current instruction. It is automatically incremented to the next instruction during the current instruction execution.

4. Formula to calculate instruction execution time in PIC microcontroller is

“ t = (No. of clock cycles x 4)/ (Clock Frequency) “

Instruction clock frequency is 4us and 4 clock cycles to executed a command for 1MHz.

Add a comment
Know the answer?
Add Answer to:
(i) Explain two advantages of writing the software (firmware) for a microcontroller in ‘C’ as oppose...
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
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