Need a Tutorial on Understanding Bit Encoded Messages

Hello all;

So I am working on a CANBUS Arduino application that can read trouble codes from a vehicle. I searched the forums and got some great tips on a MCP2515 library, and have tested out the library and it works great when obtaining PIDs from the vehicle’s ECU, one thing I have not been able to find however is how to parse the trouble codes.

Looking at wikipedia I found that you can request the trouble codes by doing a request to 0x03. This was fairly easy and I did manage to get a response from my vehicle.

Using the MCP2515 library, this is the message I sent:

  message.adrsValue = 0x7DF;[0] = 0x01;[1] = 0x03;
  for(int i = 2; i < 8; i++) {[i] = 0x00;

And I get a return message of

message.adrsValue = 0x7E8;[0] = 0x04;[1] = 0x43;[2] = 0x01;[3] = 0x01;[4] = 0x00;[5] = 0x00;[6] = 0x00;[7] = 0x00;

I did manage to find some code on google that allowed me to get the first DTC:

	  if([1] == 0x43) {		  
		int hexA =[3];
		int hexB =[4];
		String milCode = ""; 
		switch(hexA & 0xC0)
			case 0x00:
			milCode += 'P';  // powertrain
			case 0x40:
			milCode += 'C';  // chassis
			case 0x80:
			milCode += 'B';  // body
			case 0xC0:
			milCode += 'U';  // network
		milCode += String((hexA & 0x30) >> 4, DEC);   // first digit is 0-3 only
		milCode += String((hexA & 0x0F),      DEC);
		milCode += String((hexB & 0xF0) >> 4, DEC);
		milCode += String((hexB & 0x0F),      DEC);

But now I am confused how I would be able to get the other stored DTC’s ? Although the response that came back from my car shows only one trouble code, I know there are times when more than one code is being thrown.

Can anyone help? Thanks!