P2 Pull-up detection
Cluso99
Posts: 18,069
in Propeller 2
I have been looking at the pullup detection in the ROM.
This code below gives the time for the pullup to pull the I/O pin back high is approximately as follows.
Note that I was adjusting the code, and because of the low clock counts, any moving of instructions affects the results. Also, at the lower frequencies the timing differences between outputting a pin and reading a pin has a more pronounced effect.
I would be interested to see what others might find.
And the test code section of interest...
Warning: we cannot use this in the ROM because if there is no pullup then this code will wait forever.
This code below gives the time for the pullup to pull the I/O pin back high is approximately as follows.
Note that I was adjusting the code, and because of the low clock counts, any moving of instructions affects the results. Also, at the lower frequencies the timing differences between outputting a pin and reading a pin has a more pronounced effect.
I would be interested to see what others might find.
clockfreq 5K pu 10K pu 15K pu 20 MHz 195ns 25 MHz 480ns? 30 MHz 396ns? 100 MHz 160ns 270ns 300ns 150 MHz 130ns 210ns 340ns 200 MHz 195ns 300 MHz 180ns
And the test code section of interest...
' try pullup/pulldown testing... drvl #test_pin 'drive pin low waitx ##us*1+2 'wait >1us modcz _set,_set wcz setpat mask,val ' sets flag when (INB & D)==S c=1,z=1 fltl #test_pin 'float pin getct t1 ' time waitpat ' wait for pin high getct t2 ' time
Warning: we cannot use this in the ROM because if there is no pullup then this code will wait forever.
spin
13K