This is brilliant
I'll be home tonight and try it with a controller.
Protocol j1587
-
- Posts: 42
- http://meble-kuchenne.info.pl
- Joined: Thu Jun 23, 2022 11:43 am
- Has thanked: 12 times
-
- Valued Contributor
- Posts: 1019
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 107 times
- Been thanked: 531 times
Re: Protocol j1587
Let us know how it goes... Remote debugging is notoriously tricky
I think the one piece of error checking it needs is to check the length of the message - if it's greater than 21 bytes then reset and start looking for MID again.
As it stands - is the end isn't found then it will trample over memory and crash (using the position mod 10 would solve this)
Martin
I think the one piece of error checking it needs is to check the length of the message - if it's greater than 21 bytes then reset and start looking for MID again.
As it stands - is the end isn't found then it will trample over memory and crash (using the position mod 10 would solve this)
Martin
Re: Protocol j1587
Hi!
Regarding the row of two byte PIDs, for example: engine speed - PID 190, data 087 009 - PID_data[0] /; 087;/ + (PID_data[1] /;009;/<<8) I get a 16-bit value and multiply it by 0.25 (res/bit)
Regarding the row of two byte PIDs, for example: engine speed - PID 190, data 087 009 - PID_data[0] /; 087;/ + (PID_data[1] /;009;/<<8) I get a 16-bit value and multiply it by 0.25 (res/bit)
Re: Protocol j1587
In this only option, it displays on the screen and after a few seconds the values hang on the screen, but at the same time the diode (port B7) on the board blinks synchronously with the diode on the rs485 transceiver
Re: Protocol j1587
- Attachments
-
- viber_image_2024-03-20_23-52-36-675.jpg (128.02 KiB) Viewed 742 times
Re: Protocol j1587
- Attachments
-
- V1.8.1.fcfx
- (27.83 KiB) Downloaded 25 times
-
- Valued Contributor
- Posts: 1019
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 107 times
- Been thanked: 531 times
Re: Protocol j1587
So - the PID - get from PID[0] - if this is >= 128 then the 16 bit value is PID_Data[0] (NOT PID_Data[0] + PID_Data[1]) As mentioned - the value might have the MSB and LSB swapped. If PID[n] <= 127 then PID_Data[n] = 8 bit value (padded to 16 bits with 0 in MSB)Regarding the row of two byte PIDs, for example: engine speed - PID 190, data 087 009 - PID_data[0] /; 087;/ + (PID_data[1] /;009;/<<8) I get a 16-bit value and multiply it by 0.25 (res/bit)
The PID PID[1] has it's value in PID_Data[1]
There should be PID[n] and PID_Data[n] where n = 0..ISR_POS
However - it does sound like it is then crashing - see notes above about error checking - I'll add a couple of checks - max message size is trickier - but where "ISR_Pos = ISR_Pos+1" -> change to ISR_Pos = (ISR_Pos + 1) % 10 (Two places in the ISR) It might just be the reset needs a tweak too?
Can you step through in simulation using some of the data from above.
Re: Protocol j1587
Hi all !
I understand that if the checksum = 0, this means the end of the line formation
I understand that if the checksum = 0, this means the end of the line formation