QuestionQuestion

Transcribed TextTranscribed Text

1. (a) The letter ‘H’ has the ASCII code 0x48. Show the complete word that would be used to send this character over a serial port link using the 7-E-2 format, sending the most significant bit first. (b) An asynchronous communication link sends the message Hello. How are you? What are you going to do today? over an RS232 link using ASCII encoding and 38400 7-E-2 format. Calculate how long the message takes to send. Calculate the overhead associated with the protocol (i.e. the number of non-data bits sent divided by the total number of bits sent). (c) The devices at either end of a serial port link must use baud rates that are approximately equal. Explain what factors determine the degree of baud rate mismatch that is tolerable. Calculate the maximum allowable mismatch when using 38400 7-E-2 format. (d) Figure 1 (on the next page) shows the special function registers associated with baud rate generation for a PIC18F2525 microcontroller with a clock frequency of fOSC = 8 MHz. If the following settings are applied:  SYNC=0  BRGH=1  BRG16=1 calculate what hexadecimal values should be stored in SPBRGH (high byte) and SPBRG (low byte) to give a baud rate of 38400. The actual baud rate that is set will be different from that required. Calculate the baud rate error. Explain whether or not this error is within tolerable bounds. (e) We wish to build an embedded system that uses a microcontroller that exchanges data with some sensors and an actuator. The sensors and actuator are available in SPI versions or in I2C versions. Explain (in not more than 400 words) the relative advantages of using SPI or I2C to manage the communication and in which circumstances might each possibility be preferred Figure 1 2. (a) Consider the following 8-bit addition carried out by an arithmetic logic unit (ALU). The registers are 8 bits wide: Load 0x34 into R1 Load 0x5B into R2 Add R3 = R1+R2 (i) What will be the 8-bit result in register R3 (in hex)? (ii) What is the 8-bit value in registers R1, R2, R3 interpreted as unsigned decimal? (iii) What is the 8-bit value in register R1, R2, R3 interpreted as signed decimal? (iv) What will be the resulting value of the carry (C) status flag? Explain the significance of your result. (v) What will be the resulting value of the overflow (V) status flag? Explain the significance of your result. (b) In the C language, a variable sfr1 is declared as follows: uint8_t sfr1; This variable is used to hold bits which control various functions of the microcontroller. As the device operates, we will want to change some of the bits within the variable whilst leaving the other bits completely unchanged. (i) Devise a statement in the C language that would set bits 2 and 5 of variable sfr1 to a value of 1, whilst leaving the other bits unchanged. (ii) Devise a statement in the C language that would set bits 1 and 4 of variable sfr1 to a value of 0, whilst leaving the other bits unchanged. (ii) Devise a statement in the C language that will reverse the value of bits 0 and 3 of variable sfr1 (i.e. 1 becomes 0 and 0 becomes 1). (c) A simple condition monitoring system based around the PIC microcontroller draws the following typical currents:  90 nA in sleep mode (90% of the time)  5.5 μA in idle mode (9% of the time)  20 mA in active mode (1% of the time) (i) What charge is required to operate the system for 1 hour? (ii) The PIC micrcontroller will be powered by a 3 V battery that is made up of two AA cells, each with a capacity of 3 Ah. For how long will the microcontroller operate? Assume that the battery capacity does not degrade over this time. (iii) If the system is only required to operate for 1 year, what is the required capacity of the battery? Assume that the battery capacity does not degrade over this time. (d) Briefly (in no more than 400 words) summarise the relative advantages and disadvantages of programming an embedded system in assembler versus programming in a high level language such as C. Give an indication of where and when the different approaches are likely to be used.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

Task-1
(a) The letter ‘H’ has the ASCII code 0x48. Show the complete word that would be used to send this character over a serial port link using the 7-E-2 format, sending the most significant bit first.

7-E-2 format has seven data bits, even parity bit, two stop bits
Start bit    0
data 0x48 1001000
even parity (1+1) = 0
Two stop bits 11

Sending bits    01001000011 total 11 bits

(b) An asynchronous communication link sends the message Hello. How are you? What are you going to do today? over an RS232 link using ASCII encoding and 38400 7-E-2 format.
Calculate how long the message takes to send.
Calculate the overhead associated with the protocol (i.e. the number of non-data bits sent divided by the total number of bits sent).

The message is “ Hello. How are you? What are you going to do today?”
Total 51 characters are available.
The baudrate is 38400 and the bit per second is 2.6042e-05 sec
51x11 bit = 561 bits and total time 561x2.6042e-05 = 0.0146

(c) The devices at either end of a serial port link must use baud rates that are approximately equal.   Explain what factors determine the degree of baud rate mismatch that is tolerable.   Calculate the maximum allowable mismatch when using 38400 7-E-2 format.
Usually, If the receiving UART device has a baud rate mismatch of more than 5%, then a error of framing can occur when the stop bit is captured incorrectly. Below the %5 error rate acceptable for the serial communication. We try to calculate it;
Ttx = 1 / baudrate = 26,042 us...

By purchasing this solution you'll be able to access the following files:
Solution.docx.

$140.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats