cAsE sEnSiTiVe ?
hitsware
Posts: 156
serout 0,6,[noparse][[/noparse]"!PWMSS",240] ' initialize outputs
y var nib:x var nib:fr var byte:m1 var byte:m2 var byte
play:for x=0 to 3:for y=0 to 3
lookup x,[noparse][[/noparse]8,6,9,6],m1:lookup y,[noparse][[/noparse]2,4,3,4],m2
serout 0,6,[noparse][[/noparse]"!PWMM1",2400/(m1*m2),0,2400/(m1*m2),0] ' play note
pause 300[noparse]:next:[/noparse]next:goto play
' listening off of pin 12 on a BS2 stacked with a PWMPAL
' if I reduce the !PWMSS to !pwmss it runs but without sound ?
y var nib:x var nib:fr var byte:m1 var byte:m2 var byte
play:for x=0 to 3:for y=0 to 3
lookup x,[noparse][[/noparse]8,6,9,6],m1:lookup y,[noparse][[/noparse]2,4,3,4],m2
serout 0,6,[noparse][[/noparse]"!PWMM1",2400/(m1*m2),0,2400/(m1*m2),0] ' play note
pause 300[noparse]:next:[/noparse]next:goto play
' listening off of pin 12 on a BS2 stacked with a PWMPAL
' if I reduce the !PWMSS to !pwmss it runs but without sound ?
Comments
I'm sure the PWMPAL is ignoring commands that don't start with "!PWM" all in upper case.
>all the command descriptions and examples are upper case.
Just like in the 'PBASIC' manual .....
BUT !
Most all of the commands (seems to me) are 'case insensitive'
(I debugged the code above 1 command @ a time and the caps on the pwmss was what threw it)
For some reason this seems an exception ?
You are right about that part. PBasic is not case sensitive, but the content of strings is kept exactly as written.
But differant as "data" ?
Like in ASC or something ?
The following are different:
The "CODE" -- the PBasic code you use, like "SEROUT" -- is compiled and interpreted by the PBasic IDE. The PBasic IDE is not case sensitive.
The "DATA" -- the stuff you send to the pwmpal by using the SEROUT statement -- well, it depends on the pwmpal software what it makes of that. And apparently the pwmpal software IS case sensitive.
So, when you're trying to determine if case matters, you have to look at the platform -- the PBasic IDE, or the pwmpal -- that's trying to make sense of it.
BTW.... Do you know what chip is used on the PWMPAL ?
Seems like (if one wanted) you could hook it directly to the pc serial port and run it without the stamp. Say from QBasic ? Not that I would (just out of curiousity (hopefully without killing the cat)) ...... [noparse]:)[/noparse]
Then the way (that say) the SOUND command works on the BS1
(program halts during 'duration')
Is software rather than hardware dependent?
I.E. could the same chip be used both on a Stamp and a PWMPAL?
other than a timer. The PWMPAL is the same way. All of the serial I/O and the PWM stuff is done in software.
I haven't looked at the PWMPAL lately, but it probably uses a PIC since that's what Parallax was using when
the PWMPAL was first developed (as far as I remember). The BS1 and BS2 use a PIC and all of the subsequent
models use the SX.
The PWMPAL uses the SX20 to generate the PWM output via software. All the functions, including the serial communication are done via software. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
This (in a way) transcends that.
Only 1 oscillator.
Not neccesarily a squarewave.
BUT !
Free of the annoying 'refresh pops' of FREQOUT
AND !
Way higher frequency than "10 Hz"
BUT !
Like you say:
Hard to calculate frequency.