# CAN Bus Communications Decoded: Bits and Bytes

## Bits and Bytes

### 03.18

00:00 | - Bits and bytes are the terms we use when we're talking about how electronic devices read and store data. |

00:06 | You'll need to have a good grasp on what these terms mean as we're going to be using them frequently throughout the rest of the course. |

00:13 | Although they will initially seem a little abstract and possible confusing, once you start dealing with them in the worked examples section, the concepts will fall into place and become second nature. |

00:22 | A bit is simply the smallest individual piece of information an electronic device can intepret and store. |

00:29 | It is a single binary digit which has a maximum value of 1 and a minimum of 0 and these are the only 2 values it can ever have. |

00:38 | Sometimes these values are referred to as on and off or high and low. |

00:43 | Binary is the language of computers and electronics and although we naturally think of the data we might want to send around a CAN network in decimal terms, it all needs to be converted to binary at some stage so our electronics can work with it. |

00:57 | A byte on the other hand is simply a group of 8 bits and as each bit is a single binary digit, this means a byte is an 8 digit long binary number. |

01:07 | The maximum value a byte can have is 255 and the minimum value is 0. |

01:14 | To verify this, we'll open up the calculator app and enter the largest possible 8 digit binary number which is just 8 1s, and see what this translates to in decimal and hexadecimal. |

01:25 | You can see that this is 255 in decimal or two hundred and fifty five and is FF in hex. |

01:32 | So if we naturally think of data in decimal terms and our electronics needed in binary terms, why in the previous section of the course did we also introduce the hexadecimal system? Well if you look at the largest possible 8 digit binary value in the calculator, you can see that this value in hexadecimal is FF. |

01:51 | This is the largest possible that we can represent with 2 hexadecimal digits. |

01:57 | So our 8 digit binary number and our 2 digit hexadecimal number have the same maximum and minimum values. |

02:05 | This gives us a great shortcut when we're wanting to represent a byte of data as a byte is just an 8 digit binary number, we can convert it to hex and write it down using only 2 digits which is much faster. |

02:18 | Almost universally, you'll find the tool used to look at data on a CAN bus will show this data in a hexadecimal format. |

02:26 | Sometimes we refer to the individual bits within a byte by their position which is position zero to position 7. |

02:33 | This might seem odd but we start numbering the bit position from 0 because of the way computers and array indexing works. |

02:40 | The reasons for this are outside the scope of this course but just be aware that 0 is a number and our bit positions are numbered from 0 to 7. |

02:49 | To recap, a bit is the smallest possible piece of data and is just a binary digit, being either a 0 or a 1. |

02:57 | A byte is simply a group of 8 bits together or an 8 digit binary number, having a maximum value of 255 and a minimum value of 0. |