I've been doing some timings on a 20X2 running at 64MHz
I want to get the fastest, reliable, response to a high input setting an output high.
I've been testing using a switch as an input and timing how quickly the Output will go high in response to a switch press. All timings done using a DPScopeII
So Far I've tried a Do, Loop, While:
And an interrupt during a Pause:
The Do-Loop can respond in 70 microSeconds, but it is variable and can take upto 127 microSeconds. I am assuming that it depends where in the loop the program is when the contacts close that results in the variable response.
With the interrupt the timing is consistently 101 microSeconds. So consistent results but slightly slower.
I've run out of ideas for other ways to try so do the brains of the forum have any ideas of a faster way to set the output high? The Picaxe will not be doing any other tasks while waiting for the input. I know I can probably improve the response with a purely hardware solution but would like to incorporate multifunctions into a single unit.
I am also assuming that none of the other Picaxe will perform any faster, please correct me if I'm wrong.
I want to get the fastest, reliable, response to a high input setting an output high.
I've been testing using a switch as an input and timing how quickly the Output will go high in response to a switch press. All timings done using a DPScopeII
So Far I've tried a Do, Loop, While:
Code:
[color=Blue]let [/color][color=Purple]dirsb [/color][color=DarkCyan]= [/color][color=Navy]%11111111 [/color][color=Green];Set Input or Output on B (All Outputs)[/color]
[color=Blue]let [/color][color=Purple]dirsc [/color][color=DarkCyan]= [/color][color=Navy]%10100001[/color]
[color=Blue]symbol Output1 [/color][color=DarkCyan]= [/color][color=Blue]b.3
symbol [/color][color=Purple]ButtonUp [/color][color=DarkCyan]= [/color][color=Purple]pinc.4[/color]
[color=Blue]symbol Output1On [/color][color=DarkCyan]= [/color][color=Navy]%00001000 [/color][color=Green];Output 1 on[/color]
[color=Blue]symbol AllOff [/color][color=DarkCyan]= [/color][color=Navy]%00000000 [/color][color=Green];All Outputs Off[/color]
[color=Blue]setfreq m64[/color]
[color=Black]main:
[/color][color=Blue]do
loop while [/color][color=Purple]Buttonup [/color][color=DarkCyan]<> [/color][color=Navy]1
[/color][color=Blue]let [/color][color=Purple]pinsb [/color][color=DarkCyan]= [/color][color=Blue]output1on
let [/color][color=Purple]pinsb [/color][color=DarkCyan]= [/color][color=Blue]alloff
goto [/color][color=Black]main[/color]
Code:
[color=Blue]let [/color][color=Purple]dirsb [/color][color=DarkCyan]= [/color][color=Navy]%11111111 [/color][color=Green];Set Input or Output on B (All Outputs)[/color]
[color=Blue]let [/color][color=Purple]dirsc [/color][color=DarkCyan]= [/color][color=Navy]%10100001[/color]
[color=Blue]symbol Output1 [/color][color=DarkCyan]= [/color][color=Blue]b.3
symbol [/color][color=Purple]ButtonUp [/color][color=DarkCyan]= [/color][color=Purple]pinc.4[/color]
[color=Blue]symbol Output1On [/color][color=DarkCyan]= [/color][color=Navy]%00001000 [/color][color=Green];Output 1 on[/color]
[color=Blue]symbol AllOff [/color][color=DarkCyan]= [/color][color=Navy]%00000000 [/color][color=Green];All Outputs Off[/color]
[color=Blue]setfreq m64[/color]
[color=Black]main:
[/color][color=Blue]setint [/color][color=Navy]%00010000[/color][color=Black], [/color][color=Navy]%00010000
[/color][color=Blue]Pause [/color][color=Navy]2000
[/color][color=Blue]goto [/color][color=Black]main[/color]
[color=Blue]interrupt:
let [/color][color=Purple]pinsb [/color][color=DarkCyan]= [/color][color=Blue]output1on
let [/color][color=Purple]pinsb [/color][color=DarkCyan]= [/color][color=Blue]alloff
return[/color]
With the interrupt the timing is consistently 101 microSeconds. So consistent results but slightly slower.
I've run out of ideas for other ways to try so do the brains of the forum have any ideas of a faster way to set the output high? The Picaxe will not be doing any other tasks while waiting for the input. I know I can probably improve the response with a purely hardware solution but would like to incorporate multifunctions into a single unit.
I am also assuming that none of the other Picaxe will perform any faster, please correct me if I'm wrong.