Explorer 16

Question 3.
We want to send a character B (ASCII CODE 42H) through UART2 with 1 stop bit and using odd parity.
Q1. Write the packet. (3 Marks)
Q2. If baud rate is 9600, then, to transmit this packet, UART2 will take how much time? (3 Marks)

Q1. To send the character B (ASCII CODE 42H) through UART2 with 1 stop bit and odd parity, the packet will consist of the following components:

Start Bit: 0
Character: 01000010 (B in binary representation)
Parity Bit: 1 (odd parity)
Stop Bit: 1

Combining these components, the packet can be written as follows:
01100001010000101

Q2. To calculate the time taken to transmit this packet, we need to consider the baud rate. Given that the baud rate is 9600, we can use the following formula to calculate the transmission time:

Transmission Time = Number of bits / Baud rate

The number of bits in the packet can be calculated as follows:
Number of bits = Start Bit + Character Bits + Parity Bit + Stop Bit

Start Bit = 1 bit
Character Bits = 8 bits (1 byte for ASCII CODE 42H)
Parity Bit = 1 bit
Stop Bit = 1 bit

Number of bits = 1 + 8 + 1 + 1 = 11 bits

Substituting the values into the formula:
Transmission Time = 11 bits / 9600

Therefore, the time taken to transmit this packet is approximately 1.1458 milliseconds.

Q1. The packet to send the character B (ASCII CODE 42H) through UART2 with 1 stop bit and odd parity would consist of the following:

1. Start bit: Logic low (0)
2. Data bits: The character B in binary is 01000010.
3. Parity bit: An odd parity bit is calculated based on the data bits. Since the number of 1s in the data bits is odd (2), the parity bit would be 0.
4. Stop bit: Logic high (1)

Therefore, the packet would be: 0 01000010 0

Q2. To calculate the time required to transmit the packet, we need to consider the baud rate. Baud rate represents the number of bits transmitted per second.

Given that the baud rate is 9600, it means 9600 bits will be transmitted per second.

The packet contains a total of 10 bits (1 start bit + 8 data bits + 1 stop bit).

Therefore, the time required to transmit the packet can be calculated as:

Time = Number of bits / Baud rate
Time = 10 bits / 9600 bits per second

Time = 0.00104 seconds (rounded to 5 decimal places)

So, to transmit this packet, UART2 will take approximately 0.00104 seconds.

Q1. To write the packet with character B (ASCII CODE 42H) using UART2, with 1 stop bit and odd parity, we need to follow the UART protocol.

1. Start Bit: The UART communication starts with a start bit, which is always a logic low (0). For UART2, we assume that the start bit is already appended to the packet.

2. Data Bits: The character B (ASCII CODE 42H) is represented in 8 bits. The data bits for ASCII code 42H are: 01000010.

3. Parity Bit: For odd parity, the number of logic high (1) bits in the data bits is counted. If the count is odd, the parity bit is set to 1, making the total number of 1s in the data bits and parity bit odd. In this case, there are 3 logic high bits in the data bits (01000010), so the parity bit is set to 1.

4. Stop Bit: 1 stop bit is appended at the end of the data bits and parity bit. So, we add a logic high (1) stop bit after the parity bit.

Putting it all together, the packet to send character B through UART2 with 1 stop bit and odd parity would be:
010000101

Q2. To calculate the time taken to transmit this packet through UART2 with a baud rate of 9600, we need to consider the formulas:
Transmission Time = (Number of bits / Baud Rate)

Number of bits = Data bits (8) + Parity bit (1) + Stop bit (1) = 10 bits

Using these values in the formula:
Transmission Time = (10 bits / 9600 baud)
Transmission Time = 1.042 milliseconds

Therefore, UART2 will take approximately 1.042 milliseconds to transmit this packet at a baud rate of 9600.