Jump to content
43oh

Astrom27

Members
  • Content Count

    10
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Astrom27 reacted to DanAndDusty in nokia 5510   
    I have one of these LCDs though on a different board. I wrote a "library" for it.
     
    Put the 2 files in your project directory, Alter the #defines in PCD8544.c to reflect your pins (LCD_SCE etc), in your projects main source file #include "PCD8544.h" in your main() call LCD_init() to setup the lcd, then you can use LCD_gotoXY, LCD_writeString, LCD_writeChar etc.
     
    This was my first "non blinky light" code written for the MSP and I haven't gone back to tidy/refactor but it works. It uses bit banging not the hardware SPI so there are many things that could be tidied up/optimised. Im also including a lil proggie that displays Temp/Vcc and ADC readings for Pin 1.3 and displays the results on the LCD. This code is a quick hack to test the library/get to know some of the ADC so don't take the code in it as anything other than a test framework.
     
    Hope this helps.
     
    Dan
     
    Zipped source files :ADC_and_LCD.zip
     
    P.S. I added the file as a zip file as the board disallows files with a .h extension
  2. Like
    Astrom27 got a reaction from bluehash in [ ENDED ] June 2011 - 43oh Project of the Month Contest   
    HI
    well i finally made a video on my project but it didnt come out very good, the sound is off a little. The project is
    controlling a dc motor with pwm.
     
    here is the code again i am using grace for the program so all the initalization code is not there but the main program
    should be ok i think.
     
    Edit */*/* I added the full .zip of the project with all the grace files.
     

    * Chris Mansfield *** Pwm Dc motor control for msp430 */ /* * ======== Standard MSP430 includes ======== */ #include #include /* * ======== Grace related includes ======== */ #include /* * ======== main ======== */ int pwm=200; int max; #define MaxPwm 250 #define PWMStep 5 void main(void) { CSL_init(); // Activate Grace-generated configuration __enable_interrupt(); // Set global interrupt enable WDTCTL = WDTPW + WDTHOLD; int i=0; // Jump start for motor requires more current to get for(i=0;i<10000;i++) // started. P1OUT= BIT0; P1IFG=0; // clear the interrupt flag while(1) { if(pwm != MaxPwm) { for(max=0;max<=MaxPwm;max+=PWMStep) { if(max < pwm) P1OUT = BIT0;//output on else P1OUT = 0;// output 0 off } } else P1OUT = BIT6 | BIT0; // max output } } volatile int pin; volatile char depin; void port1(void) { P1OUT=0; pin=P1IN; if(pin & BIT3) { P1IFG&= ~BIT3; // clear p1.3 flag pwm+=PWMStep; //increase pwm if(pwm >= MaxPwm) pwm=MaxPwm; // limit max pwm 100% P1IE &= ~BIT3; // debouce depin=1; TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR; TACCR0 = 3500; } if(pin& BIT1) { P1IFG&= ~BIT1 ; // clear p1.1 flag pwm-=PWMStep; // decrease pwm if(pwm <= 0) pwm=0; // limit min pwm 0% P1IE &= ~BIT1; // debouce depin=1; TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR; TACCR0 = 3500; } if(P1IFG) //clears any other flags P1IFG=0; } void WTD_ISR() { } void TA_ISR() { if(depin == 1) // re-enable pin interuppt { P1IE |= BIT3; P1IE |= BIT1; depin=0; } TACTL = MC_0;// disable clock TACCR0 = 0; // zero counter }
     
    here is the video ....sorry on the quality..
     



    Motor.zip
  3. Like
    Astrom27 got a reaction from C_Coffie in DC PWM motor control   
    HI
    I wanted to share the project i am working on, it is for a small dc motor pwm controller.
    I have got it working and it works pretty good. It does not use the pwm of the timer control,
    but a separate ratio type control in the main function. It Uses the grace gui so i dont know if i have to
    attach at the files or not if that is needed ,but here is the main part of the code that should contain enough
    to work off of. Idont have the schematic right now ill work on one soon, it just uses a 3904 transistor for the
    motor to have enough current, and some resistors for the bias. It uses p1.1 , p1.3 with external buttons for the
    input speed change. They are tied to ground at the button and use the pull down resistors on the msp, they connect
    to vcc on the button pushes to pull them high and cause the interrupt to change the speed.The TA timer is used for
    button de-bounce.
     
    I can include the other grace files if they are wanted..
     
    Chris
     

    /* Chris Mansfield *** Pwm Dc motor control for msp430 */ /* * ======== Standard MSP430 includes ======== */ #include #include /* * ======== Grace related includes ======== */ #include /* * ======== main ======== */ int pwm=200; int max; #define MaxPwm 250 #define PWMStep 5 void main(void) { CSL_init(); // Activate Grace-generated configuration __enable_interrupt(); // Set global interrupt enable WDTCTL = WDTPW + WDTHOLD; int i=0; // Jump start for motor requires more current to get for(i=0;i<10000;i++) // started. P1OUT= BIT0; // ** was 0 a mistake **** P1IFG=0; // clear the interrupt flag while(1) { if(pwm != MaxPwm) { for(max=0;max<=MaxPwm;max+=PWMStep) { if(max < pwm) P1OUT = BIT0;//output on else P1OUT = 0;// output 0 off } } else P1OUT = BIT6 | BIT0; // max output } } volatile int pin; volatile char depin; void port1(void) { P1OUT=0; pin=P1IN; if(pin & BIT3) { P1IFG&= ~BIT3; // clear p1.3 flag pwm+=PWMStep; //increase pwm if(pwm >= MaxPwm) pwm=MaxPwm; // limit max pwm 100% P1IE &= ~BIT3; // debouce depin=1; TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR; TACCR0 = 3500; } if(pin& BIT1) { P1IFG&= ~BIT1 ; // clear p1.1 flag pwm-=PWMStep; // decrease pwm if(pwm <= 0) pwm=0; // limit min pwm 0% P1IE &= ~BIT1; // debouce depin=1; TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR; TACCR0 = 3500; } if(P1IFG) //clears any other flags P1IFG=0; } void WTD_ISR() { } void TA_ISR() { if(depin == 1) // re-enable pin interuppt { P1IE |= BIT1; P1IE |= BIT3; depin=0; } TACTL = MC_0;// disable clock TACCR0 = 0; // zero counter }
  4. Like
    Astrom27 got a reaction from bluehash in DC PWM motor control   
    HI
    I wanted to share the project i am working on, it is for a small dc motor pwm controller.
    I have got it working and it works pretty good. It does not use the pwm of the timer control,
    but a separate ratio type control in the main function. It Uses the grace gui so i dont know if i have to
    attach at the files or not if that is needed ,but here is the main part of the code that should contain enough
    to work off of. Idont have the schematic right now ill work on one soon, it just uses a 3904 transistor for the
    motor to have enough current, and some resistors for the bias. It uses p1.1 , p1.3 with external buttons for the
    input speed change. They are tied to ground at the button and use the pull down resistors on the msp, they connect
    to vcc on the button pushes to pull them high and cause the interrupt to change the speed.The TA timer is used for
    button de-bounce.
     
    I can include the other grace files if they are wanted..
     
    Chris
     

    /* Chris Mansfield *** Pwm Dc motor control for msp430 */ /* * ======== Standard MSP430 includes ======== */ #include #include /* * ======== Grace related includes ======== */ #include /* * ======== main ======== */ int pwm=200; int max; #define MaxPwm 250 #define PWMStep 5 void main(void) { CSL_init(); // Activate Grace-generated configuration __enable_interrupt(); // Set global interrupt enable WDTCTL = WDTPW + WDTHOLD; int i=0; // Jump start for motor requires more current to get for(i=0;i<10000;i++) // started. P1OUT= BIT0; // ** was 0 a mistake **** P1IFG=0; // clear the interrupt flag while(1) { if(pwm != MaxPwm) { for(max=0;max<=MaxPwm;max+=PWMStep) { if(max < pwm) P1OUT = BIT0;//output on else P1OUT = 0;// output 0 off } } else P1OUT = BIT6 | BIT0; // max output } } volatile int pin; volatile char depin; void port1(void) { P1OUT=0; pin=P1IN; if(pin & BIT3) { P1IFG&= ~BIT3; // clear p1.3 flag pwm+=PWMStep; //increase pwm if(pwm >= MaxPwm) pwm=MaxPwm; // limit max pwm 100% P1IE &= ~BIT3; // debouce depin=1; TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR; TACCR0 = 3500; } if(pin& BIT1) { P1IFG&= ~BIT1 ; // clear p1.1 flag pwm-=PWMStep; // decrease pwm if(pwm <= 0) pwm=0; // limit min pwm 0% P1IE &= ~BIT1; // debouce depin=1; TACTL = TASSEL_1 + ID_0 + MC_1 + TACLR; TACCR0 = 3500; } if(P1IFG) //clears any other flags P1IFG=0; } void WTD_ISR() { } void TA_ISR() { if(depin == 1) // re-enable pin interuppt { P1IE |= BIT1; P1IE |= BIT3; depin=0; } TACTL = MC_0;// disable clock TACCR0 = 0; // zero counter }
×
×
  • Create New...