Kinda lost...
BaTWING_2000
Posts: 6
On page 227 of the what is a microcontroller it is asking me to:
"Modify MixingTones.bs2 so that it cycles through the Freq2 arguments
ranging from 2001 to 2005 using a word variable and a loop.
I'm dont exactly get what I'm supposed to do here. Anyone please help thx..
This is MixingTones.bs2:
========================================
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Frequency = 2000", CR
FREQOUT 9, 4000, 2000
DEBUG "Frequency = 3000", CR
FREQOUT 9, 4000, 3000
DEBUG "Frequency = 2000 + 3000", CR
FREQOUT 9, 4000, 2000, 3000
DEBUG "Frequency = 2000 + 2001", CR
FREQOUT 9, 4000, 2000, 2001
DEBUG "Frequency = 2000 + 2002", CR
FREQOUT 9, 4000, 2000, 2002
DEBUG "Frequency = 2000 + 2003", CR
FREQOUT 9, 4000, 2000, 2003
DEBUG "Frequency = 2000 + 2005", CR
FREQOUT 9, 4000, 2000, 2005
DEBUG "Frequency = 2000 + 2010", CR
FREQOUT 9, 4000, 2000, 2010
DEBUG "Done", CR
END
========================================
Post Edited (BaTWING_2000) : 11/29/2009 4:16:49 AM GMT
"Modify MixingTones.bs2 so that it cycles through the Freq2 arguments
ranging from 2001 to 2005 using a word variable and a loop.
I'm dont exactly get what I'm supposed to do here. Anyone please help thx..
This is MixingTones.bs2:
========================================
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Frequency = 2000", CR
FREQOUT 9, 4000, 2000
DEBUG "Frequency = 3000", CR
FREQOUT 9, 4000, 3000
DEBUG "Frequency = 2000 + 3000", CR
FREQOUT 9, 4000, 2000, 3000
DEBUG "Frequency = 2000 + 2001", CR
FREQOUT 9, 4000, 2000, 2001
DEBUG "Frequency = 2000 + 2002", CR
FREQOUT 9, 4000, 2000, 2002
DEBUG "Frequency = 2000 + 2003", CR
FREQOUT 9, 4000, 2000, 2003
DEBUG "Frequency = 2000 + 2005", CR
FREQOUT 9, 4000, 2000, 2005
DEBUG "Frequency = 2000 + 2010", CR
FREQOUT 9, 4000, 2000, 2010
DEBUG "Done", CR
END
========================================
Post Edited (BaTWING_2000) : 11/29/2009 4:16:49 AM GMT
Comments
=================
freq2 VAR word
FOR freq2 = 2000 TO 2005 STEP 1
DEBUG "Frequency = 2000 + ", DEC4 freq2, CR
FREQOUT 9, 4000, 2000, freq2
NEXT
=================
stupid me was focusing on the DO LOOP arguments and didn't think of the FOR NEXT
(even tough it was just covered). Yah I'm a dee dee dee sometimes. Thanks SRLM