Jump to content

cromiumlake

Members
  • Content Count

    44
  • Joined

  • Last visited

About cromiumlake

  • Rank
    Advanced Member
  1. Hello There, I have modified one of the example files from Proffesor Valvano, I've got this file from: http://users.ece.utexas.edu/~valvano/arm/PWM_4C123.zip I have modified PWM0A_Init so I can see the output on PF3 (Green Led), here the most right comments indicate the changes that I have made: void PWM0A_Init(unsigned short period, unsigned short duty){ volatile unsigned long delay; SYSCTL_RCGCPWM_R |= 0x01<<1; // 1) activate PWM0 >>activate PWM1 SYSCTL_RCGCGPIO_R |= 0x01<<5; // 2) activate port B >> activate port F delay = SYSCTL_RCGCGPIO_R; // allow time to finish activating >> Remains the same GPIO_PORTF_AFSEL_R |= 0x01<<3; // enable alt funct on PB6 >> set bit 3 GPIO_PORTF_PCTL_R &= ~0xF000; // configure PB6 as PWM0 >> Clear PMC3 GPIO_PORTF_PCTL_R |= 0x5000; // >> to x5 on PCTL GPIO_PORTF_AMSEL_R &= ~0x08; // disable analog functionality on PB6 >> on bit 3 GPIO_PORTF_DEN_R |= 0x01<<3; // enable digital I/O on PB6 >> on bit 3 SYSCTL_RCC_R |= SYSCTL_RCC_USEPWMDIV; // 3) use PWM divider >> Remains the same SYSCTL_RCC_R &= ~SYSCTL_RCC_PWMDIV_M; // clear PWM divider field >> Remains the same SYSCTL_RCC_R += SYSCTL_RCC_PWMDIV_2; // configure for /2 divider >> Remains the same PWM1_3_CTL_R = 0; // 4) re-loading down-counting mode >> to M1G3 PWM1_3_GENB_R = (PWM_3_GENB_ACTCMPAD_ONE|PWM_3_GENB_ACTLOAD_ZERO);// >> to M1 G3 B // PB6 goes low on LOAD // PB6 goes high on CMPA down PWM1_3_LOAD_R = period - 1; // 5) cycles needed to count down to 0 >> period=4000 PWM1_3_CMPB_R = duty - 1; // 6) count value when output rises >> duty=3000, M1 G3 B PWM1_3_CTL_R |= 0x01; // 7) start PWM0 >> M1G3, same value x01 PWM1_ENABLE_R |= 0x01<<7; // enable PB6/M0PWM0 >> M1, PWM7EN } I have not change anything major, I only changed the: Port, PWM module and generator.....but I can't manage to get anything out from the logic analizer. Btw the function is called with the following values: PWM0A_Init(40000, 30000); Please if you could give me any suggestions crom
  2. 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
  3. cromiumlake

    Pot Tutorial

    Hello There, I'm trying to understand how to interact with a DC motor by changing the speed by PWM. I want to use a Potentiometer to change the speed. So far I have only the PWM working code for the motor. I have red some theory, but I'm looking for some explanatory code. Perhaps a tutorial that can make me started. Any suggestions? (Please don't point me to energia)
  4. IT works!!!.....When I give it a large enough duty cycle I don't know who decided to put me as an "Advanced Member"...?I'm certainly not sorry for the noise
  5. But, if it was fried would not work when connected directly to 5v line Please the attached picture and tell me what you think
  6. The motor requires 5V at 0.16A how about the motor with the transistor base @ 3.6v?....R: Dit not work, that settup is when I tried the 470 and 10 ohms
  7. Thanks for the tests, nice approach to troubleshooting. I dis the following tests: 470 ohms = fail 10 ohms = fail replace motor with led: just by touching the resistor the led goes on. If connect to Vcc goes on. If plugged LP ground does on. If Connected to anything goes on Now, I just don't get it hhahahha
  8. Yes I did try that. Do I have to configure some kind of pull up resistor perhaps?
  9. Hi There, I am testing the circuit that appears on Slaa120 (PWM DC Motor Control Using Timer_A of the MSP430), of course with some small modifications. ?I made the Darlington pair using 2N3904 transistors, the resistor is 1200ohms. To test the circuit, I connect the base to 5v and...the motor spins. In the other hand the code for PWM is working and I can test it on P1.6, I can see the LED on. My problem is that if I join the two parts, the motor does not spin (I connect the base to P1.6). I can only think that the MSP is not giving me enough power, but the 2N3904 does not need much. Any ideas, Cromiumlake
  10. I was looking at the header file, but I can't find it mentioned as Unsigned....how do you know this, is it in any manual?, I just followed 32767 becasue I thought that I had to match the clock speed. The limitations on choosing a diiferent CCR0 values: does it come from the var type only, or do you have hardware constrains? Do you think that some outmnodes are better than others for a particular application (or suitable),: dc motors, steppers, servos, led etc? Please send a link to you video of polymorphic tune player Meanwhile I'm going to test the SLAA120 "PWM DC Motor Control Using Timer_A of the MSP430" it seem like a good next step on my learning curve. Thanks and greets all
  11. 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
  12. Once again, thanks for exaplining and for your time SimpleAVR Now I understand that table on the datasheet. You are right, I'm getting a bit confused. I can see CCR0 and CCR1 mentioned, on the line: TA1CCR0 = 50000; As I read it as TA1 on CCR0(making no sense), but certainly is not the case. How did you find CCR1?
  13. I don't know what is your problem jpnorair, you have used the 3 last posts using many words to push me away, explain the obvious and not adding anything of real value....that I'm sure you have plenty to say. It takes you the same amount of words to be helpful!
×
×
  • Create New...