Our VIP Package gets you every single course at 80% off the individual price. For a limited time, save an additional \$100 with coupon code 100VIP. Learn more

# CAN Bus Communications Decoded: Step Five: Determine variable scaling

-OR-

## Step Five: Determine variable scaling

### 03.26

 00:00 The last step of our process is called determining parameter scaling. 00:03 In this instance it's more determining the exact response on the data stream there that corresponds to button presses on our keypad. 00:13 And in particular the one that we're looking for is our start/stop button here. 00:17 So by pressing that, I can see our first data byte of our frame there. 00:25 As I press it, it changes to 02 and as I release it it changes back to 00. 00:32 And every time I press that, our last data byte there, so that's data byte 4 is increasing and it's continually increasing every time I press any of the buttons on this keypad. 00:48 What that leads me to believe is that that last data byte is actually going to be a timestamp, it's going to be the number of, the amount of elapsed time since there was an input to the keypad. 00:59 That's not really information that I'm interested in at the moment so we're going to focus just on our first data byte there, data byte 0 which is the one that's changing when we're pressing a button. 01:10 So in particular we're looking at this data byte here. 01:17 So if I press our start/stop button, I can see that that is changing from 00 to 02. 01:24 If I open up our calculator app and I head into hexadecimal mode here, we're in the programmer mode of the calculator and I'm in hex. 01:35 If I put in 02 which is our response when that button is pressed, I can see in binary that's a value of 0010. 01:47 Now that 1 in binary is in the second bit position or bit position 1 because the numbering starts from 0. 01:57 What that's leading me to believe is that that bit position 1 is related to the state of our button here. 02:06 So when that bit position 1 is 1, the start button is pressed and when it's 0, the button isn't pressed. 02:14 Leading on from that, I think we could probably pretty safely determine that the bit positions in that first data byte are actually what are going to represent the button presses on our keypad here. 02:26 So I'll just close down our calculator app, once again looking at our first data byte there, I suspect if I press our system on/off button which is quite often a lightning bolt which we've got here, I think we're going to see that data change from 00 to 01 'cause that would be the bit in position 0 changing from a 0 to a 1. 02:48 Which is exactly what we see. 02:50 So I think it's pretty safe to say that our bit positions are going to be 0, 1, 2, 3 and then the log button is going to be bit position 5, 6, 7 and 8. 03:02 So that's going to be the relationship between our inputs to our keypad here and the data on the CAN bus completely determined.