To nick gammon
union ByteToLong
{
struct
{
byte a1: 4;
byte a2: 4;
byte b1: 4;
byte b2: 4;
byte c1: 4;
byte c2: 4;
byte d1: 4;
byte d2: 4;
} nybble;
unsigned long whole;
};
The wrong output is
8000
8010
The correct is
8000
8002
8004
8006
8008
8010
If you put the code snippet that i posted in a sketch and call it:
ReadData(8000, 8010);
you will get the output!
I will try the mods from dhenry!