Hi Darrel.
Thanks for verifying the problem. Now I know that it is not just my program messing with me..
But it's still confusing because when I use my Basic Stamp to simulate a signal, it works fine with 7ms High and 0ms low pulse. (BS code #3 in my first post.) This means that USBOut has enough time to execute even if the low pulse is only a few us. Can it be the vb app that is the bottleneck here?
Pic send it quick but next time it try to send the pc is still busy with the last one. What do you think about that?
If the pic is the bottleneck then I wonder how it can catch the next pulse without any problem? In that case it should be stuck in the DoUSBOut routine.
I will make a test to measure 16 pulses, save all values in buffer(0) to buffer(31) and then send all 32byte to the pc. Sending 32 bytes takes 22.4us according to my tests so that should be just fine from the pic point of view. It will be interesting to se how the pc handle it.
Unfortunatley I need to measure all pulses. I use the values in the vb app to calculate acceleration, rpm and total revs.
My next task is to simultaneously check the USBIn for new data.
This without halting the program. I have made some test with the code example from bruce at post:
http://www.picbasic.co.uk/forum/show...05&postcount=3
This seems to work but I have not test it at higher speed yet.
Do you have any other good solutions to do this? Maybe using USB interrupt USBIF or something else?
I'll let you know about my further test.
Thanks again.
Stefan.




Bookmarks