Page 5 of 9

Re: Protocol j1587

Posted: Tue Jan 30, 2024 4:39 pm
by chipfryer27
Hi

And you have spelling issues too :lol:

Good you are getting values.

To convert two 8-bit values to a 16-bit value is quite easy.

Create a new unsigned integer e.g. Speed. This can have a value of 0 - 65,535

You have two bytes of data, lets call them B1 and B2. Say they are (in binary coz it's easier to understand the process) 0b11010101 and 0b00000001

Speed = 0 // this is in binary 0b0000000000000000
Speed = B1<<8 // Speed = the value of B1 shifted 8 places to the left. Speed now equals 0b1101010100000000
Speed = Speed + B2 // Add the value of B2 giving Speed = 0b1101010100000001

You can of course combine the above into a more simplistic calculation but the above shows the process.

Regards

PS
Really nice looking display.

Re: Protocol j1587

Posted: Thu Feb 01, 2024 9:26 am
by bios33
Hi all!
Finally it worked and very quickly :)!
Repeated reading of your posts helped me a lot, I am very grateful to everyone for pointing me in the right direction.
It remains to figure out how to calculate “resolution/bit” for the accuracy of the values ​​​​on the screen

Thanks again everyone!

Joni.

Re: Protocol j1587

Posted: Mon Mar 11, 2024 7:02 am
by bios33
Hi all!
I returned to this project again because it is working very poorly. Everything was fine on the table, but when I connected it to the tractor, and there were other blocks on the j1587 bus, everything became very sad :).
I've been playing for the second week now and there is no result. Who can help me with this project? or advise who to contact with this question.
I'm not asking for help for free, I'm ready to pay. Maybe someone knows who to contact to create component 1587 for FC.

Best regards Joni!

Re: Protocol j1587

Posted: Mon Mar 11, 2024 7:16 am
by chipfryer27
Hi

If it is working on the "bench" then you are most of the way there, so to speak.

I'm guessing a tractor is a very noisy environment in terms of DC/signals, so perhaps look at screening and filtering? I assume you are just reading the bus, not injecting, so we can rule out collisions based on your device.

A scope could be your friend here as it can show the signals in real time.

Do things improve if you unplug certain devices from the bus?

Hope this helps.

Regards

Re: Protocol j1587

Posted: Mon Mar 11, 2024 7:35 am
by bios33
With mid128 one on one and with the engine turned off, it somehow works, but when the engine starts, everything changes for the worse, the tachometer needle begins to jump, and so do the indicators. I looked at it with an oscilloscope, the bus is perfectly clean, the logic analyzer clearly sees the packets with all the blocks connected. I have 3 devices on the bus: Mid128 - motor, Mid144-central module and Mid216 - light controller

Re: Protocol j1587

Posted: Mon Mar 11, 2024 5:10 pm
by chipfryer27
Hi

I would try next to isolate supplies. For example power your circuit / display etc from a source independent to the tractor to see if things improve.

You mention you can see the data clearly, does this data match up with what your display is doing? Is the data as expected, for example tacho data says 0, but display says 50 or the like?

Regards

Re: Protocol j1587

Posted: Wed Mar 13, 2024 12:24 am
by bios33
Hi!
The situation is this: I connected an instrument panel from Volvo (+24, gnd and j1587) to the place of my device, and it shows all the parameters normally.
that is, the problem is only in my device. I believe that it is necessary to calculate the checksum of each frame, but when I use this function, the device starts to work very slowly.
Tomorrow I'll post the project, maybe you can tell me something

Re: Protocol j1587

Posted: Wed Mar 13, 2024 7:39 am
by bios33
Hi.
Can anyone tell me how to find the required 3 bytes in a circular buffer? Only the value of the first one is known, for example: 128,123,12 - only 128 is known? LookForValue cannot find a numeric value, only looks for ASC||

Re: Protocol j1587

Posted: Wed Mar 13, 2024 7:48 am
by mnfisher
You can use LookForValue with a byte array or a string.

byte or string .val[1] // Looking for 1 value
.val[0] = 128

Then use LookForValue(.val, 1, ...)

Martin

Re: Protocol j1587

Posted: Wed Mar 13, 2024 8:30 am
by bios33
mnfisher wrote:
Wed Mar 13, 2024 7:48 am
You can use LookForValue with a byte array or a string.

byte or string .val[1] // Looking for 1 value
.val[0] = 128

Then use LookForValue(.val, 1, ...)

Martin
LookForValue does not allow me to use an array, only a string variable. Maybe I'm doing something wrong? Can you please provide at least some example of searching for bytes in a buffer using an array?