RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Setting Frequency on Digital Output
Author Message
Reply with quote
Post Setting Frequency on Digital Output 
How do I set the frequency on a GPIO output channel? I tried setting GPIO1 to Freq1 in the drop down and setting it to output, but there doesn't seem to be a switch for setting it's output frequency in a value through the scripting window. Basically I'm trying to change the frequency of the output based on an if statement. Below is a sample of what I'm trying to do.

setTickRate(10)

function onTick()
local rpm = getTimerRpm(0)
local speed = getGpsSpeed()

if rpm == 0 then
setFreq(0,10)
setAnalogOut(0,5)
else
setFreq(0,150)
setAnalogOut(0,0)
end

end

View user's profile Send private message
Reply with quote
Post  
Hi twhite84,

The GPIO ports are not designed for PWM style signal output. Rather you would want to use one of the four pulse/analog output channels for this task. You can find a diagram of the RCP pin outs by looking at the RCP pin-out diagram (1st link below). Then using the methods described in the LUA PWM / Analog Output functions (2nd link below) you will be able to control the frequency of those pins. Hope that helps.

RCP pin out diagram: https://www.autosportlabs.net/File:RaceCapture-Pro_MK2_quick_reference_sheet.jpg
PWM / Analog Output functions: https://www.autosportlabs.net/RaceCapturePro_Lua_Scripting#PWM_.2F_Analog_Output_functions


_________________
Andrew Stiegmann (Stieg)
Principal Engineer
Autosport Labs Inc.
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum