Jump to content

turd

Members
  • Content Count

    116
  • Joined

  • Last visited

  • Days Won

    2
  1. I installed these .deb packages: https://launchpad.net/ubuntu/oneiric/+s ... ext=msp430 A simple blink program compiles file but when I go to load it I get this: How can I fix this?Thank you.
  2. Anyone see this yet? http://www.mouser.com/framfordummies/
  3. 0b1010000 = 0x50 UCB0I2CSA = 0x50;
  4. turd

    MSP430G2553 I2C

    This might help: viewtopic.php?f=8&t=2266&p=16737#p16801 Also look at the example code from TI: http://www.ti.com/lit/zip/slac485 http://www.ti.com/lsds/ti/microcontroll ... /code.page It took me a couple weeks to get it working for me and now its been awhile since I worked with it so I probably won't be much help beyond this.
  5. turd

    Setting pins??!

    Try this: /* * main.c */ #include void main(void) { int i; WDTCTL = WDTPW + WDTHOLD; P1DIR = BIT6; P1OUT = 0x00; for (; { P1OUT ^= BIT6; for (i=0; i<0xFFFF; i++) { } // delay } // infinite loop }
  6. I'll try this next time I reinstall my OS (could be a while). Thank you boseji.
  7. What voltage is it running at?
  8. turd

    I2C USCI_B0 Slave?

    Do you maybe need to enable the RX interrupt too? IE2 |= (UCB0TXIE | UCB0RXIE);
  9. turd

    I2C USCI_B0 Slave?

    Would this help? UCB0BR0 = 12; //fSCL = SMCLK/12 = ~100kHz UCB0BR1 = 0;
  10. I'm glad it's working Do you have any cool plans for it?
  11. Here is another attempt: #include "msp430g2553.h" const unsigned char setup[] = {0x80, 0x01, 0x01, 0x00, 0x01}; const unsigned char pos_1[] = {0x80, 0x01, 0x04, 0x00, 13, 127}; const unsigned char pos_2[] = {0x80, 0x01, 0x04, 0x00, 35, 127}; unsigned char i; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz DCOCTL = CALDCO_1MHZ; P1SEL = BIT1 + BIT2; // Set P1.1 to RXD and P1.2 to TXD P1SEL2 = BIT1 + BIT2; UCA0CTL1 |= UCSSEL_2; // Have USCI use SMCLK AKA 1MHz main CLK UCA0BR0 = 104; // Baud: 9600, N= CLK/Baud, N= 10^6 / 9600 UCA0BR1 = 0; // Set upper half of baud select to 0 UCA0MCTL = UCBRS_1; // Modulation UCBRSx = 1 UCA0CTL1 &= ~UCSWRST; // Start USCI for(i = 0; i < 5; i++) { while(!(IFG2 & UCA0TXIFG)); UCA0TXBUF = setup[i]; } __delay_cycles(100000); while (1) { for(i = 0; i < 6; i++) { while(!(IFG2 & UCA0TXIFG)); UCA0TXBUF = pos_1[i]; } __delay_cycles(100000); for(i = 0; i < 6; i++) { while(!(IFG2 & UCA0TXIFG)); UCA0TXBUF = pos_2[i]; } __delay_cycles(100000); } } Does it doing anything?
  12. Is this what you are using? Are you running the servocontroller at 5V? Are you running the MSP430G2553 at ~3.3V?
  13. Try this: #include "msp430g2553.h" unsigned char TxByte = 0; unsigned int result; unsigned int del; void in(unsigned int servo, unsigned int angle); void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz DCOCTL = CALDCO_1MHZ; P1SEL = BIT1 + BIT2; // Set P1.1 to RXD and P1.2 to TXD P1SEL2 = BIT1 + BIT2; UCA0CTL1 |= UCSSEL_2; // Have USCI use SMCLK AKA 1MHz main CLK UCA0BR0 = 104; // Baud: 9600, N= CLK/Baud, N= 10^6 / 9600 UCA0BR1 = 0; // Set upper half of baud select to 0 UCA0MCTL = UCBRS_1; // Modulation UCBRSx = 1 UCA0CTL1 &= ~UCSWRST; // Start USCI while (1) { in(0, 1000); //in(num servo, position) __delay_cycles(10000); //__bis_SR_register(CPUOFF + GIE); //Enter LPM0 with interrupts } } void in(unsigned int servo, unsigned int angle) { //bytes to servocontroller TxByte |= 0xAA; //envia byte de inicio (170 en decimal) TxByte |= 0x0C; //numero de dispositivo (12 por default) TxByte |= 0x04; //byte de comando TxByte |= servo; //numero de servo TxByte |= (((angle >> 7) & 0x3f)); TxByte |= (angle & 0x7f); while(!(IFG2 & UCA0TXIFG)); UCA0TXBUF = TxByte; } Remember to use the correct pin: What are you using to program the chip, CCS, IAR or MSPGCC?
×
×
  • Create New...