This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Capture Qei position and send to usb

Hi
I want to draw graphs of position of 2-phased QEI versus time. so I want to capture QEI position every time period. time gap between to position pulses is at least 7.2 microseconds.
I think I have to choose one of these methods:

1-send position to USB during time overflow interrupt(TIM_INT)

2-send content of the timer when the situation changes. (I don't know if it is possible to sense the changes as an interrupt?)

I think there are some restrictions due to interrupt latancy. so what is the highest resolution for my system. and which method is better? How can I define interrupt for 2nd method?
can i send data to buffer and send batch buffer to USB? Is it help me Reduce interrupt latancy effects? HOW?
Please Help me
Best Regards

Parents
  • >Since you have an interrupt that produces one value at a time, it would be _your_ code that inserts data into the buffer. So it should be easy for _your_ code to know when you have 512 bytes of data.

    I don't know reason of _your_ emphasis on _your_.
    Any way, when the number of bytes send to the buffer equals to 512, _My_ codes should sets an interrupt. and then it sends the buffer to USB. and then the counter for buffer should reset. I don't care that some counts at this short time lost.

    but I have some problem with it that ask you after further works.

    Amir

Reply
  • >Since you have an interrupt that produces one value at a time, it would be _your_ code that inserts data into the buffer. So it should be easy for _your_ code to know when you have 512 bytes of data.

    I don't know reason of _your_ emphasis on _your_.
    Any way, when the number of bytes send to the buffer equals to 512, _My_ codes should sets an interrupt. and then it sends the buffer to USB. and then the counter for buffer should reset. I don't care that some counts at this short time lost.

    but I have some problem with it that ask you after further works.

    Amir

Children
  • My emphasis _your_ is because people on this forum can't explain code you still haven't written. You must first write it and then post it before anyone can come back with feedback.

    Next thing. You don't collect 512 byte of data. Then ask the USB layer to send your data. Then reset your counter and start to collect more data. You need to continue to collect data while you wait for the USB transfer. That is why you need to have two buffers - or a twice as large buffer - so you can capture more data concurrently with the USB transmission.

  • You helped me a lot Dear Mr Westermark.
    I'll have more & more questions after the test.

    Thanks alot
    Amir