Forums

configure PWMA as output

Started by Olamide... November 12, 2003

I want to use PWMA as just ouput, i.e. like a regular GPIO. How do i
do this???

I'll appreciate it if anyone can tell me how to configure all the
registers. I believe i am configuring them right to my knowledge but
nothing is happening. (my code below)

void InitPWM(void) //this is in init file
{
PWMA_PMCTL = 0;
PWMA_PMFCTL = 0;
PWMA_PMFSA = 0;
PWMA_PMOUT = 0xbf3f;
PWMA_PWMCM = 0x7fff;
PWMA_PWMVAL0 = 0x0000;
PWMA_PWMVAL1 = 0x0000;
PWMA_PWMVAL2 = 0x0000;
PWMA_PWMVAL3 = 0x0000;
PWMA_PWMVAL4 = 0x0000;
PWMA_PWMVAL5 = 0x0000;
PWMA_PMDISMAP1 = 0;
PWMA_PMDISMAP2 = 0;
PWMA_PMDCFG =0x007e;
PWMA_PMCCR = 0;
MSG_PWM_DONE;
} while(1) //this is in main
{
PWMA_PWMVAL0 = 0xffff;
delaySome(); delaySome();

PWMA_PWMVAL0 = 0x0000;
delaySome(); delaySome();
}

To my knowledge, setting PWMA_PWMVAL0 to 0xffff should make it high
(i.e. PWM of 100% duty cycle) because this number is greater than what
i set value in PWMA_PWMCM to which is 0x7fff.

Also setting PWMA_PWMVAL0 to 0xffff, should turn it off. EXCEPT OF
COURSE I SET UP OTHER REGISTER WRONG. PLZ I NEED HELP ASAP... Thank
u very much... mide...




RE: [motoroladsp] configure PWMA as output

I believe what you want to do is to control the pins via software control.  Thus you directly change the state of the OUTx bits in PMOUT register to change the state of the output pin.  The value registers are only used when generating PWM outputs using the PWWEN and edge/center aligned and independent or complementary modes of operation via the PWMCTL register.

Jerry.

> -----Original Message-----
> From: Olamide... [mailto:o...@yahoo.com]
> Sent: Wednesday, November 12, 2003 1:05 AM
> To: m...@yahoogroups.com
> Subject: [motoroladsp] configure PWMA as output
>
>
>
> I want to use PWMA as just ouput, i.e. like a regular GPIO.  How do i
> do this???
>
> I'll appreciate it if anyone can tell me how to configure all the
> registers.  I believe i am configuring them right to my knowledge but
> nothing is happening.  (my code below)
>
> void InitPWM(void) //this is in init file
> {
>       PWMA_PMCTL = 0;
>       PWMA_PMFCTL = 0;
>       PWMA_PMFSA = 0;
>       PWMA_PMOUT = 0xbf3f;
>       PWMA_PWMCM = 0x7fff;
>       PWMA_PWMVAL0 = 0x0000;
>       PWMA_PWMVAL1 = 0x0000;
>       PWMA_PWMVAL2 = 0x0000;
>       PWMA_PWMVAL3 = 0x0000;
>       PWMA_PWMVAL4 = 0x0000;
>       PWMA_PWMVAL5 = 0x0000;
>       PWMA_PMDISMAP1 = 0;
>       PWMA_PMDISMAP2 = 0;
>       PWMA_PMDCFG =0x007e;
>       PWMA_PMCCR = 0;
>       MSG_PWM_DONE;
> }
>
>
> while(1) //this is in main
> {
>       PWMA_PWMVAL0 = 0xffff;
>       delaySome(); delaySome();
>
>       PWMA_PWMVAL0 = 0x0000;
>       delaySome(); delaySome();
> }
>
> To my knowledge, setting PWMA_PWMVAL0 to 0xffff should make it high
> (i.e. PWM of 100% duty cycle) because this number is greater than what
> i set value in PWMA_PWMCM to which is 0x7fff.
>
> Also setting PWMA_PWMVAL0 to 0xffff, should turn it off.  EXCEPT OF
> COURSE I SET UP OTHER REGISTER WRONG.  PLZ I NEED HELP ASAP...  Thank
> u very much...
>
>
> mide...
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
> Printer at MyInks.com. Free s/h on orders $50 or more to the
> US & Canada.
> http://www.c1tracking.com/l.asp?cidU11
> http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/PNArlB/TM
> --------------------------
> -------~->
>
> _____________________________________
> Note: If you do a simple "reply" with your email client, only
> the author of this message will receive your answer.  You
> need to do a "reply all" if you want your answer to be
> distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:  m...@yahoogroups.com
>
> To Post:  m...@yahoogroups.com
>
> To Leave: m...@yahoogroups.com
>
> Archives: http://www.yahoogroups.com/group/motoroladsp
>
> More Groups: http://www.dsprelated.com/groups.php3

