Hi,
You're missing my point - I think.
You have the variable rd aliases to PortA.3 (not PortC.1 as far as I can see) but what is supposed to happen inside the loop when you acces the rd "variable" as if it was an array - which is what you're doing with the rd[i] thing.
i will increment once per iteration. Each iteration thru the loop you do RD[i] = 1 where, as we said, i increments by one each time. What happens when i is, for example 1234, and the effect of the line is PortA.3[1234] = 1?
I don't think the problem has anything to do with the use of GOSUB or REPEAT UNTIL, I think it's just a coincidence and the fact that it works with the code pasted in multiple places just masks the real issue - which I think is the RD[i] = 1 line.
If what you want is to ensure that the RD-line is high before starting the pulsing I'd try
Code:
dat:
i = 0 'pulse RD low 65535 times
RD = 1 '<---No indexing stuff, just set the pin high.
REPEAT
i = i + 1
pulsout rd, 4 '44.1KHz Playback
UNTIL i = 65535
RETURN
/Henrik.
Bookmarks