[Ovmsdev] Coding help

Shane @ Kilve Engineering shane at kilve-engineering.co.uk
Fri Mar 5 02:45:11 HKT 2021


Good evening Michael, 

Or any one that has the time to help, 

Ive now successfully retrieved as much info as I can without polling any info for the maxus, but I have have now found an ecu that responds to pid requests. 

For example if I use the obdii pid scanner I get the loads of data back and I’ve decoded some of it, just need a bit of guidance how to write the code to get the same info 

A part of a scan is as follows

Scan complete (7e3 e000-e100)
Scan started : 2021-03-04 18:32:36 GMT
Last response: 2021-03-04 18:32:39 GMT
7e3[7eb]:e000 00
7e3[7eb]:e001 64
7e3[7eb]:e002 4b
7e3[7eb]:e003 26 bc
7e3[7eb]:e004 00 07
7e3[7eb]:e005 2f
7e3[7eb]:e006 2e
7e3[7eb]:e007 02 00
7e3[7eb]:e008 01 ff
7e3[7eb]:e009 02 00
7e3[7eb]:e010 02 00

I know that e003 is SOH = 26bc = 9916 /100 = 99.16% SOH
And e002 is a temp 4b = 75 / 10 = 7.5 degrees

So if some one can help me with an example of how to correctly code this one I can work out the rest, 

Ive looked through various vehicles but everyone uses different methods and I can’t seem to get one to work for me. 

Any help much appreciated 

Shane

> On 15 Feb 2021, at 08:05, Michael Balzer <dexter at expeedo.de> wrote:
> 
> Shane,
> 
> I forgot to mention: if you're working on a new vehicle module, you'll also need to start the bus somewhere in your initialization code. Example:
> 
>   RegisterCanBus(1, CAN_MODE_ACTIVE, CAN_SPEED_500KBPS);
> 
> Regards,
> Michael
> 
> 
> Am 15.02.21 um 08:36 schrieb Michael Balzer:
>> Shane,
>> 
>> Am 14.02.21 um 16:42 schrieb Shane @ Kilve Engineering:
>>> can any one help me with a bit of code to retrieve ve some data from ecu can1/6f2  00 4c 00 00 01 97 bc 00 as i cant poll this ecu it just broadcasts when its active, ive tried polling it but does not respond, i need to choose one byte and allocate it to a PID.
>> 
>> I don't know what you mean by "allocating a byte to a PID", but if you want to process frames received directly, simply override IncomingFrameCan1() (or …2/3/4 depending on your bus).
>> 
>> Reduced example:
>> 
>> void OvmsVehicleXYZ::IncomingFrameCan1(CAN_frame_t *p_frame)
>> {
>>   uint8_t *d = p_frame->data.u8;
>> 
>>   switch (p_frame->MsgID)
>>   {
>>     case 0x6f2:
>>       // for example, assuming the SOC is in byte 1:
>>       StdMetrics.ms_v_bat_soc->SetValue(d[1]);
>>       break;
>>   }
>> }
>> 
>> If you're outside a vehicle context, you can register your own CAN receiver by creating a queue and calling MyCan.RegisterListener(). See the vehicle module for an example.
>> 
>> Regards,
>> Michael
>> 
> 
> -- 
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
> 
> 
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20210304/4077e2c9/attachment.htm>


More information about the OvmsDev mailing list