The following is a simple thread that captures an input port and time stamps it.
Code: Select all
void inp()
{
unsigned short pinState;
unsigned int timeIn;
timer t;
p3Capture :> pinState;
while(1)
{
p3Capture when pinsneq(pinState) :> pinState @ timeIn;
//p3Capture when pinsneq(pinState) :> pinState;
//t :> timeIn;
if(timeIn > 65535)
{
printhex(pinState); printstr("@");printuintln(timeIn);
}
}
}
Code: Select all
p3Capture when pinsneq(pinState) :> pinState @ timeIn;
with the commented lines
Code: Select all
p3Capture when pinsneq(pinState) :> pinState;
t :> timeIn;
Thanks.