00:00 |
- Before we can get too deep into the operation of a factory ECU, we're going to need to first cover some general technical background theory around how electronic devices generally operate and are programmed.
|
00:11 |
While we'll been talking about terms like bits, bytes, binary, decimal and hexadecimal, don't be intimidated or let these put you off.
|
00:20 |
I promise these concepts are relatively simple once they've been explained and being comfortable with them will really help make everything fall into place once we start finding and defining maps inside the ECU.
|
00:33 |
We'll start with the terms binary, decimal and hexadecimal.
|
00:37 |
These terms refer to numerical systems with different bases.
|
00:41 |
The base of a numerical system is simply the number of different symbols that a system has available to indicate different numbers.
|
00:49 |
To start with, let's have a look at the decimal system as this is the one we're all familiar with in our daily lives.
|
00:56 |
Using the decimal system is likely second nature and you don't give any thought to how it works but we'll break it down a little with a couple of simple examples and then show how these examples differ if we use binary or hexadecimal.
|
01:10 |
The decimal system uses a base of 10 which just means that there are 10 different symbols available to describe numbers, being the digits 0 through to 9.
|
01:20 |
To show how we use these symbols, let's say we want to count the number of cylinders in an engine.
|
01:26 |
If we're looking at a V8 LS1 for example and we want to write down how many cylinders the engine has, we can use a single symbol for this which of course is the digit 8.
|
01:36 |
We can use a single symbol because the number that we want to describe is less than the base of our numerical system.
|
01:43 |
But if instead we consider a V12 engine, then the number of cylinders is now higher than the base of our decimal system and we don't have an individual symbol available to describe this number.
|
01:53 |
This means we need to use a combination of our available symbols which in this case will be a 1 followed by a 2.
|
02:01 |
When we write this down, what we're really saying is that the number we're describing is one times by our base system of 10, plus two times one, or 10 plus two which of course is 12.
|
02:14 |
If we then wanted to describe the number of cylinders in both engines together, we could write down a 2 followed by a 0, meaning two times by our system base of 10, plus zero times one, which is course is 20.
|
02:28 |
This can take a moment to process since we don't need to think about how the number 12 is constructed by going back and understanding what the individual values mean is key when we move into other numerical systems.
|
02:41 |
Let's try the same examples again but using the hexadecimal system this time which has a base of 16.
|
02:47 |
This means we now have 16 available symbols to describe numbers, being the digits 0 through to 9, followed by the letters A through to F.
|
02:56 |
These represent the numbers 10 to 15 respectively.
|
02:59 |
To describe the number of cylinders in our LS1 engine, this is still lower than our numerical system base so we can still use a single symbol to represent this number.
|
03:09 |
Once again, the digit 8.
|
03:12 |
With the V12 example however, our numerical system base of 16 is now higher than the number we want to describe so we can have a single symbol available to us that represents the number 12 which in hexadecimal is C.
|
03:25 |
However, describing the total number of cylinders in both engines is once again a higher number than our numerical base of 16 so we'll again need to use a combination of symbols.
|
03:35 |
In this case we'd write down the digit 1 followed by the digit 4.
|
03:40 |
In the hexadecimal system this means one times our system base of 16, plus four times one, or 16 plus four which is 20.
|
03:49 |
This is where a lot of confusion can come in as when we see the symbols 1 and 4 put next to one another, we immediately think of the number 14 because we're so used to working the decimal system.
|
04:01 |
To help with this, when we write down a number in hexadecimal, we prefix it with a 0x.
|
04:07 |
So to write down the number 20 in hexadecimal, we would write 0x14.
|
04:13 |
Back to our cylinder counting examples, let's look at how they would differ if we were working in binary.
|
04:19 |
Binary has a base of two, meaning we only have two different symbols available to us to describe different numbers, being the digits 0 and 1.
|
04:28 |
Straight away, the number of cylinders in our LS1 engine is higher than our numerical system base so we're going to have to use a combination of our available symbols.
|
04:38 |
In this case, we'd write down the digit 1, followed by three 0s.
|
04:42 |
It's important to understand that every column our number has is the number of times the symbol in that column is multiplied by the system base before everything gets added together to get the overall number.
|
04:54 |
This sounds complicated but you probably remember learning this in school for the decimal system as the 1s column, the 10s column, the 100s column and so on.
|
05:04 |
If we write down 138 in decimal, this means one times 10 twice, so that's one times 100.
|
05:11 |
Plus three times 10 or 30, plus eight or one hundred and thirty eight.
|
05:17 |
This is the same for our binary example except our base now is two.
|
05:21 |
So 1, 0, 0, 0 means one times two three times, which is one times eight, plus zero times two twice, plus zero times two plus zero which is eight, plus three zeros, or just eight.
|
05:38 |
For our V12 example with 12 cylinders, we would write this down as 1100, meaning one times two three times, or eight, plus one times two twice, or four, plus zero plus zero, giving us 12 all up.
|
05:54 |
Once again, if we just saw 1100 written down, we'd instinctively read this as one thousand, one hundred because we're so used to the decimal system.
|
06:04 |
So to make it clear we're writing down a number in binary, we prefix it with 0b, so we would write 0b1100.
|
06:13 |
To describe the total number of cylinders in both engines, we would write down 0b10100.
|
06:21 |
Meaning one times two four times, which is 16, plus zero, plus one times two two times, which is four, plus zero, plus zero.
|
06:31 |
Or 16 plus four which of course is 20.
|
06:34 |
If you haven't come from a computing background, you can be forgiven for starting blankly at the screen right now with your mouth hanging open.
|
06:41 |
I'll admit, we got deep pretty fast here but I'd urge you to go back over this module a few times, grab some paper and a pen and work through the different systems and columns until everything starts to make sense to you.
|
06:54 |
It's actually not too tricky but unfortunately you've spent your entire life to this point working in base 10 so there's a bit of unlearning to do in order to understand these different systems.
|
07:05 |
If you're still confused then luckily there is a really common tool available that will let you translate between these numerical systems easily, and that's the Windows calculator application.
|
07:16 |
If you load the calculator application and change the mode to programmer, you can then choose to enter a number in binary, decimal or hexadecimal and see how it would be described in these other numerical systems.
|
07:29 |
Trying it now, if we put the calculator into programmer mode and the numerical system to hexadecimal, then enter 14, you can see that this is the same as 20 in decimal and 10100 in binary.
|
07:45 |
All these representations mean exactly the same thing which is the number 20, they're just being shown in different numerical base systems.
|
07:54 |
In the real world, the reason we need to know about binary, decimal and hexadecimal is that we can display the contents of the ECU's data in different ways and it's helpful to be able to understand what you're looking at as well as how to convert between the different systems.
|
08:09 |
Luckily we don't need to perform any complicated math in binary or hex so a complete understanding of them is not crucial.
|
08:16 |
There's been a bit to take in here so let's have a quick recap.
|
08:20 |
Remember that decimal, hexadecimal and binary are just different numerical systems with different bases.
|
08:27 |
The decimal system which we're most familiar with for an example, uses a base of 10 while hexadecimal is base 16 and binary is base two.
|
08:35 |
To avoid confusion, we use the prefix 0x or 0b to indicate a hexadecimal or binary number.
|
08:42 |
If you're ever confused then you can always use the programmer mode on your calculator to convert between the different numerical systems.
|