Emtron: Difference between revisions

 
(6 intermediate revisions by the same user not shown)
Line 12: Line 12:
===TPS===
===TPS===
* CAN ID: 1251
* CAN ID: 1251
* Bytes: 1,2
* Bytes: 1,2 (little endian)
* Scaling: 0 = -100.0% ; 2000 = 100.0%
* Scaling: 1000 = 0.0% ; 2000 = 100.0%
* Precision: 0.1


==Lua Script==
==Lua Script==
Line 19: Line 20:
<pre>
<pre>


setTickRate(30) --30Hz
setTickRate(30)


--set up virtual channels
--set up virtual channels
tps_id = addChannel("TPS", 10, 1)
rpm_id = addChannel ("RPM", 25, 0, 0, 10000, "RPM")
coolant_id = addChannel ("Coolant", 1, 1, -30, 200, "Celsius")
afr_id = addChannel ("AFR", 10, 3, 0, 5, "Lambda")
tps_id = addChannel("TPS", 10, 1, 0, 100, "%")
igntiming_id = addChannel("IgnTiming", 10, 1, -30, 50, "Degrees")


--handle TPS message data
function process_rpm(data)
    local rpm = ((data[2] * 256 + data[1]))
    setChannel(rpm_id, rpm)
end
function process_coolant(data)
    local coolant = ((data[6] * 256 + data[5])) * 0.1 - 50
    coolant = (coolant * 9) / 5 + 32
    setChannel(coolant_id, coolant)
end
function process_afr(data)
    local afr = ((data[2] * 256 + data[1])) * 0.001
    setChannel(afr_id, afr)
end
function process_tps(data)
function process_tps(data)
     local tps = data[2] * 256 + data[1]
     local tps = ((data[2] * 256 + data[1])) * 0.1 - 100
    tps = tps / 10
     setChannel(tps_id, tps)
     setChannel(tps_id, tps)
end
function process_igntiming(data)
    local igntiming = ((data[4] * 256 + data[3])) * 0.1 - 100
    setChannel(igntiming_id, igntiming)
end
end


Line 34: Line 54:
     repeat --will drain CAN buffer on each tick
     repeat --will drain CAN buffer on each tick
         id, e, data = rxCAN(0)
         id, e, data = rxCAN(0)
        if id == 1250 then process_rpm(data) end
        if id == 1250 then process_coolant(data) end
         if id == 1251 then process_tps(data) end
         if id == 1251 then process_tps(data) end
        if id == 1254 then process_afr(data) end
        if id == 1256 then process_igntiming(data) end
     until id == nil
     until id == nil
end
end
</pre>
</pre>

Latest revision as of 21:28, 28 February 2015

Emtron ECU

Emtron KV8.jpg

Configuration

This script integrates the Emtron ECU with RaceCapture/Pro telemetry, using the factory standard CAN bus mapping

Baud Rate

The default baud rate for Emtron is 1mbps.

  • You can configure this on the CAN bus configuration page in the RaceCapture App.

Channels

TPS

  • CAN ID: 1251
  • Bytes: 1,2 (little endian)
  • Scaling: 1000 = 0.0% ; 2000 = 100.0%
  • Precision: 0.1

Lua Script


setTickRate(30)

--set up virtual channels
rpm_id = addChannel ("RPM", 25, 0, 0, 10000, "RPM")
coolant_id = addChannel ("Coolant", 1, 1, -30, 200, "Celsius")
afr_id = addChannel ("AFR", 10, 3, 0, 5, "Lambda")
tps_id = addChannel("TPS", 10, 1, 0, 100, "%")
igntiming_id = addChannel("IgnTiming", 10, 1, -30, 50, "Degrees")

function process_rpm(data)
    local rpm = ((data[2] * 256 + data[1]))
    setChannel(rpm_id, rpm)
end
function process_coolant(data)
    local coolant = ((data[6] * 256 + data[5])) * 0.1 - 50
    coolant = (coolant * 9) / 5 + 32
    setChannel(coolant_id, coolant)
end
function process_afr(data)
    local afr = ((data[2] * 256 + data[1])) * 0.001
    setChannel(afr_id, afr)
end
function process_tps(data)
    local tps = ((data[2] * 256 + data[1])) * 0.1 - 100
    setChannel(tps_id, tps)
end
function process_igntiming(data)
    local igntiming = ((data[4] * 256 + data[3])) * 0.1 - 100
    setChannel(igntiming_id, igntiming)
end

function onTick()
    repeat --will drain CAN buffer on each tick
        id, e, data = rxCAN(0)
        if id == 1250 then process_rpm(data) end
        if id == 1250 then process_coolant(data) end
        if id == 1251 then process_tps(data) end
        if id == 1254 then process_afr(data) end
        if id == 1256 then process_igntiming(data) end

    until id == nil
end