Coming soon:

  • Tables Library
  • AggreGate Library
  • SNTP Library

Subscribe

You can subscribe to the Tibblog:

May 20 ’11

Testing fd. transactions — part 2

Here at Tibbo we use our own devices to test other devices. Here is a good example of how you can use the DS1005 in the lab.

Remember how we tested the robustness of disk transactions by power-cycling the EM1206EV that runs an app that constantly adds data to a file?

We used the DS1005 for this. It has relays, and we wired one of them into the power line of the EM1206EV! Here is the (very simple) code. 

'--------------------------------------------------------------------
dim tout_counter as byte

'====================================================================
sub on_sys_init()

    io.num=PL_IO_NUM_32
    io.enabled=YES
    'sys.onsystimerperiod=100
    tout_counter=DELAY_CONST
end sub

'--------------------------------------------------------------------
sub on_sys_timer()
    tout_counter=tout_counter-1
    if tout_counter=0 then
        io.num=PL_IO_NUM_32
        if io.state=LOW then
            tout_counter=DELAY_CONST
            io.state=HIGH    'turn relay off
        else
            tout_counter=DELAY_CONST+1+asc(random(1))/10
            io.state=LOW    'turn relay ON
        end if
    end if
end sub