Author Topic: raw data log problem  (Read 5722 times)

Offline z0tya

  • Sr. Member
  • ****
  • Posts: 252
  • BHP: 11
raw data log problem
« on: October 27, 2010, 02:05:35 pm »
Hello!

Has anybody idea about calculation in the vems data log stream. I have made a microcontroller based serial logger, and I couldn't handle the pulsewidth bytes...
I found this from megatune's vems3 ini:
[OutputChannels]
   ; The number of bytes MegaTune should expect as a result
   ; of sending the "A" command to MegaSquirt is determined
   ; by the value of ochBlockSize, so be very careful when
   ; you change it.
   deadValue      = { 0 } ; Convenient unchanging value.

   ochBlockSize   = 62
   ochGetCommand   = "D"

   secl         = scalar, U08,  0, "sec",   1.000, 0.000
   squirt         = scalar, U08,  1, "bits",   1.000, 0.000
   engine         = scalar, U08,  2, "bits",   1.000, 0.000
   barometer      = scalar, U08,  3, "ADC",   1.000, 0.000
   mapADC         = scalar, U16,  4, "Pa",   1.000, 0.000
   matADC         = scalar, U08,  6, "ADC",   1.000, 0.000
   cltADC         = scalar, U08,  7, "ADC",   1.000, 0.000
   tpsADC         = scalar, U08,  8, "ADC",   1.000, 0.000
   batADC         = scalar, U08,  9, "ADC",   1.000, 0.000
   egoADC         = scalar, U08, 10, "ADC",   1.000, 0.000
   egoCorrection   = scalar, U08, 11, "%",      1.000, 0.000
   airCorrection   = scalar, U08, 12, "%",      1.000, 0.000
   warmupEnrich   = scalar, U08, 13, "%",      1.000, 0.000
   rpmVHR         = scalar, U16  14, "rpm",   1.000, 0.000
   pulseWidth      = scalar, U16, 16, "ms",   0.004, 0.000
   baroCorrection   = scalar, U08, 18, "%",      1.000, 0.000
   gammaEnrich      = scalar, U08, 19, "%",      1.000, 0.000
   veCurr         = scalar, U08, 20, "%",      1.000, 0.000
   INTdwell      = scalar, U08, 21, "mS",   1.000, 0.000
   INTspark      = scalar, U08, 22, "",      1.000, 0.000
   iacPos         = scalar, U08, 23, "%",      1.000, 0.000
   egt1ADC         = scalar, U16, 24, "Deg",   1.000, 0.000
   egt2ADC         = scalar, U16, 26, "Deg",   1.000, 0.000
   ebpADC         = scalar, U16, 28, "Deg",   1.000, 0.000
   fpADC         = scalar, U16, 30, "Deg",   1.000, 0.000
   misc1ADC      = scalar, U16, 32, "Deg",   1.000, 0.000
   misc2ADC      = scalar, U16, 34, "Deg",   1.000, 0.000
   misc3ADC      = scalar, U16, 36, "Deg",   1.000, 0.000
   misc4ADC      = scalar, U16, 38, "Deg",   1.000, 0.000
   latgtADC      = scalar, U08, 40, "",      1.000, 0.000
   knock_cyl_0_knock_val=scalar, U16, 41, "",   1.000, 0.000
   knock_cyl_0_noise_val=scalar, U16, 43, "",   1.000, 0.000
   knock_cyl_0_adjust=scalar, U08, 45, "Deg",   0.250, 0.000
   knock_cyl_0_state = scalar, U08, 46, "",      1.000, 0.000
   status1       = scalar, U08, 47, "",      1.000, 0.000

so it use command D and pulsewidth is the 16th and 17th byte 16bit value, but from vemstune's ini (1.1.27):

[OutputChannels]
   ochGetCommand   = "A"
#include "include/rtdata-raw-common.ini"
   pulseWidth      = scalar, U16, 16, "ms",   0.004, 0.000

so it use command A and pulsewidth is similar.

My controller use command D for 1.1.27 and everything calculated correctly, but pw.
When I get this stream:
#3 8 8 0 1 98 60 68 0 6B 0 64 66 79 0 0 18 7B 64 65 39 3A 8A A5 0 4E 0 0 0 0 0 0 0 0 0 0 0 0 0 0 B1 0 0 0 0 0 0 0 18 0 80 87 0 0 0 0 0 0 0 0 0 0 0
I calculate 187b hex -> 6267 dec but on the lcd display I see around 27 msec (crank pw)

When I get this stream:
#7E 89 89 0 0 DF 64 7A 0 65 82 64 65 6E 4 AE 2 11 64 70 44 3C A2 55 2 AD 0 0 F F3 F 7F 3 19 0 0 0 0 0 0 B1 0 22 0 24 0 0 8 18 0 80 86 0 FD 78 B1 C3 0 0 0 0 0 0

I calculate 211 hex -> 529 dec but on the lcd display I see around 2 msec (idle pw at 1198 rpm =4ae hex)

What is wrong?




Offline rob@vems.co.uk

  • Hero Member
  • *****
  • Posts: 3115
  • BHP: 49
    • VEMS Forum
Re: raw data log problem
« Reply #1 on: October 27, 2010, 03:09:24 pm »
You've missed one additional part
pulseWidth      = scalar, U16, 16, "ms",   0.004, 0.000
the value in bold is a multiplier so now you have 0x0211 => 529 * 0.004 = 2.116ms

Offline z0tya

  • Sr. Member
  • ****
  • Posts: 252
  • BHP: 11
Re: raw data log problem
« Reply #2 on: October 28, 2010, 07:50:13 am »
oh! Thanks very much!!!

Offline z0tya

  • Sr. Member
  • ****
  • Posts: 252
  • BHP: 11
Re: raw data log problem
« Reply #3 on: February 18, 2011, 02:19:44 pm »
one more question similar:

warmupEnrich= scalar, U08, 13, "%",2.000, 45.000

means scale by 2 and add 45?