Jump to content

cromiumlake

Members
  • Content Count

    44
  • Joined

  • Last visited


Reputation Activity

  1. Like
    cromiumlake got a reaction from GeekDoc in Pot Tutorial   
    Thank guys, I mange to find this excellent tutorial:
    http://homepages.ius.edu/RWISMAN/C335/HTML/msp430Polling.HTM
    http://www.tij.co.jp/mcu/jp/docs/mcuorphan.tsp?contentId=44948
     
    I hope this help anyone
  2. Like
    cromiumlake reacted to cubeberg in DC Motor PWM (SLAA120)   
    Hm - think I might see it.  Do you have a connection between the GND of the LP and your power supply connected?
  3. Like
    cromiumlake reacted to cubeberg in DC Motor PWM (SLAA120)   
    Hm - how about the motor with the transistor base @ 3.6v?  Looks like you tried that with the LED, but I'm not sure from your motor results.
     
    Do you know what kind of current your motor needs?  2n3904 is only rated for 200mA
  4. Like
    cromiumlake reacted to cubeberg in DC Motor PWM (SLAA120)   
    No - you don't want to use an internal resistor here.  Pull-ups/down are typically used when you're using buttons - they keep the pin value at a 1 or 0 until the button connects the pin to vcc or gnd.  
     
    I'd suggest a couple of tests - try a lower value resistor (two in parallel will 1/2 your resistance if you don't have other values available).  Also - try just turning the pin on and off - have you already tried connecting 3.6v from the LP to the base?  That will let you eliminate PWM as your possible problem.
    Another possibility - swap your motor with an LED.  
  5. Like
    cromiumlake reacted to cubeberg in DC Motor PWM (SLAA120)   
    Did you try removing the jumper for the LED on P1.6?  
  6. Like
    cromiumlake got a reaction from simpleavr in Enable PWM on Port 2 of MSP430   
    I don't know about the generation gap, I'm clear that you intend no hostility. I think that perhaps your have  a more trained eye, and some things looks obvious after a while.
    I think that the best way to explain is to place yourself into someone else's shoes, that's why I tried to explain you my frustration and confusion along with my query.
    But, anyways no hard feelings from my side...and I want to share some code (to all the noobs like me), that I think can be really helpful. The code is not all mine, I have edited ideas from different books. 
     
     
     
    ------------------------------
     
    #include "msp430g2553.h"     void main(void) {     WDTCTL = WDTPW + WDTHOLD; // disable WDT           P1SEL |= BIT6; P1DIR |= BIT6;  TACTL |= TASSEL1; //Use ACLK CCR0 = 32767; //Max value CCR1 = 8500;   //modify this value to get the right duty cycle CCTL1 = OUTMOD_3; //Output Mode 3 is Set on CCR1, clear //on CCR0 //Turn On Timer TACTL |= MC_1;   for(;{    _BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/ interrupt }   } #pragma vector=TIMER1_A0_VECTOR __interrupt void TIMER1_A0_ISR(void) { P1OUT |= BIT6; } ---------------------------------------------- The code is fully working under msp430-gcc   Just confused a bit with the fact that the are different channels: How many in total I heard about 15 or so, is that correct does it mean that you could use one stepper per channel how do I access this channels .Btw, I read the manual before I'm asking this hehhe
  7. Like
    cromiumlake reacted to simpleavr in Enable PWM on Port 2 of MSP430   
    the breather code u were reading uses timer 0 for pwm output to the green led. to achieve the breathing effect, he used another timer (timer 1) to change the brightness of the led via adjust the timer 0 pwm setup duty cycle. for timer 1, there is no output pin, but instead a s/w interrupt in which the interrupt handler make things happen (set CCR1 / TA0CCR1).
       
     
    for the CCR1 = TACCR1 = TA0CCR1 relationship, i noticed them after reading too many codes. from the earlier TI examples for the F2xxx series, they had CCRx and TACCRx.
     
    although not explicitly mentioned, CCR means capture and compare register. TA means timer A, TA0 means timer A 0.
     
    i guess when u are working w/ the "lesser" devices like F2012/G2231 etc, where u only have one timer, writing CCRx, CCTLx (or TACCRx, etc) make sense as there is only one timer. so when i read codes and see CCRx i will mentally add TA0 prefix.
     
    it could be confusing when u 1st approaches these. i don't want to tell u how i got bitten by OUTMOD_4 = OUTMOD2.
     
    but they are there for good purpose when used in different contexts / coding styles. i am sure many of us are using different macros for the same registers, like many of us are trying to help w/ questions in the forum in different ways. some way are better than others in certain context and they are all for good intentions to solve your questions.
  8. Like
    cromiumlake reacted to spirilis in PWM led   
    I don't know what P1OUT_bit is, but it probably doesn't work with mspgcc.
     
    FWIW there should be easier ways to drive a PWM signal from these chips, using Timer_A's dedicated TA0.x outputs with the requisite P1SEL/P1SEL2 bits set.  This is an autonomously-hardware-driven PWM system so you don't need any interrupts.  Your example is a software-driven PWM setup where IRQs/ISRs are used to enact the events.  Search around for examples.
  9. Like
    cromiumlake reacted to oPossum in PWM led   
    PWM LED fade in/out with native code:
     
    http://forum.43oh.com/topic/3023-post-your-led-fader-code/?p=25886
  10. Like
    cromiumlake reacted to simpleavr in Enable PWM on Port 2 of MSP430   
    he's using CCR1 (channel 1) so we need to find a pin for TA0.1 which can be P1.2 or P1.6. P1.6 he used.
     
    i would make the same choice as P1.6 is the green LED. sometimes we "pick" the timer + channel solely because the we have layout constraints. in this case we want to use the LP on board green LED for demo.
     
    i would choose the timer + channel so that i can have pin matching the breadboard layout for my liking.
     
    note also from table 12 that 20pin device is not possible to use TA0.2 as there are on P3. so there are some advantages to do smd.
     
    /EDIT u may also be confused w/ the timer 0 and 1 register macros. the ones prefixed w/ TA1... are for timer 1. those w/o prefix are for TA0 (ex. CCR0 = TA0CCR0, CCTL0 = TA0CCTL0). if i were to use both timers in an application, i would prefix also timer 0 to make it more coherent and more readable. tried it on your compiler
  11. Like
    cromiumlake reacted to simpleavr in Enable PWM on Port 2 of MSP430   
    yes, i do found them confusing. it took me quite a while to figure it out. in my opinion it's better if they leave the pin number out.
  12. Like
    cromiumlake reacted to cde in Enable PWM on Port 2 of MSP430   
    You know, that's really a bit confusing. I though P1.1-3 would mean P1.1 through P1.3. Same with P1.5-7.
  13. Like
    cromiumlake reacted to simpleavr in Enable PWM on Port 2 of MSP430   
    if u read the "device output signal" column, it says TA0.0 for P1.1-3, P1.5-7
     
    this means for clock output on timer 0, channel 0, u can use P1.1 or P1.5, the 3 and 7 are pin number of the device. u just need to use P1SEL register to select either BIT1 or BIT5 and use that pin to drive your led / servo, etc.
     
    similarly we have TA0.1, TA0.2, TA1.0, TA1.1, TA1.2 mapping entries for 2 x 3 channels timer output (2 timer TA0 and TA1, and 3 channels each)
     
    also note there are less choice on which pin to use on 20 pin devices as there are no port 3 available.
  14. Like
    cromiumlake reacted to spirilis in Enable PWM on Port 2 of MSP430   
    Another common term for PWM is "Compare Match", since the process involves a timer peripheral triggering an external pin flip upon matching one of the compare registers.
  15. Like
    cromiumlake reacted to spirilis in Timer order   
    It makes no difference at all since those symbols are just C "#define" macros which boil down to numbers, and those numbers are OR'd together by the compiler before the final instructions are generated.
     
    So the CPU just sees a memory location getting a single number written to it with the specified bits set.
     
    Sent from my Galaxy Note II with Tapatalk
     
     
  16. Like
    cromiumlake reacted to jpnorair in __low_power_mode_0()   
    Something is wrong with your text formatting.  Use UTF-8, that should work.
  17. Like
    cromiumlake reacted to spirilis in __low_power_mode_0()   
    I know in mspgcc we have LPM0, LPM1, LPM2, LPM3, LPM4 macros, so instead of __low_power_mode_0();  just type LPM0;
  18. Like
    cromiumlake reacted to simpleavr in ACLK 32kHZ   
    may be u can show us a photo how your xtal is soldered.
     
    here is one example, the important point is to have the casing soldered to ground.
     
    http://forum.43oh.com/topic/3057-using-32-khz-xtal-with-breadboard/
  19. Like
    cromiumlake reacted to spirilis in ACLK 32kHZ   
    that looks right.  Can you post your *current* code you're testing with (in case any changes were made for experimenting sake)?
  20. Like
    cromiumlake reacted to simpleavr in ACLK 32kHZ   
    there is no magic here, just tried w/ the above code. the code and the h/w setup cannot be more simpler.
     
    from your photo, your LP is kind of beaten up. i can only suggest
     
    . remove xtal, clean up pads, try another one w/o soldering 1st.
    . try another LP if u have another one.
    . try another MCU (say G2452) and see if problem lies on the pins.
     
    this cylinder xtals comes in a variety of qualities, it may be worthwhile to have a batch and test them one by one before using. that's what i do.
     

  21. Like
    cromiumlake reacted to spirilis in ACLK 32kHZ   
    Be sure you're using the LFXT1 crystal for ACLK:
     
    BCSCTL3 = LFXT1S_0 | XCAP_3;
     
    (or just BCSCTL3 = XCAP_3, rather than BCSCTL3 |= XCAP_3 as you have in there)
     
    It should still blink without that though, and it might be the default anyway.  Good practice to force it though.
    If it is using VLOCLK for some odd reason, it would blink on the scale of every ~3 seconds or so.
  22. Like
    cromiumlake reacted to spirilis in ACLK 32kHZ   
    Just tested your code in the first post on one of my spare launchpads with a G2553 installed and the micro crystal soldered on.
     
    It blinks correctly.
     
    Check the BCSCTL registers, I think BCSCTL3, there's a "LFXT1OF" bit you may want to test (OF = Oscillator Fault).  Maybe set P1.6 to the value of that bit after startup; instead of doing LPM3 + GIE, just set GIE and do a while(1) loop copying the LFXT1OF bit to P1.6's LED.  Your crystal might not be soldered right after all.
  23. Like
    cromiumlake reacted to simpleavr in ACLK 32kHZ   
    xtals are tricky, u might want to ground the "shell" also.
     
    the ti code examples contains code to test whether there is fault w/ the oscillator. i include it below in case u don't have it and u can do a quick test.
     
    u need watchdog timer and when there is oscillator fault, it will trigger nmi and u can do things.
     
    in one of my projects i would "test" if clock xtal is present and use it, or if not present, i would enable VLO.
     
     
     
     msp430x20x3_LFxtal_nmi.c     
     
     
    //****************************************************************************** //  MSP430F20xx Demo - LFXT1 Oscillator Fault Detection // //  Description: System runs normally in LPM3 with WDT timer clocked by //  32kHz ACLK with a 1x4 second interrupt. P1.0 is normally pulsed every //  second inside WDT interrupt. If an LFXT1 oscillator fault occurs, //  NMI is requested forcing exit from LPM3. P1.0 is toggled rapidly by software //  as long as LFXT1 oscillator fault is present. Assumed only LFXT1 as NMI //  source - code does not check for other NMI sources. //  ACLK = LFXT1 = 32768, MCLK = SMCLK = Default DCO // //  //*External watch crystal on XIN XOUT is required for ACLK*// // // //           MSP430F20xx //         --------------- //     /|\|            XIN|- //      | |               | 32kHz //      --|RST        XOUT|- //        |               | //        |           P1.0|-->LED // //  M. Buccini / L. Westlund //  Texas Instruments Inc. //  September 2005 //  Built with CCE Version: 3.2.0 and IAR Embedded Workbench Version: 3.40A //****************************************************************************** #include <msp430x20x3.h> volatile unsigned int i; void main(void) {   WDTCTL = WDT_ADLY_1000;                   // WDT 1s interval timer   IE1 |= WDTIE;                             // Enable WDT interrupt   P1DIR = 0xFF;                             // All P1.x outputs   P1OUT = 0;                                // All P1.x reset   P2DIR = 0xFF;                             // All P2.x outputs   P2OUT = 0;                                // All P2.x reset // An immedate Osc Fault will occur next   IE1 |= OFIE;                              // Enable Osc Fault   while(1)   {    P1OUT ^= 0x01;                           // Toggle P1.0 using exclusive-OR   _BIS_SR(LPM3_bits + GIE);                 // Enter LPM3 w/interrupt   } } #pragma vector=WDT_VECTOR __interrupt void watchdog_timer (void) {     _BIC_SR_IRQ(LPM3_bits);                 // Clear LPM3 bits from 0(SR) } #pragma vector=NMI_VECTOR __interrupt void nmi_ (void) {   do   {     IFG1 &= ~OFIFG;                         // Clear OSCFault flag     for (i = 0xFFF; i > 0; i--);            // Time for flag to set     P1OUT ^= 0x01;                          // Toggle P1.0 using exclusive-OR   }   while (IFG1 & OFIFG);                     // OSCFault flag still set?   IE1 |= OFIE;                              // Enable Osc Fault }
  24. Like
    cromiumlake reacted to JWoodrell in ACLK 32kHZ   
    a "crystal" is only supported at low speeds like the 32.768kHz... for a 16MHz clock, you will have to use a oscillator, the MSP doesn't support high speed crystals until the newest g2955 ones  which are SMD only right now.
  25. Like
    cromiumlake reacted to simpleavr in ACLK 32kHZ   
    let me explain the code
    WDTCTL = WDT_ADLY_1000;                   // WDT 1s interval timer this sets the watchdog timer to trip every 1000ms or 1sec.
     
    so if u see led blinks at 1 sec rate, it means xtal is good.
     
    if it blinks a lot quicker, it would be caused by the NMI (non-maskable interrupt), generated by the OSCFault condition, inside the _nmi() interrupt handler.
     
     
    this application is a very good example on what the watchdog timer is designed for. u use the timer interrupt to "acknowledge" the working condition (blink every second).
     
    looks like there are many code examples here now.
     
    http://www.ti.com/lsds/ti/microcontroller/16-bit_msp430/msp430_software_landing.page
     
    the one i am using is slac164 in the msp430f2xx folder or something.
     
     
    these are very good to learn the features of the devices and is very easy to run.
     
    if it's OSCFault, try to examine your soldering, or google image of how other people solder their xtals.
     
    /EDIT make sure you solder the shell / skin / case of the supplied crystal on to the PCB. it makes a difference. also, don't substitute the TI supplied crystal w/ a cheap clock crystal, it may not work.
×
×
  • Create New...