Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Jake last won the day on September 24 2015

Jake had the most liked content!

About Jake

  • Rank
    Level 1

Contact Methods

  • Website URL

Profile Information

  • Location
  • Interests
    Electronics, Horses, Machinist, Shooting
  • Github
  1. I am using CCS6 I am going to back to LAB 8 the UART lab to see if there is something mad with my launchpad or the terminal itself. What I dont get is the fact that I cant see any signals coming from the sensor at all. I figured I would see some data with the logic analyzer connected to it.
  2. Howdy everyone, Finally getting back to the microcontrollers. I have been trying to get the MSP and ADXL to work together. https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/490264 I have been using this code and the ADXL from Adafruit they already has the pull up resistors on the board. From Adafruit example they are only using SDA and SCL and the 3v power. The red LED is only supposed to be on if the sensor is in certain positions. But it's on all the time. And I can not get anything to come up on the terminal screen even though it says connected. Has anybody else built one of these? Any where to start with the terminal connectivity or seeing if the sensor is functioning? I tried connecting SCL and SDA to my logic analyzer, both just show high but no signal. Thanks! Merry Christmas to yall! Sent from my XT1254 using Tapatalk
  3. Sprillis, It is TASSEL_2 Do I need a line to setup and start the BCS? Also on the DCOCTL I thought that was enough to tell it to go there, but I have not been able to get it to work, if you run it with the debugger, works perfectly. As soon as you are completely off of it back to no function. Desired pin goes high on start, but no response at all. I dunno I am stumped. // initialize Timer0_A TA0CCR0 = ( 10000 / TICKS_PER_SECOND ) - 1; // set up timer for 12.5Hz TA0CTL = TASSEL_2 + ID_3 + MC_1; // configure and start timer SFR_8BIT(BCSCTL2); SFR_8BIT(DCOCTL); // enable interrupts TA0CCTL0 = CCIE; // enable timer CCR0 interrupts __enable_interrupt(); // set GIE in SR LPM3; // select low power mode 3 while(1); } /** * Timer interrupt called at 32Hz (TICKS_PER_SECOND) */ #pragma vector = TIMER0_A0_VECTOR __interrupt void myTimerISR(void) { switch( current_state )
  4. Howdy Everybody, I am trying to figure out how to change this code from running on the crystal to running on the DCO. I already built the board this is going on and dumbed up and did not make any provisions for the crystal. I have not located the document that had the timer modes laid out to where I could understand the addressing of each of the timers. Thanks for the help! #include <msp430.h> #define LEDR BIT0 #define LEDG BIT6 #define BUTTON BIT3 const int TICKS_PER_SECOND = 32; enum {state_waiting, state_hold_high}; unsigned int current_state = state_waiting; unsigned int hold_timer = 0; void init(void) { // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD; // Enable LED outputs and Button pullup P1OUT = BUTTON; P1DIR = LEDR + LEDG; P1REN = BUTTON; // Set up 32768Hz crystal BCSCTL3 |= XCAP_3; // select 12pF caps SHOULD DEL THIS LINE // initialize Timer0_A TA0CCR0 = ( 32768 / TICKS_PER_SECOND ) - 1; // set up timer for 32Hz //DC0CCRO = ( 125000 / TICKS_PER_SECOND ) -1; // REPLACE ABOVE LINE NEED TO ADU TA0CTL = TASSEL_1 + ID_0 + MC_1; // configure and start timer //BCSCTL2 |= SELM_0 + DIVM_8; // SETUP FOR TIMER TO REPLACE ABOVE DCO TIMER DIVIDE BY 8 // enable interrupts TA0CCTL0 = CCIE; // enable timer CCR0 interrupts CHANGE TO BCS? __enable_interrupt(); // set GIE in SR LPM3; // select low power mode 3 while(1); } /** * Timer interrupt called at 125Hz (TICKS_PER_SECOND) */ #pragma vector = TIMER0_A0_VECTOR __interrupt void myTimerISR(void) { switch( current_state ) { /* state waiting */ case state_waiting: if( ( P1IN & BUTTON ) == 0 ) { if( hold_timer >= TICKS_PER_SECOND * 2 ) { /* If button held for 2 seconds change state */ current_state = state_hold_high; hold_timer = 0; break; } else { /* If button pressed, but not for 2 seconds yet inc timer */ hold_timer++; } } else { /* Button not pressed, reset timer */ hold_timer = 0; } break; /* state hold high */ case state_hold_high: /* Set output high */ P1OUT |= LEDR; if( hold_timer >= TICKS_PER_SECOND * 60 ) { /* If timer has elapsed, set output LOW, switch state */ P1OUT &= ~LEDR; hold_timer = 0; current_state = state_waiting; break; } else { hold_timer++; } break; /* return to a idle state */ default: current_state = state_waiting; break; } } void main( void ) { init(); }
  5. I'll be working on it next week! Do y'all have any good sources on the i2c displays? Sent from my XT1254 using Tapatalk
  6. thanks for the link! I could use an Arduino also, I am going to try with the MSP first, that is a good idea with using two of them. The displays take up a bunch of pins, that was one reason I was thinking about using the UART and going back to the PC to save some pins. I am going to get rolling on it next week.
  7. I am going to try to pull this off! I have 5 weeks to get it done. This is for the elementary school that my kids go to, there all getting involved in getting the cars, track, and timing system all done. I was initially thinking a MSP430G2553 The controller would be able to Drop starting gate and start timing with a pushbutton ( I really want to do a drag race light tree, but I may be getting too ambitious) Record the time of each lane and write to display Lane lights to light up winner lane. I know I could build the lane win lights easily with components, but I am hoping to pull off the timing and display to screen. Something simple like print to cmdline screen or the UART interface in CCS. Sooo do yall think I am out of my mind trying to go with this approach or? I am thinking the lane sensors would just be photodiodes in the track, sending inputs back to the controller A Button input that will trigger the timer to start, and output to drop the start gate Capture the time of each lane upon a change in state of the input pin, stop timer on the input of the last pin. Thanks!
  8. Thanks! I will see if I can get the code written this week and get going on it. On the timers I thought the one timer would be dedicated to that process.
  9. I have another project where I have 4 analog signals that I need to convert to 4 digital signals. The update period on the hardware is about 1ms. I was thinking about using the 12bit A-D, since there is a A and B timer I thought I would be able to run two continuous signal sets through it. I would have to run two chips to get the job done. I am not crunched for space so if I have to run individual ones it is not the end of the world. This is for the torque meters from my analog servo drives to the LinuxCNC interface for my CNC mill control retrofit. Thanks guys!
  10. On the interrupts I have been told the same thing to keep them short, but instead of constantly polling I figured the interrupt would be better. Also this timing function is the most important function in the scheme of things, I want it to drop what ever else it was doing and go to this function. Everything else is able to wait while this evolution is taking place. Now I'll see if I can get my other pieces of the puzzle done!! Sent from my XT1254 using Tapatalk
  11. I CANT HIT THE THANKS BUTTON ENOUGH!!!!!! Thanks again Greg! It works great and makes sense, this has been a steep learning curve!
  12. I have been looking for some code snippets of the timer A up count mode Setting TA0CCR0 = 512 for 1 sec with the crystal hooked up and /8 Input low to start timer start timer in mode 6 toggle/set count ++ to get two seconds toggle output when condition reached output to start timer again in mode 7 reset/set (or use another timer if I have to) count CCRO 60 times for 60 seconds reset output Or I think I might be able to use output mode 2 toggle/reset, count 2 periods output high count 60 periods reset output I can not seem to find the code to set the timer modes to try this. I have dug through slap113 (timers in depth) and slau144j which helped me get to this line of thinking, but I can not find code snippets on the modes to get going on it. THANKS!!!
  13. I have finally had a bit more time to attempt this. I did find the real time clock documents, which someone else was using to capture a thermostat reading at specific intervals. I am not getting any errors in the code, but it will not build. I am not sure where I have gone wrong. Do yall see anything that I could do to get this rolling ? #include "RTC.h" #include "msp430g2553.h" void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x01; // Set P1.0 to output direction CCR0 = 32768 - 1; TACTL = TASSEL_1 + MC_1; // ACLK, upmode CCTL0 |= CCIE; // enable CCRO interrupt _EINT(); P1OUT &= 0x00; // Shut down everything P1DIR &= 0x00; P1DIR |= BIT0 + BIT6; // P1.0 and P1.6 pins output the rest are input P1REN |= BIT3; // Enable internal pull-up/down resistors P1OUT |= BIT3; //Select pull-up mode for P1.3 P1IE |= BIT3; // P1.3 interrupt enabled P1IES |= BIT3; // P1.3 Hi/lo edge P1IFG &= ~BIT3; // P1.3 IFG cleared while (1) { LPM3; // enter LPM3, clock will be updated P1OUT ^= 0x01; // do any other needed items in loop _NOP(); // set breakpoint here to see 1 second int. } } // Timer A0 interrupt service routine #pragma vector=TIMERA0_VECTOR __interrupt void Timer_A(void) { incrementSeconds(); LPM3_EXIT; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { if(P1IN & BUTTON); // Start timer when button is high incrementSeconds(2); // count 2 seconds as long as button is high P1OUT |= BIT6; // Set output high incrementSeconds(60); // count 60 seconds after output is high P1IFG &= ~BIT6; // Clear IFG, reset P1.6 low }
  14. Awesome THANKS!! I will see if I can get it to work with that. What I am trying to do is if there is an continuous input for at least 2 seconds for it to make an output high, after the output goes high reset the output to low after 60 seconds. I am trying to use one remote button to do multiple tasks, a short push will allow one action to happen, a long (2 sec) push will allow a different action to occur. If (BUTTON HIGH) //check for input pin high START TIMER COUNT 2 SECONDS //start and run timer as long as input is high MAKE OUTPUT PIN HIGH // if it makes it to the 2 seconds make output pin high START TIMER COUNT 60 SECONDS // count down timer RESET OUTPUT TO LOW // reset output pin to low after 60 seconds elapses
  • Create New...