>
> " TARGET="_blank">http://docs.yahoo.com/info/terms/
>
>
>
> ______________________________________________________________
> __________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service. For more information visit http://www.messagelabs.com
> ______________________________________________________________
> __________
>


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information visit http://www.messagelabs.com
________________________________________________________________________
Message

I used processor experts low level commands (PESL) to generate your code snippet. This Code calls a processor expert init routine. You have your own init routine. It then disables the COP timer (for my debugging purposes), It then initializes the PWMA for use as software controlled outputs. It then puts various outputs out. I tested it on an 805 and it works.

PE_low_level_init();

P:00000107: E9C800ED jsr 0x0000ed

/*** End of Processor Expert internal initialization. ***/

PESL( COP, COP_DEVICE, COP_DISABLE );

P:00000109: 80F40F300002 bfclr #0x2,X:0x0f30

asm {nop}

P:0000010C: E040 nop

asm {nop}

P:0000010D: E040 nop

asm {nop}

P:0000010E: E040 nop

asm {nop}

P:0000010F: E040 nop

// PESL( PWMA, PWM_READ_CONTROL_REG, ... );

PESL( PWMA, PWM_SET_INDEPENDENT_OPERATION, PWM_ZERO_MASK );

P:00000110: 80F40E0F000E bfclr #0xe,X:0x0e0f

P:00000113: F0540E0F move X:0x0e0f,X0

PESL( PWMA, PWM_OUTPUT_SOFTWARE_CONTROL, 0x3f );

P:00000115: 80F40E033F00 bfclr #0x3f00,X:0x0e03

P:00000118: 82F40E033F00 bfset #0x3f00,X:0x0e03

PESL( PWMA, PWM_OUTPUT_PAD, PWM_ENABLE );

P:0000011B: 82F40E038000 bfset #0x8000,X:0x0e03

PESL( PWMA, PWM_RELOAD_INT, PWM_DISABLE);

P:0000011E: 80F40E000020 bfclr #0x20,X:0x0e00

PESL( PWMA, PWM_FAULT_INT_DISABLE, PWM_FAULT_0 );

P:00000121: 80F40E010002 bfclr #0x2,X:0x0e01

PESL( PWMA, PWM_FAULT_INT_DISABLE, PWM_FAULT_1 );

P:00000124: 80F40E010008 bfclr #0x8,X:0x0e01

PESL( PWMA, PWM_FAULT_INT_DISABLE, PWM_FAULT_2 );

P:00000127: 80F40E010020 bfclr #0x20,X:0x0e01

PESL( PWMA, PWM_FAULT_INT_DISABLE, PWM_FAULT_3 );

P:0000012A: 80F40E010080 bfclr #0x80,X:0x0e01

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0000 );

P:0000012D: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000130: F0540E03 move X:0x0e03,X0

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0001 );

P:00000132: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000135: 82F40E030001 bfset #0x1,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0002);

P:00000138: 80F40E03003F bfclr #0x3f,X:0x0e03

P:0000013B: 82F40E030002 bfset #0x2,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0003 );

P:0000013E: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000141: 82F40E030003 bfset #0x3,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0004 );

P:00000144: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000147: 82F40E030004 bfset #0x4,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0005 );

P:0000014A: 80F40E03003F bfclr #0x3f,X:0x0e03

P:0000014D: 82F40E030005 bfset #0x5,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0006);

P:00000150: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000153: 82F40E030006 bfset #0x6,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0007 );

P:00000156: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000159: 82F40E030007 bfset #0x7,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0008);

P:0000015C: 80F40E03003F bfclr #0x3f,X:0x0e03

P:0000015F: 82F40E030008 bfset #0x8,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0009 );

P:00000162: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000165: 82F40E030009 bfset #0x9,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x000a );

P:00000168: 80F40E03003F bfclr #0x3f,X:0x0e03

P:0000016B: 82F40E03000A bfset #0xa,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x000b );

P:0000016E: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000171: 82F40E03000B bfset #0xb,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x000c);

P:00000174: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000177: 82F40E03000C bfset #0xc,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0010 );

P:0000017A: 80F40E03003F bfclr #0x3f,X:0x0e03

P:0000017D: 82F40E030010 bfset #0x10,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0020);

P:00000180: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000183: 82F40E030020 bfset #0x20,X:0x0e03

PESL( PWMA, PWM_OUTPUT_CONTROL, 0x0030 );

P:00000186: 80F40E03003F bfclr #0x3f,X:0x0e03

P:00000189: 82F40E030030 bfset #0x30,X:0x0e03

 
 

-----------------------------------
John L. WintersSr. Application Engineer DSP Operation 8/16 Bit Products Division Transportation & Standard Products Group Motorola Inc. 2100 E. Elliot Road, Tempe, Arizona 85284

-----------------------------------
* For faster turnaround in answering support questions please access *
* Motorola's Customer Support web site at *
* http://www.motorola.com/semiconductors/support *
* *
* Or send email to: D...@motorola.com *
-----------------------------------

 Motorola Confidential and Proprietary


