Maths question, combing two 16 bit data streams into a 32 bit stream?

Permabanned
Joined
28 Nov 2003
Posts
10,695
Location
Shropshire
My ecu outputs seven decimal place GPS coordinates as two 16 bit channels and the data reading software then combines them using maths to give a degree based GPS coordinate to generate a track map.

Below are two samples, one raw data from the ecu as two 16 bit channels, the other the GPS coordinate in degrees after the software has done the maths wizardry. Can anyone work out what it's doing to the raw date to combine them to make the correct coordinate please? I can't....

ECU output: GPS Latitude HW : 8015
GPS Latitude LW : -13983

Maths gives : Coordinate 52.8870988 degrees latitude

########################

ECU output : GPS Longitude HW : -364
GPS Longitude LW : 14387

Maths gives : Coordinate -2.6401195 degrees longitude

########################

All I can say is the hardware won't allow transmission of 32 bit data on the serial port, so they somehow split it up into two sets of 16 bit, then rejoin it in the software using maths. The end result is degrees, minutes and seconds to seven decimal places. I am collecting the data from the CAN BUS of the Motec ecu, and logging it in a none Motec data logger. The data logger's software has powerful maths functions, so once I can see how Motec split and rejoin the data streams I should be able to duplicate it in the other software. They also split the GPS time data stream into two 16 bit channels, this may be easier, example below, (the time format does not take into account British Summer Time offset, by the way).

GPS Time HW : 1614
GPS Time LW : -8040

GPS Time (combined) : 105832.600


Actual time was 10.58 AM and 32.600 seconds.

Thanks. I think HW is "high word", and LW is "low word", and combing the two 16 bit streams correctly is the key.
 
Really appreciate the trouble you guys have gone to for this, thanks. I too don't see why the match isn't exact though. The GPS receiver / antenna was stationary. It's all quite complex though, as I am logging data from the Motec ecu internally within it, and using its dedicated software with pre compiled maths to show the raw and modified data. I am also logging data from the Motec ecu via CAN on a logger of a different make, and the raw coordinates, whilst very similar, are not the same. For example

LON HW -364
LON LW 14664

LAT HW 8015
LAT LW -13996

Which, considering they are both supposedly reading the same data streams is even odder :) I have e-mailed Motec's support for help, but you know how touchy big companies get about sharing data ;)

How would I write the maths as a script? It's at times like this my lack of attention at maths shows it for the regretful lack of dedication my maths teacher described it to be at the time :(

Again, thanks!!
 
Actually, pretty close is a relative term, the difference between the Motec maths and that that's been posted is one is in Shropshire, the other is in the North Sea :) The GPS receiver makers claim an accuracy if three metres, so I think the maths is differing somehow. It's a PITA, if I could afford Motec's own logger this would all be done automagically, but I can't, so it gets a bit involved :)
 
Back
Top Bottom