lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Yes, required more simple. You dont remenber is need temporaly memory for return
My restrition, is "build automatic variables" , the function utilization to read undetermined number bits.

In line 15, change future for call function receive real value bit.
Substitute this line imaginary receive,  true and false.
         +---------------+                             +-------+
         |   true/bit     |____ false/bit_____|           |______
--------
         \ <------t1--->/\<--------t2------->/

if (bit == true) then
return   "positive" ,  t1,  t1+ t2 <---- t2 before
else
return   "negative" ,  t2,  t2+ t1 <---- t1 before
end

Mike Panetta <panetta.mike@gmail.com> escreveu:
Well... I am not sure what your trying to do, but that function will never work, its full of undeclared variables and even an if statement that will never get executed because the condition never becomes true.

What exactly are you trying to do?  Figure out the duration of a pulse given 2 time stamps? If thats the case, why is your function so complicated?  Why are you manipulatig all the tables you have and where do they come from?  Why do you not just write a function that takes 2 numbers in and returns a difference, and the sign of the difference? thats as simple as saying "return ((t1 - t2) >= 0), abs(t1 - t2)"  which would return true if the difference is positive, (false otherwise) and the absolute value of the difference (assuming you have defined abs somewhere).



Mike

On 11/8/06, Dan - Lintouch user <automacaovida-d2@yahoo.com.br> wrote:
Make to builder one function for measure times duration, period for each signal identific positive and negative.

Objetive function "create" variables for each signal and return values about times and signal positive/negative.

My function sequence, memory before/after time to read bit, and return the values times.
Present, have error about nil function and the variables, dont know automatic create variables.

Have this moment it function:            http://pastey.net/2261


Portuguese: Objetivo montar uma função que recebe um valor binario, meça o periodo, duração , respectivos intervalos d etempo para cada nível lógico do sinal, retornando estes valores.
Atualmente, não funciona devido , não saber como criar as variaveís automaticamente.
 

Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas!



Você quer respostas para suas perguntas? Ou você sabe muito e quer compartilhar seu conhecimento? Experimente o Yahoo! Respostas!