-----Original Message-----
From: Olamide... [mailto:o...@yahoo.com]
Sent: Wednesday, November 12, 2003 12:05 AM
To: m...@yahoogroups.com
Subject: [motoroladsp] configure PWMA as output


I want to use PWMA as just ouput, i.e. like a regular GPIO.  How do i
do this???

I'll appreciate it if anyone can tell me how to configure all the
registers.  I believe i am configuring them right to my knowledge but
nothing is happening.  (my code below)

void InitPWM(void) //this is in init file
{
      PWMA_PMCTL = 0;
      PWMA_PMFCTL = 0;
      PWMA_PMFSA = 0;
      PWMA_PMOUT = 0xbf3f;
      PWMA_PWMCM = 0x7fff;
      PWMA_PWMVAL0 = 0x0000;
      PWMA_PWMVAL1 = 0x0000;
      PWMA_PWMVAL2 = 0x0000;
      PWMA_PWMVAL3 = 0x0000;
      PWMA_PWMVAL4 = 0x0000;
      PWMA_PWMVAL5 = 0x0000;
      PWMA_PMDISMAP1 = 0;
      PWMA_PMDISMAP2 = 0;
      PWMA_PMDCFG =0x007e;
      PWMA_PMCCR = 0;
      MSG_PWM_DONE;
}while(1) //this is in main
{
      PWMA_PWMVAL0 = 0xffff;
      delaySome(); delaySome();

      PWMA_PWMVAL0 = 0x0000;
      delaySome(); delaySome();
}

To my knowledge, setting PWMA_PWMVAL0 to 0xffff should make it high
(i.e. PWM of 100% duty cycle) because this number is greater than what
i set value in PWMA_PWMCM to which is 0x7fff.

Also setting PWMA_PWMVAL0 to 0xffff, should turn it off.  EXCEPT OF
COURSE I SET UP OTHER REGISTER WRONG.  PLZ I NEED HELP ASAP...  Thank
u very much...mide...


_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  m...@yahoogroups.com

To Post:  m...@yahoogroups.com

To Leave: m...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3


">Yahoo! Terms of Service.


Message
My previous email was labeled MCP by mistake.  Please distribute as needed.
 
 

-----------------------------------
John L. WintersSr. Application Engineer DSP Operation 8/16 Bit Products Division Transportation & Standard Products Group Motorola Inc. 2100 E. Elliot Road, Tempe, Arizona 85284

-----------------------------------
* For faster turnaround in answering support questions please access *
* Motorola's Customer Support web site at *
* http://www.motorola.com/semiconductors/support *
* *
* Or send email to: D...@motorola.com *
-----------------------------------

General Business Information

-----Original Message-----
From: Olamide... [mailto:o...@yahoo.com]
Sent: Wednesday, November 12, 2003 12:05 AM
To: m...@yahoogroups.com
Subject: [motoroladsp] configure PWMA as output


I want to use PWMA as just ouput, i.e. like a regular GPIO.  How do i
do this???

I'll appreciate it if anyone can tell me how to configure all the
registers.  I believe i am configuring them right to my knowledge but
nothing is happening.  (my code below)

void InitPWM(void) //this is in init file
{
      PWMA_PMCTL = 0;
      PWMA_PMFCTL = 0;
      PWMA_PMFSA = 0;
      PWMA_PMOUT = 0xbf3f;
      PWMA_PWMCM = 0x7fff;
      PWMA_PWMVAL0 = 0x0000;
      PWMA_PWMVAL1 = 0x0000;
      PWMA_PWMVAL2 = 0x0000;
      PWMA_PWMVAL3 = 0x0000;
      PWMA_PWMVAL4 = 0x0000;
      PWMA_PWMVAL5 = 0x0000;
      PWMA_PMDISMAP1 = 0;
      PWMA_PMDISMAP2 = 0;
      PWMA_PMDCFG =0x007e;
      PWMA_PMCCR = 0;
      MSG_PWM_DONE;
}while(1) //this is in main
{
      PWMA_PWMVAL0 = 0xffff;
      delaySome(); delaySome();

      PWMA_PWMVAL0 = 0x0000;
      delaySome(); delaySome();
}

To my knowledge, setting PWMA_PWMVAL0 to 0xffff should make it high
(i.e. PWM of 100% duty cycle) because this number is greater than what
i set value in PWMA_PWMCM to which is 0x7fff.

Also setting PWMA_PWMVAL0 to 0xffff, should turn it off.  EXCEPT OF
COURSE I SET UP OTHER REGISTER WRONG.  PLZ I NEED HELP ASAP...  Thank
u very much...mide...


_____________________________________
Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:  m...@yahoogroups.com

To Post:  m...@yahoogroups.com

To Leave: m...@yahoogroups.com

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3


">Yahoo! Terms of Service.