Setting a timeout for WAITATN - can't get it to work
bob_g4bby            
            
                Posts: 466            
            In assembler, using WAITATN by itself works fine - but I don't like using it because it will wait forever if ATN isn't set.
This code doesn't work for me, though, for WAITATN with a timeout
getct xx ' read the bottom half of the 64 bit system counter add a,xx ' add in the required timeout in ticks setq a ' timeout set for when the system counter = a waitatn wc ' wait for atn flag then clear it and reset carry, else set carry if no ATN happens
The loop this is part of no longer loops when I set ATN for the cog it's running in. What am I doing wrong? (If this code appears a bit weird, it's because it's the assembler in Taqoz)
Has anyone got WAITATN with a timeout to work, please? If so, please show me your equivalent code fragment
Thanks, Bob

                            
Comments
Maybe you are corrupting 'a'. How about this, instead:
Chip, thanks for the suggestion, that wasn't it. I got it to go perfectly, and my WAITATN word in TAQOZ looks like this:-
--- The cog waits for the ATN flag for up to 'clocks' ticks. --- If ATN occurs before timeout, 'flag' = 1, else if timedout, 'flag' = 0 code WAITATN ( clocks -- flag ) getct xx ' read the bottom half of the 64 bit system counter add a,xx setq a ' timeout set for when the system counter = a waitatn wc ' wait for atn flag if_nc mov a,#1 ' ATN flag detected if_c mov a,#0 ' we timed out ret endI'll post a complete demo on one of the TAQOZ threads
Bob, there is an instruction which gets C or !C into a register. You can replace the last three lines with:
Thanks Chip, the instruction set is unfamiliar just yet. That fft you did a while back was compact. I hope to adapt it to process an IQ signal stream for software radio, with other dsp blocks in assembly, glued together with Taqoz. I have a feeling that WAITATN will come in very handy, syncing the cogs that do the signal processing. There's plenty of scope for parallelism.