xar
03-01-04, 12:55 PM
Hi,
is there a way to know how many entries are in the stack?
I started to design a routine that waits for a SPI device response, and I wanted to return the value if it could be grabbed within a timeout. If there is no answer, it should not add anything to the stack.
Now I need a way to test if there is something in the stack, and I came with this:
255
SDANSWER
255 = IF
." Timeout!" CR
THEN
255 can't be returned by SDASWER, so it is clearly a timeout, since it didn't return anything.
Now I have to empty the stack anyway after use, so the problem is the same.
How do I check how many elements are into the stack?
TIA,
Giuseppe Marullo
is there a way to know how many entries are in the stack?
I started to design a routine that waits for a SPI device response, and I wanted to return the value if it could be grabbed within a timeout. If there is no answer, it should not add anything to the stack.
Now I need a way to test if there is something in the stack, and I came with this:
255
SDANSWER
255 = IF
." Timeout!" CR
THEN
255 can't be returned by SDASWER, so it is clearly a timeout, since it didn't return anything.
Now I have to empty the stack anyway after use, so the problem is the same.
How do I check how many elements are into the stack?
TIA,
Giuseppe Marullo