> "Christopher Tremblay" <[EMAIL PROTECTED]> wrote in
> message news:45199@palm-dev-forum...
> >
> > I'm trying to play sound using the dragonball's PWM and for some
> reason, the
> > PWMCounter never changes.  This is the code I use to play a frequency.
> >
> > unsigned short *PWMReg = (unsigned short *)0xFFFFF500;
> > unsigned short *Period = (unsigned short *)0xFFFFF502;
> > unsigned short *Width = (unsigned short *)0xFFFFF504;
> > unsigned short *PWMTimer= (unsigned short *)0xFFFFF506;
> >
> > *Period = 100;
> > *Width = 50;
> > *PWMReg = 0x0413;
> >
> > while ((*PWMReg & 0x08000) == 0); // This
> > section never quits because the PWMtimer never increments
> 
> On what device are you testing?  These control addresses don't match the
> location of the various PWM registers on the Dragonball EZ or VZ.
> 
> Buffer empty testing on the VZ or EZ still involves reading from
> 0xFFFFF500, but the bit to check is 0x0080.
> 
> I'd also not expect any of this to work in the emulator.
> --
> Ben Combee, [EMAIL PROTECTED]
> Techwood Broadcasting Foundation, Austin Bureau


I've tried this on PalmV and PalmIIIc which I believe to be Dragonball EZ.
I've modified the code so that it fits the right processor now, but I seem
to be getting some white noise out of it.  I've mostly copy/pasted the
example Motorola gave in the specs without using the interrupt (for now).

#define PWM_ENABLE      0x10
#define PWM32KHZ                0x00
#define PWM16KHZ                0x01
#define PWM8KHZ         0x02
#define PWM4KHz         0x03

volatile unsigned char  *PWMControl     = (unsigned char  *)0xFFFFF501;
volatile unsigned short *PWMSample      = (unsigned short *)0xFFFFF502;

void InitAudio(unsigned char *Data, unsigned long TotSamples)
{
        *PWMControl = PWM_ENABLE  | PWM16KHZ

        while (TotSamples) {
                if (*PWMControl & 0x80 != 0) {
                        *PWMSample = *Data++;
                        TotSamples--;
                }
        }
}

Also, nothing comes out of the speaker if I use anything else but PWM16KHZ
which doens't seem to make much sence.  PS : I'm not using the emulator to
run this.

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/
  • sound Christopher Tremblay
    • sound Meg Walraed-Sullivan

Reply via email to