[MUSIC] This lecture will continue talking about UART, talk about more of the bits that are transmitted in addition to the data bits and the start bit. So Parity Bit. This is an optional bit that you can transmit with the data. So transmission is assumed to be error prone. This is very common, long distance communication. You can have lots of electromagnetic radiation. Some kind of noise, right? So this maybe synchronization accuracy, or inaccuracy, something like that. There are lots of reasons why there can be noise on a line. So there can be times where you expect a zero. Zero is being transmitted, but the receiver receives a one instead, or vice versa. You transmit a one but the receiver receives a zero, because of various types of noise. So to adjust for that, to take care of that, at least to detect that, we have parity bits. So parity bit is optional. One parity bit can be sent with each packet, each, say group of eight data bits. The parity bit is used to check for error. So, the parity of a sequence of bits. So let's say we're sending eight bits, eight data bits. The parity is the count, you either have even parity or odd parity, and it's related to the number of ones that are transmitted. So, if you're transmitting eight bits and an odd number of those bits are ones, then you say you have odd parody. And if an even number of those bits is a one, then you have even parity. So parity's always gonna be even or odd. Let's say even is zero and odd's a one. So parities of any sequence of bits is always even or odd depending on how many bits you're transmitting. So what we do is, if we use a parity bit, we send the data bits, and then we also send one more bit which is the parity bit, which is either zero or one. A zero if the parity of the other bits is even, a one if it's odd. And then what can happen is on the receiving end, it can check the parity. So it can count the number of ones that it received, and checks if it's even or odd, and then it compares that to the parity bit. If the parity bit set is even, it's parity bit is zero, let's say, indicating that it's even parity, and it has an even number of ones, then it assumes, okay, transmission was fine. Where if it gets odd parity, then it assumes that transmission was not fine, and it needs a new transmission. It basically sends some kind of request to say, send me the data again. Oh, and this bit, this parity bit is sent after the data bit. So you have the start bit, then you have the data bits, then you send the parity bit, then you send the stop bit, or bits. You can send one or more stop. So here's an example, we've got some series of bits, eight bits, and there are five ones in those eight bits. So it's an odd number of ones, that means this set of eight bits is odd parity. So the parity bit that would be set with this would be a one. So you'd send these eight bits, then you'd send one more one. And the total parity is odd, so now at the receiving end, it, as it counted the number of ones that came in. It counted five ones, it realized that was odd compared to the parity bit, and if the parity is also one, the parity bit's one, then it says this is okay. Where if one of these bits was flipped in transmission, then the parity would have changed, say zero was changed to a one, or one change was zero. Either way, the parity would have become even and it would have noticed a mismatch. So if a single bit is changed, then this can be detected using a parity bit. Note that this is sort of a minimal check because if two bits are altered, then you won't detect it, right? Cuz two bits, say you change zero to one then you change a one to a zero, then the total number of ones stays the same even though the data is still incorrect. So you wouldn't catch that. If two bits are changed, you might miss it. You would miss it if two bits are changed, but if a single bit is changed, you could detect that using a parity bit. So in addition to the parity bit, you have to have stop bits. Now the parity bit is optional, stop bit is required. Although you can have one or two stop bits, you have to have at least one stop bit. So in this example, this timing diagram, we show one start bit at the beginning, eight data bits, no parity bit, but then we have the stop bit right at the end. A single stop bit, in this case. Now, the stop bit, basically it's high, it's always high. So after the eight databits are sent and a parody bit, if a parody bit is gonna be sent. The signal should be high. So the stop bit is the time when the signal is high after the transmission is done. It's expected to be high. You can take one stop bit or two stop bits. If it's not a high, if it's not a one at that point, then it's assumed that an error has occurred, and retransmition is gonna be required. So, Data Throughput versus Baud. So the Baud rate is the maximum number of transitions in a second. The maximum transitions, which is the maximum bits that you can send. And it's true that you can send that many bits, but not all of those bits are actually data bits. So the data throughput is not as high as the Baud rate, because you're sending the stop bit, the start bit and the parody bit. Stop bit could be two bits and the parody bit, you send this extra stuff that is not actually data. So the data transmission rate is going to be less than the baud rate. So, these signalling bits have to be sent, so let's imagine an example where you're sending eight data bits. And you're sending one parity bit, and one stop bit, and start bit, let's say. So, you're sending eight data bits, but there are 11 actual bits that you have to send in order to send the eight, right? Cuz you gotta send the start bit, and the parity bit, and the stop bit, and I'll say the baud rate is 9600 baud. So nice things in a baud would be the maximum rate of the number of bits, 9600 bits per second can be sent. But you're sending 11 bits a second, 8 data bits. So your data throughput, would be less because the transmission efficiency is only eight out of 11. So you get 73% efficiency out of that. So the data throughput rate is actually only 73% of 9600. So you get, 6981 bits per second of data that you can actually send when you're using 9600 baud under those assumptions. Thank you. [MUSIC]