Protocol j1587
-
- Valued Contributor
- Posts: 958
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 509 times
Re: Protocol j1587
You can set a character in a string to 128.as above. Each character is a byte. You can set values using a number as shown or a character (in single quotes) or set the whole string.
-
- Valued Contributor
- Posts: 958
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 509 times
Re: Protocol j1587
Just done a quick test
I did PutArray(.test, 10)
LookForValue(.seek, 1, true, true)
Where test = {x,x,x,128,129...) where x is any value
and seek[0] = 128
LookForValue just returns 1 if the search value is found. (would the index (or -1) be better?) Then GetByte returns the 'following' data
So in this case - the GetByte returns 129
If you are using an interrupt to load the data - you could use WaitForValue as an alternative..
I did PutArray(.test, 10)
LookForValue(.seek, 1, true, true)
Where test = {x,x,x,128,129...) where x is any value
and seek[0] = 128
LookForValue just returns 1 if the search value is found. (would the index (or -1) be better?) Then GetByte returns the 'following' data
So in this case - the GetByte returns 129
If you are using an interrupt to load the data - you could use WaitForValue as an alternative..
Re: Protocol j1587
Hi,
When you say it works on the bench are you using live data from the tractor or some simulator? If it is live data then are you using a bench PSU and when on the tractor using the tractor supply. Does it work OK with the engine not running and then give problems when it is running?
Regards,
Bob
When you say it works on the bench are you using live data from the tractor or some simulator? If it is live data then are you using a bench PSU and when on the tractor using the tractor supply. Does it work OK with the engine not running and then give problems when it is running?
Regards,
Bob
Re: Protocol j1587
Thank you very much "minfisher" for the example, it helped me understand searching for data in the buffer.
Now there is a new problem: the bytes are repeated on the screen, although I display them in turn from "Mid_array[0] to Mid_attay[3]. What could be the problem?
Regards Joni!
Now there is a new problem: the bytes are repeated on the screen, although I display them in turn from "Mid_array[0] to Mid_attay[3]. What could be the problem?
Regards Joni!
- Attachments
-
- V1.6.fcfx
- (21 KiB) Downloaded 8 times
-
- IMG_20240313_165401530_HDR.jpg (74.63 KiB) Viewed 371 times
Last edited by bios33 on Wed Mar 13, 2024 3:08 pm, edited 1 time in total.
Re: Protocol j1587
Greetings! Everything is fine with the food, there are no problems, that’s for sure. The problem is that the device does not work correctly when other control units are on the bus. For example: in a certain line checksum =102 and at the same time there is PID 102 - turbo pressure and mixing the turbine readings skips unnecessary data, and so on with almost all indicators. Something like thisRGV250 wrote: ↑Wed Mar 13, 2024 12:28 pmHi,
When you say it works on the bench are you using live data from the tractor or some simulator? If it is live data then are you using a bench PSU and when on the tractor using the tractor supply. Does it work OK with the engine not running and then give problems when it is running?
Regards,
Bob
-
- Valued Contributor
- Posts: 958
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 509 times
Re: Protocol j1587
I think the issue is - your code continually searches for 128 - and as soon as it is found - attempts to read 4 bytes from 'after' the 128.
These may not have been received yet...
So - one solution is wait for 128 to be found then wait until caunt_rx >= 4 and then display the values.
Martin
These may not have been received yet...
So - one solution is wait for 128 to be found then wait until caunt_rx >= 4 and then display the values.
Martin
Re: Protocol j1587
Hi all!
I tried V1.7 but the repetition is still there, I changed the delay but alas to no avail, everything is perfect in the simulator.
I’ll transfer it to the mega2560 in a minute and try, maybe there’s a problem with the controller.
I tried V1.7 but the repetition is still there, I changed the delay but alas to no avail, everything is perfect in the simulator.
I’ll transfer it to the mega2560 in a minute and try, maybe there’s a problem with the controller.
-
- Valued Contributor
- Posts: 958
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 104 times
- Been thanked: 509 times
Re: Protocol j1587
Odd, how about waiting until the value changes from 128 - it sounds as though only the start byte is being received correctly. Can you just display (or send to uart) all the data received?
Re: Protocol j1587
Here are the screenshots
The controller receives the same data as the FC
The controller receives the same data as the FC
- Attachments
-
- Out STM to LCD.png (53.07 KiB) Viewed 380 times
-
- J1587 in to FC.png (96.52 KiB) Viewed 380 times