Nikolay, Mark,
Am 02.01.2013 19:28, schrieb Nikolay Shishkov:
can_2_soc2 = ((unsigned
int) can_databuffer[4] << 8) + can_databuffer[5];
Initially I got the 5th and 6th array
elements, but noticed that I had it wrong... so I changed to
4th and 5th...
And finally at the debug sms handler:
s = stp_i ( s, " SOC=", can_2_soc2 );
I changed the strings abit and can
see that the new code is running, but do not understand
how come a completely different values are reported - the
value is from can_databuffer[5] and can_databuffer[6].
So the 301 contains the following
bytes (viewed with PCAN) 00 00 0e 7d 01 b2 0a 4a.
The SOC is supposed to
be in 0E7D (actually it is the DOD), but I am getting
the 0AB2 in the can_2_soc2 value.
I don't know PCAN, but the CAN byte numbering normally begins at 0
on the left, so 0e in your example is can_databuffer[2] and 7d is
...[3].
If you get 0AB2, that would be [6][5] = your initial code?
Btw: we could solve variable name conflicts between vehicle modules
by introducing some namespace prefix (replacing "can_") like Mark
already did for the functions. I'd shorten that for vars to e.g.
"vrt_" for "vehicle renault twizy", accordingly "vtc_" for the Think
and so on. OK, Mark?
Regards,
Michael
--
Michael Balzer * Paradestr. 8 * D-42107 Wuppertal
Fon 0202 / 272 2201 * Handy 0176 / 206 989 26