Jump to content

Search the Community

Showing results for tags 'Code'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • Announcements
    • Suggestions
    • New users say Hi!
  • Spotlight!
    • Sponsor Spotlight
    • Sponsor Giveaways
  • Energia
    • Energia - MSP
    • Energia - TivaC/CC3XXX
    • Energia - C2000
    • Energia Libraries
  • MSP Technical Forums
    • General
    • Compilers and IDEs
    • Development Kits
    • Programmers and Debuggers
    • Code vault
    • Projects
    • Booster Packs
    • Energia
  • Tiva-C, Hercules, CCXXXX ARM Technical Forums
    • General
    • SensorTag
    • Tiva-C, Hercules, CC3XXX Launchpad Booster Packs
    • Code Vault
    • Projects
    • Compilers and IDEs
    • Development Kits and Custom Boards
  • Beagle ARM Cortex A8 Technical Forums
    • General
    • Code Snippets and Scripts
    • Cases, Capes and Plugin Boards
    • Projects
  • General Electronics Forum
    • General Electronics
    • Other Microcontrollers
  • Connect
    • Embedded Systems/Test Equipment Deals
    • Buy, Trade and Sell
    • The 43oh Store
    • Community Projects
    • Fireside Chat
  • C2000 Technical Forums
    • General
    • Development Kits
    • Code Vault
    • Projects
    • BoosterPacks


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 11 results

  1. i have been trying to connect the server and client to communicate i am getting an error "Err" without any message how should i debug it ? many thanks
  2. I'm new to MSP430 MCU and I had this MSP430FG439. How can I upload firmware code to the MSP430FG439 MCU using Energia IDE? Can you cite some references or tutorials that I could look through?
  3. I'm attaching a link to github with Energia code examples for various sensors. I started this as a place to put examples for students in a course I was helping to develop for middle and high school level students using the MSP430F5529. Unfortunately the course was not held but I'm putting them out there in the hope they might help someone. Where the code has been tested with other LaunchPads I've noted it. Here it is: https://github.com/fmilburn3?tab=repositories You won't find anything sophisticated but many are at least somewhat unique in that I couldn't find an example for that sensor tailored specifically for the F5529, or I wanted to better document it for beginners. Essentially all are variants of work done by others, including work on 43oh, and I hope I've recognized the contribution in the code. There is a wiki associated with some that has the schematic and photographs. There is some other example code that is almost complete - e.g. using small DC motors and servos and I might add them. Here is a list of sensors and devices currently out there: CNY70 - used as a proximity switch CNY70 - used as a tachometer MCP41010 - digital pot HC-SR04 - distance sensor 3 watt high intensity LED MAX4466 -sound level I2C LCD (4x20) and (2x16) HC-SR501 - PIR movement detection SW-180xxP - vibration sensor Joystick PFatFs - compiles and runs on the F5529 Hall effect rainfall sensor TMP36 - temperature Sharp GPf1S53VJ000F - photo interrupter Using low power modes (LPM) in Energia TCS3200 Color Sensor using MSP432 *** added 8/8/15 DS1307 Real Time Clock (RTC) Module *** added 8/9/15 INA125P Instrumentation Amplifier *** added 10/9/15 MCP3008 ADC *** added 10/12/15 TLC5615 DAC *** added 11/30/15 dAISy MarineTraffic shore station w/ CC3200 ** added 12/16/15 AD9850 Frequency Generator ** added 1/20/16 FFT ** added 1/20/16 Rotary encoder ** added 1/23/16 W5500 Ethernet ** added 3/25/16 MSP430G2955 pins_energia.h ** added 3/25/16 DriverLib examples for F5529 ** added 8/16 Infrared Transmission ** added 12/16 WS2812 LEDs using SPI ** added 12/16 Battery measurement ** added 1/17 Finite State Machine - alarm system ** added 2/6/17 Using RTC module with Energia - F5529 ** added 2/24/17 RCWL-0516 "doppler radar microwave motion sensor module" ** added 6/6/17 Vary time a LED stays lit with potentiometer ** added 7/8/17
  4. albertRM

    Readding DHT11

    Hi all i'm programming by MSP430fr5739 a temperature and humidity reading by the DHT11 sensor. ?The wire are correct, and so the problem is'nt in the link, it is in the code. This is my code, usind the dht11 library, find on internet. ?The main problem is that i don't know how to read the value of T and H, and maybe there is some problems in the reading (probably in the interrupt) ?Thanks for the advice. ?MAIN CODE: #include <msp430.h> #include <DHT11_LIB.h> unsigned char RH_byte1; unsigned char RH_byte2; unsigned char T_byte1; unsigned char T_byte2; unsigned char checksum; unsigned char Packet[5]; unsigned char volatile TOUT; unsigned char volatile SECOND_TIMER=0; void init(void); #pragma vector = TIMER0_A0_VECTOR __interrupt void CCR0_ISR(void){ SECOND_TIMER++; TOUT=1; //TOG (P1OUT,0x01); per il led CLR (TA0CCTL0, CCIFG); } void init(){ WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer PJDIR = BIT1+BIT2+BIT3; // Set LED to output direction PJOUT = BIT1; //high the LED PJOUT = BIT2; //Set clock and timer CSCTL1 = BIT1+BIT2 ; // DCO a 8MHz CSCTL2= SELS_3; // SMCLK take DCOCLK TA0CCR0 = 50000; // Initialize the timer to count at 20Hz TA0CTL = TAIE_1; // Enable interrupt TA0CTL = TASSEL_2 + ID_3 + MC_1+ TACLR ; // SMCLK, div 8, up mode, e fa il clear _enable_interrupt(); //Enable global interrupt } void main(void) { init(); while(1){ //Must wait 1 second initially and between all reads if(SECOND_TIMER >= 5){ TOG (PJOUT,BIT1); // Simple way to gather all data with one instruction read_Packet(Packet); RH_byte1 = Packet[0]; RH_byte2 = Packet[1]; T_byte1 = Packet[2]; T_byte2 = Packet[3]; checksum = Packet[4]; if (check_Checksum(Packet)) SET (PJOUT, BIT1); //Se il checksum giusto si riaccende SET (TA0CTL, TACLR); SET (TA0CTL, 0x10); //Up mode TA0CCR0 = 50000; //Initialize the timer to count at 5Hz SECOND_TIMER = 0; //Clear counter } } } DHT11 LIBRARY: #ifndef DHT11_LIB_H_ #define DHT11_LIB_H_ #define TST(x,y) (x & (y)) #define SET(x,y) (x|= (y)) #define CLR(x,y) (x &= ~(y)) #define TOG(x,y) (x ^= (y)) #define DPIN BIT0 extern unsigned char volatile TOUT; void start_Signal(void); void start_Signal(){ SET(P2DIR, DPIN); // Set Data pin to output direction CLR(P2OUT,DPIN); // Set output to low __delay_cycles(25000); // Low for at least 18ms SET(P2OUT,DPIN); //HIGH __delay_cycles(30); // High for at 20us-40us CLR(P2DIR,DPIN); // Mette il pin in ricezione (Input) } unsigned char check_Response(void); unsigned char check_Response(){ TOUT=0; SET(TA0CTL,TACLR); //Reset timer to 0; TA0CCR0 = 100; //Set timer to overflow in 100uS. SET(TA0CTL,CCIE); //And enable timer interrupt while(!(TST(P2IN,DPIN)) && !TOUT); //while if IN=0 if (TOUT) return 0; else { SET(TA0CTL,TACLR); SET(TA0CTL,CCIE); while((TST(P2IN,DPIN)) && !TOUT); if(TOUT) return 0; else{ CLR(TA0CTL,CCIE); // Disable timer interrupt return 1; } } } unsigned char read_Byte(void); unsigned char read_Byte(){ TOUT = 0; unsigned char num = 0; unsigned char i; CLR(TA0CTL,CCIE); for (i=8; i>0; i--){ while(!(TST(P2IN,DPIN))); //wait the hing signal SET(TA0CTL,TACLR); // clear SET(TA0CTL,0x10); //Up mode (Mode control 01b) SET(TA0CTL,CCIE); //enable interrupt while(TST(P2IN,DPIN)); //wait the low signal CLR(TA0CTL,0x30); //held counter if (TA0R > 0x28) //TA0R
  5. albertRM

    How read DHT11

    Hello everyone, I just started programming in C ++ to solve a small university project. I am a newbie in programming that's why I ask you a hand in writing the code. I'm working with Msp430fr5739 and the temperature and humidity sensor is the DHT11. The connections have already been made and we have to write the code. I already have the library DHT11 and I'm working in CCS. Can someone share a code that works and allows me to read the values of temperature and humidity? Thank you (and sorry for my english)
  6. Dmaseko

    MSP430G2553 ADC

    Hi, I'm new to MSP430, I'm using a MSP430G2553 in a project and need help with an in depth understanding of programming the ADC10 inputs of the MCU. I'm using a potentiometer in order to light one of 3 LEDs. For example, LED1 lights up when input voltage is 1V or less, LED2 lights up between 1V and 2V and LED3 lights up when the input voltage is greater than or equal to 2V. I have attached my code below but I am not clear on how to read, convert and store a voltage so that I can use the IF statements to light the respective LEDs. #include <msp430g2553.h> void indicator_LED(); int main(void) { unsigned int i; WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1DIR = 0x00; P2DIR = 0xff; P1OUT = 0x00; P2OUT = 0x00; while(1) // keep looping { ADC10CTL1 = CONSEQ_2 + INCH_0; // Repeat single channel, A0 ADC10CTL0 = ADC10SHT_2 + MSC + ADC10ON + ADC10IE; // Sample & Hold Time + ADC10 ON + Interrupt Enable ADC10DTC1 = 0x0A; // 10 conversions ADC10AE0 |= 0x01; // P1.0 ADC option select ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start __low_power_mode_0(); //__bis_SR_register (CPUOFF + GIE);// LPM0, ADC10_ISR will force exit if (ADC10MEM <= 0x228 && ADC10MEM > 0x1D6) { P2OUT = P2OUT | BIT1; for(i=0;i<=1;i++); } else if (ADC10MEM <= 0x1D6) { P2OUT = P2OUT | BIT2; for(i=0;i<=1;i++); } else if (ADC10MEM > 0x228) { P2OUT = P2OUT | BIT0; for(i=0;i<=1;i++); } else { P2OUT = ~P2OUT; for(i=0;i<=1;i++); } } }
  7. Adnan

    exp5969 and CC1120

    Hi, I have msp430fr5969 and cc1120 and want to construct a sensor node. my question where can I get the SPI code to establish the communication. Any suggestion or hint will be highly appreciated.
  8. Hi, I want to build a code for two TIVA lauchpads so as to form a redundant pair. If Launchpad 1 fails, then the logic should shift to Launchpad 2 where both launchpads have the same logic. How do I go about it? Any insights would be helpful.
  9. Hello, I am basically new to msp430 and CCS, and I am having a hard time trying to understand code, interrupts and timers. Background info: Goal.- read and interpret a dual 7 segment LED display with 10 pins. So after playing around with this part I found out that the way this works is the driver pins (9, 6) toggle each other really fast ~4khz, 9 is on while 6 is of etc. My idea was to use the MSP430G2553 to read A-G on PORT1 and the 2 drivers (9, 6) on PORT2. I read on interrupts and saw that there is a way to set up an interrupt for when your input signal (in this case 9 or 6 on the diagram) goes from high to low or low to high. SO if I could read all A-G segments when 9 is "on" it would correspond to digit 1, when 9 goes to "off" and 6 turns "on" i would read all A-G segments again and that would correspond to digit 2... I thought it would be easy but apparently there is a lot that I am overlooking. Here is my attempt to code: (worked from an example from TI Resource Explorer) #include <msp430.h> volatile int flag = 0; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop Watchdog timer if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF) { while(1); //trap for the Digitally controlled O. } BCSCTL1 = CALBC1_1MHZ; //set range for the O. DCOCTL = CALDCO_1MHZ; //set DCO step modulation 1MHZ P1DIR = 0; // Set P1.0 - P1.7 as input P2DIR = 0XF9; // set P2.1 AND P2.2 as inputs P2OUT = BIT4; // set P2.4 to start as on P2IE |= BIT2; // P2.2 interrupt enabled P2IES = 1; // Flag is set with a high-to-low transition P2IFG &= ~BIT2; // P2.2 interrupt flag cleared __bis_SR_register(GIE); // Enable all interrupts while(1) //Loop forever { } } #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { if(P1IN == 0x79) //check if P1IN= 01111001 means, p1.0=1, p1.1=0, p1.2=0, p1.3=1... etc { P2OUT = 0; // turn off bit 4 on port 2 (added to see if i recognize 01111001) } P2IFG &= ~BIT2; // P2.1 interrupt flag cleared } I am attempting to read all inputs in PORT1 and check if they match 01111001 which corresponds to the digit displaying "1" inverted so my zeros mean the segment is "on" so for example if i wanted to display "7" segments a, b, and c should be 0 the rest 1. or (01111000) I am ignoring the DP. The code compiles but my LED at BIT4 never turns off which means the interrupt is never happening? Any feedback is very much appreciated.
  10. Saw it this weekend but didn't get to post it. They sent out an email this morning. End of year Holiday 50% Discount Sale Thank you for your interest in Noritake VFD modules and services. We appreciate your business and want to thank you by providing 50% off Noritake Onlineshop products. Please enter the following coupon code before checkout: EYHD1213 Coupon code will be valid from 12/6/2013 to 1/5/2014 and available for United States and Canada only. Noritake Onlineshop: http://noritake-vfd.com/
  11. Trying to use the SD16_A ADC on the EZ430 F2013. Have two separate issues. (Coded for IAR) The first, am unable to do a single ADC conversion on Channel 7 (the offset checking channel) SD16AE |= INPUT; // Enable P1.6 as A3+ SD16CTL = SD16SSEL1 | SD16VMIDON | SD16REFON; // 1.2v Ref On, SMCLK SD16CCTL0 = SD16OSR_1024; // Set to 1024 Oversample Rate if (offset == 0) { SD16CCTL0 |= SD16DF | SD16SNGL; // Signed, Single Conversion scripted_wait(); // Let Internal Ref Settle SD16INCTL0 = SD16INCH_7; // ADC Channel 7 SD16CCTL0 |= SD16SC; // Trigger Converson while(!(SD16CCTL0 & SD16IFG)); // Wait for Flag offset = SD16MEM0; // Signed value in Offset SD16CCTL0 &= ~SD16DF & ~SD16SNGL; // Clear Signed, Clear Single Conversion } It gets stuck on the while loop. While skipping this (offset = 1), the rest also has an issue. It gets stuck at __low_power_mode_0(); in the main() (Line 153 of the code below). I think I might not be setting the SD16_A or Watchdog ISR correctly, or the correctly handling the lpm0... While debugging, GIE gets cleared and never gets set again, yet the watchdog isr keeps getting handled?? (my count and _10ths_count variables increase as expected). When 10ths_count is higher than 18000, Demo_State is increased to 1, which on the next loop in the While loop, should break it out, and move it to the next state. It is never getting out of the low_power_mode_0 line. I edited the code to slim it down for the forum. I attached the full version below as well. unsigned char Demo_State = 0; unsigned int result = 0; int offset = 0; void adc_init(void) { // If SD_VREF_ENABLE is defined as 1 in the Common.H, P1.3 is enabled as VREF. if (SD_VREF_ENABLE == 1) { SD16AE &= ~SD_VRef; P1SEL |= SD_VRef; } SD16AE |= INPUT; // Enable P1.6 as A3+ SD16CTL = SD16SSEL1 | SD16VMIDON | SD16REFON; // 1.2v Ref On, SMCLK SD16CCTL0 = SD16OSR_1024; // Set to 1024 Oversample Rate if (offset == 0) { SD16CCTL0 |= SD16DF | SD16SNGL; // Signed, Single Conversion scripted_wait(); // Let Internal Ref Settle SD16INCTL0 = SD16INCH_7; // ADC Channel 7 SD16CCTL0 |= SD16SC; // Trigger Converson while(!(SD16CCTL0 & SD16IFG)); // Wait for Flag offset = SD16MEM0; // Signed value in Offset SD16CCTL0 &= ~SD16DF & ~SD16SNGL; // Clear Signed, Clear Single Conversion } // Continious Mode if (Demo_State == 0) { SD16INCTL0 = SD16INCH_3; // P1.6 ADC A3+ SD16CCTL0 |= SD16UNI | SD16IE; } // On-Demand Mode if (Demo_State == 1) { SD16INCTL0 = SD16INCH_3; // P1.6 ADC A3+ SD16CCTL0 |= SD16UNI | SD16SNGL | SD16IE; } // Temperature Mode if (Demo_State == 2) { SD16INCTL0 = SD16INCH_6; // Temperature Sensor SD16CCTL0 |= SD16DF | SD16IE; } } volatile int count = 0; volatile int _10ths_count = 0; bool blink_led0 = 0; void timeDog_init(void) { WDTCTL = WDT_MDLY_0_064; // Happens 15625 times per second! Duh! Every 64 Clock Ticks. DUH! IE1 |= WDTIE; // Enable WatchDog Interrupt } // WatchDog interrupt service routine #pragma vector = WDT_VECTOR __interrupt void WatchDog_ISR(void) { count++; if (count == 1563) { count = 0; _10ths_count++; if (blink_led0 == 1 ) { if (_10ths_count % blink_rate) P1OUT ^= LED0; } } if ( _10ths_count >= (timeout_count * 600) ) { _10ths_count = 0; Demo_State++; if (Demo_State >= 3) Demo_State = 0; // __low_power_mode_off_on_exit(); // Exit LPM at Interrupt End __bis_SR_register_on_exit(GIE); } } int temp = 0; // Port 1 interrupt service routine #pragma vector = PORT1_VECTOR __interrupt void Port_1_ISR (void) { _BIC_SR_IRQ(LPM0_bits + GIE); // Clear LPM, Disable Interrupts to Allow MSP to handle commands before returning to sleep P1IFG &= ~PB; // P1.7 IFG cleared if ( _10ths_count < ( temp + long_press_count) ) { // Button pressed again too soon __bis_SR_register_on_exit(LPM0_bits + GIE); // Return to LPM return; } temp = _10ths_count; _10ths_count = 0; while (_10ths_count == 0); // Wait 1 10ths of a second for Debounce if ( (P1IN & PB) != 0) { // If Button not still pressed, False Trigger __bis_SR_register_on_exit(LPM0_bits + GIE); // Return to LPM } else while ( (P1IN & PB) == 0) { // While Button is Still Pressed if (_10ths_count >= long_press_count) { // Check for Long Press Demo_State++; if (Demo_State >= 0x3) Demo_State = 0; // __low_power_mode_off_on_exit(); __bis_SR_register_on_exit(GIE); return; // If Long Pressed, Break out of Interrupt } } if ( Demo_State == 1 ) { // __low_power_mode_off_on_exit(); __bis_SR_register_on_exit(GIE); return; } else _10ths_count = _10ths_count + temp; // Revert Back to Original 10ths Count __bis_SR_register_on_exit(LPM0_bits + GIE); // Return to LPM } // SD16_ISR #pragma vector = SD16_VECTOR __interrupt void SD16_ISR(void) { switch (__even_in_range(SD16IV, 16)) { case 2: // Handle overflow; break; case 4: result = SD16MEM0 - offset; break; } // __low_power_mode_off_on_exit(); __bis_SR_register_on_exit(GIE); } int main(void) { cpu_init(); led_init(); pushbutton_init(); timeDog_init(); __enable_interrupt(); // Forever Loop while (1) { // Continuous Mode adc_init(); blink_led0 = 1; // Set LED0 to Blink SD16CCTL0 |= SD16SC; // Trigger Sample while (Demo_State == 0) { __low_power_mode_0(); // Sleep Until Done __no_operation(); update_display(); // Display Results } clear_mode(); // On-Demand Mode adc_init(); blink_led0 = 0; // Set LED0 to Not Blink P1OUT |= LED0; // Turn LED0 On while (Demo_State == 1) { // On-Demand Mode Code blink_led0 = 1; // Set LED0 to Blink SD16CCTL0 |= SD16SC; // Trigger Sample __low_power_mode_0(); // Sleep Until Done __no_operation(); blink_led0 = 0; // Results Gathered, Stop Blinking LED0 P1OUT |= LED0; // Leave LED0 On update_display(); // Display Results __low_power_mode_0(); // Sleep until Button Short Press or Long Press __no_operation(); } clear_mode(); // Temperature Sensor Mode adc_init(); blink_led0 = 0; // Set LED0 to Not Blink P1OUT |= LED0; // Leave LED0 Off SD16CCTL0 |= SD16SC; // Trigger Sample while (Demo_State == 2) { __low_power_mode_0(); // Sleep Until Done __no_operation(); update_display(); // Display Results } clear_mode(); } // Forever Loop } main.c common.h
  • Create New...