Reading data into RX FIFO #9466
-
|
Hello, ` set(x,30) % set the counter for the loop label("reading` loop") push(no block). % push the data into RX_FIFO sm_read = StateMachine(0, freq=10000, in_base) ` As you can see after I read the data into ISR using "in_" command, I push the data into RX_FIFO. However, I am not clear on how to access the data stored in the RX_FIFO into an array in my main program. I looked up uPy documentation and it suggests using StateMachine.get() command . However, I am unsure where and how this should be implemented? Also, is there a way to clear the RX_FIFO once I have read from it? Thank you very much any help! :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
First: use triple ` before and after code blocks to get multiline code formatting. In With this instruction the ISR gets filled and you push the ISR correctly after 30 such fills to the FIFO. I then read that from python by: In that example there is an additional |
Beta Was this translation helpful? Give feedback.
First: use triple ` before and after code blocks to get multiline code formatting.
In
sm_read = StateMachine(0, freq=10000, in_base)the program is missing, you correct to:sm_read = StateMachine(0, state_function, freq=10000, in_base=pp)where pp is the pin number you would like to read from with yourin_(pins, 1)instruction.With this instruction the ISR gets filled and you push the ISR correctly after 30 such fills to the FIFO.
Your state machine runs your program cyclically for 3 seconds but the FIFO has only 4 words, so from the 5-th iteration onwards the pushed data are lost because the RX_FIFO is full.
The FIFO is cleared automatically by reading it. So you first query the number …