Jump to content
Sign in to follow this  
athornsb

LCD Refresh pin with PWM?

Recommended Posts

I'm looking to refresh the LCD in our project at 30-90Hz.  I have found the included code online, but don't understand how the signal is being tied to the output pins.  I have a lot of pins set to output already, and need the PWM signal to only be present on one.  Oh, and because of intense power restrictions, I am using the VLO for my timer interrupts and will need to use it for the PWM signal as well.

 

NOTE: the PWM mode that toggles from high to -high will need to be used, instead of high to ground.

Thanks guys!

 

#include "msp430x21x2.h"

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x0C; // P1.2 and P1.3 output
P1SEL |= 0x0C; // P1.2 and P1.3 TA1/2 otions
TA0CCR0 = 512 - 1; // PWM Period
TA0CCTL1 = OUTMOD_7; // TA0CCR1 reset/set
TA0CCR1 = 384; // TA0CCR1 PWM duty cycle
TA0CCTL2 = OUTMOD_7; // TA0CCR2 reset/set
TA0CCR2 = 128; // TA0CCR2 PWM duty cycle
TA0CTL = TASSEL_2 + MC_1; // SMCLK, up mode

__bis_SR_register(CPUOFF); // Enter LPM0
}

Share this post


Link to post
Share on other sites

Actually I see now that it's the P1SEL definition that controls if the pin is pulse width modulated, allowing me to use that option to send it to just one of my pins.  Sorry, please ignore this post!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...