Jump to content

Search the Community

Showing results for tags 'msp430g2553'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Calendars

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Sparkfun


Github

Found 144 results

  1. arcon19

    ADS1114 with Adafruit1015

    Hello everyone relative noob here. I'm currently trying to use the Adafruit ADS1015 library with a ads1114. I had the single ended read working a few days ago however its no longer working and readADC_SingleEnded locks the loop(). I'm actually using a msp430g2553 with energia, but that doesnt explain why it worked before and no longer does. Has this ever happened to anyone else before? I also posted this on Arduino forums to see if they knew anything about why this is happening. Here is my code. #include <Wire.h> #include <Adafruit_ADS1015.h> //Adafruit_ADS1115 ads; /* Use this for the 16-bit version */ float voltage = 0.0; void setup(void) { Serial.begin(9600); Serial.println("Hello!"); Serial.println("Getting single-ended readings from AIN0..3"); Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)"); // The ADC input range (or gain) can be changed via the following // functions, but be careful never to exceed VDD +0.3V max, or to // exceed the upper and lower limits if you adjust the input range! // Setting these values incorrectly may destroy your ADC! // ADS1015 ADS1115 // ------- ------- // ads.setGain(GAIN_TWOTHIRDS); // 2/3x gain +/- 6.144V 1 bit = 3mV 0.1875mV (default) // ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V 1 bit = 2mV 0.125mV // ads.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 1mV 0.0625mV // ads.setGain(GAIN_FOUR); // 4x gain +/- 1.024V 1 bit = 0.5mV 0.03125mV // ads.setGain(GAIN_EIGHT); // 8x gain +/- 0.512V 1 bit = 0.25mV 0.015625mV // ads.setGain(GAIN_SIXTEEN); // 16x gain +/- 0.256V 1 bit = 0.125mV 0.0078125mV Wire.begin(); } void loop(void) { int16_t adc0; // adc1, adc2, adc3; Serial.print("AIN0: "); Serial.println(adc0); adc0 = readADC_SingleEnded(0); voltage = (adc0 * 0.1875)/1000; Serial.print("AIN0: "); Serial.println(adc0); Serial.print("\tVoltage: "); Serial.println(voltage, 7); Serial.println(" "); delay(200); } uint8_t m_i2cAddress=0x48; uint8_t m_conversionDelay=8; uint8_t m_bitShift=0; adsGain_t m_gain; int16_t readADC_SingleEnded(uint8_t channel) { // Start with default values uint16_t config = ADS1015_REG_CONFIG_CQUE_NONE | // Disable the comparator (default val) ADS1015_REG_CONFIG_CLAT_NONLAT | // Non-latching (default val) ADS1015_REG_CONFIG_CPOL_ACTVLOW | // Alert/Rdy active low (default val) ADS1015_REG_CONFIG_CMODE_TRAD | // Traditional comparator (default val) ADS1015_REG_CONFIG_DR_1600SPS | // 1600 samples per second (default) ADS1015_REG_CONFIG_MODE_SINGLE; // Set PGA/voltage range config |= m_gain; Serial.println("Config is set "); // Set single-ended input channel switch (channel) { case (0): config |= ADS1015_REG_CONFIG_MUX_SINGLE_0; break; case (1): config |= ADS1015_REG_CONFIG_MUX_SINGLE_1; break; case (2): config |= ADS1015_REG_CONFIG_MUX_SINGLE_2; break; case (3): config |= ADS1015_REG_CONFIG_MUX_SINGLE_3; break; } // Set 'start single-conversion' bit config |= 0x8000; Serial.println("Single conversion bit set"); // Write config register to the ADC writeRegister(m_i2cAddress, ADS1015_REG_POINTER_CONFIG, config); Serial.println("register has been written"); // Wait for the conversion to complete delay(m_conversionDelay); Serial.println("conversion delay is over"); // Read the conversion results // Shift 12-bit results right 4 bits for the ADS1015 Serial.println("Returning the registers read"); return readRegister(m_i2cAddress, 0x00) >> m_bitShift; } byte test; static void writeRegister(uint8_t i2cAddress, uint8_t reg, uint16_t value) { Serial.println("Beginning i2c transmission"); Wire.beginTransmission(i2cAddress); Serial.println("Writing to register"); Wire.write((uint8_t)reg); Serial.println("Writting 8 bit shift"); Wire.write((uint8_t)(value>>8)); Serial.println("writing end value"); Wire.write((uint8_t)(value & 0xFF)); Serial.println("End of transmission"); test = Wire.endTransmission(true); Serial.println(test); } int16_t readRegister(uint8_t i2cAddress, uint8_t reg) { Serial.println("Reading from register"); Wire.beginTransmission(i2cAddress); Serial.println("Returning the registers read"); Wire.write((uint8_t)0x00); Wire.endTransmission(); Serial.println("requesting from i2c the registers read"); Wire.requestFrom(i2cAddress, (uint8_t)2); return ((Wire.read() << 8) | Wire.read()); } EDIT: So i figured out it has something to do with register writing Wire.endTransmission(); within the writeRegister call of the ADS1115 library, im not sure why. Thanks.
  2. This is a very simple enc28j60 library created by Renato Aloi for atmega modifed by me for MSP430G2553 and MSP430F5529 Please, check my latest master fork from Renato Aloi newMods branch or download directly v0.4.2: EtherEncLib-0.4.2.zip fix CS, fix examples, disable debug from tcpstack EtherEncLib-0.4.zip only harware SPI version (MSP430G2553 and MSP430F5529 tested) EtherEncLib_v03.zip - hard/soft spi version EtherEncLib_v2.zip - hardware spi version EtherEncLib_v01.zip - softspi version v03: selectable hardware/software spi all definitions moved to EtherEncLib.h lines 17,18 -> select between hard/soft spi lines 21,23-25 -> SPI pins definition for MSP430 lines 28,30-32,34 -> SPI pins definition for Stellaris & Tiva(?) v02: hardware spi version enctypes.h file contains CS pins definition (lines 247, 250) v01: init version At this moment, after my quick mod, spi communication work on softspi (shiftOut/shiftIn) and replace strange arduino access via registers like SPDR etc... So...shiftOut/shiftIn are not so fast enctypes.h file contains pins definition (lines 247-259) description from EtherEncLib.cpp file:
  3. I'm trying to understand the comparator A+ and Timer capture mode for using honeywell SM351LT sensor. Can't quite seem to bind it together. Sensor is currenlty hooked up with permanent power supply. Comparator output on P1.7 is tied to an led and works pretty much as expected. Furthermore hardware pwm is running on P1.6 with ACLK at 32.768Khz crystal to stay in LPM3. If I put an led on this pin it light up briefly as expected. If I understand correctly the sensor should be powered on CCR0; Read Comparator at CCR1 after minimum 10us. printf reveals indeed 50 cycles between CCR0 and CCR1. If I use P1.6 to power sensor, it's not giving any reading at CCR1. Are the timer(s) (TIMER0_A0/TIMER0_A1) misconfigured perhaps? Then there are some options/settings to bind comparator to compare timer. TA0CCTL1 |= CCIS_1; //Capture CCI1B TA0CCTL1 |= SCS; //Capture sychronize TA0CCTL1 |= CAP; //Capture mode Cannot seem to figure out how to implement these? Wondering if this is the right approach at all? Any help/hints appreciated. There's some links in the attached file I found on the subject. main.c
  4. testhack

    Interrupt Debounce

    I am trying to write a simple button interrupt debounce routine without much success. I am seeing unexpected interrupts occurring. The logic I am using is to disable the button interrupt when first pressed and then re-enabling it when the watch dog timer expires. I have tried increasing the wdt interval but the momentary switch button is still bouncing and simply fires the button interrupt unexpectedly. I know I can write other debounce routines but I would like to stay out of polling or looping for low power reasons if at all possible. I am not sure if the issue is something with the wdt so I am also looking at using timerA instead of the wdt. Thanks for any guidance/suggestions. #include <msp430g2553.h> #define BUTTON BIT3 //0x08 int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer P1REN |= BUTTON; // enable pull up resistor on P1.3 button P1DIR |= 0x01; // Set P1.0 to output direction P1IE |= BUTTON; // P1.3 interrupt enabled P1IES |= BUTTON; // P1.3 Hi/lo edge P1IFG &= ~BUTTON; // P1.3 IFG cleared - set to correct state first time __enable_interrupt(); // enable all interrupts while(1) { //check flags set by interrupts here, do something, clear flag } //return 0; } // Port 1 interrupt service routine #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { //__bic_SR_register_on_exit(LPM4_bits); // clear original LPM4 Bit to wake up clocks and cpu P1IFG &= ~BUTTON; // Clear the interrupt flag for the button P1IE &= ~BUTTON; // Disable Button interrupt //WDTCTL = WDT_MDLY_32; // Set watchdog timer (WDT) to trigger every 32ms WDTCTL = WDT_ADLY_1000; IE1 |= WDTIE; // enable WDT interrupt P1OUT ^= 0x01; // P1.0 = toggle (toggle led) } // WDT Interrupt Service Routine used to de-bounce button press #pragma vector=WDT_VECTOR __interrupt void WDT_ISR(void) { IE1 &= ~WDTIE; // disable Watchdog timer (WDT) interrupt IFG1 &= ~WDTIFG; // clear WDT interrupt flag WDTCTL = WDTPW + WDTHOLD; // put WDT back in hold state P1IE |= BUTTON; // Reenable interrupts for the button }
  5. Hi All, Somehow I've made a stupid mistake with this weather thingie I put together and I can't figure out what's wrong. I need your help! Project description: Weather thingie - Reports temperature, humidity and light readings via bluetooth. Operation is simple, connect to the device and it will report something like "27 C 57 H 96 L\r\n" ~ every second. The LED on board will alternate state every second. I set this up on a breadboard before making the PCB as I was not familiar with the DHT11 or and quirky requirements it might have. The project worked fine on the breadboard. I suspect I have either a PCB design fault or defective components? Perhaps? I dunno. TIA 0xFFFF main.c
  6. sven222

    Very accurate timer

    Hello all together, I need a very accurate timer for a midi clock. For that reason I need a timer, that is giving me for every beat 24 beats back. At hte same time, I need a serial connection with 31250baud. My question is now, how do I get a very, very accurate timer. The timer quarz is normaly 32768, and this is maybe a little bit to slow, becaus I want my bpm with one digit after the point like 121,1bpm. I have a MSP430G2553. Can I connect a 1MHz or even a 4MHz cristal to the
  7. A Short introduction on Programming ADC10 of MSP430 Launchpad and Displaying the ADC10 values on a LED Bar graph type Display. Full Tutorial can be found here
  8. Hi everyone! I am trying to get a PAC1710 chip as a slave working with the MSP430G2553. I am having a ton of trouble doing so and can't seem to even get the address of the slave for the msp. I am going off of the master_reader code as an example. My first question is I know that you need to give the slave an address but I am not sure how to do so. On the data sheet of the pac1710, the address is as follows - 0011000. Thanks!
  9. Fmilburn

    [POTM] Blue Angels F-18 Costume

    This project is a submission for the 2015 Project of the Month Halloween contest. It came about as a request from my four year old grandson after he had seen the Blue Angels fly over during Seafair in Seattle. The basic air frame was constructed from two cardboard boxes as shown in the photograph below. . The boxes are attached to each other with brads and hot glue. Edges are reinforced where I felt necessary by folding extra cardboard over or gluing in reinforcement cardboard. Also shown in the photograph above are the following: wings, tail, and fins constructed from a corrugated plastic storage box and hot glued in place reflector on the nose constructed from a coffee can bottom which will eventually become the "search light". There is a similar reflector on the tail which will become the jet exhaust. control panel with various switches and a potentiometer I had in my junk box installed on a wooden paint stirring stick The visible surfaces were then covered with wrapping paper using Outdoor Mod Podge - a waterbased sealer, glue and finish available in craft stores in the United States. A second coat was then put on to make it a bit more waterproof. This is the schematic for the avionics. A little custom MSP430G2553 board with two AA batteries beside it in the tail controls an Adafruit neopixel ring "jet exhaust" with a toggle switch on the panel to turn it on and off. Everything else runs off of three AA batteries with the wiring in the front of the aircraft between a cardboard firewall and the nose. Two latching buttons turn colored LEDs on the panel on and off while a third turns a 3W LED (searchlight) on and off. There is a potentiometer to control the brightness of the searchlight. Finally I repurposed the sound board and speaker from an old greeting card that was originally powered by a coin cell. The WS2812 Adafruit Neopixel ring is controlled by the MSP430G2553. I used the library posted by ILAMtitan at 43oh - so full credit to those who had a hand in developing it. The library example worked well as is for my purposes and about the only thing I changed was the output pin and the number of pixels being controlled in the code. Here is a picture of my grandson trying it out. We glued plastic cups over the headlight and jet exhaust and stuck Energia stickers on it. I may touch it up a bit more if I have time and post a final picture. Improvement Ideas: I also made a "candy counter" out of an old scale for his entertainment (and mine). His immediate reaction was that we should somehow attach the candy counter to the airplane. Clever, but not practical due to the need for the scale to be level and not banged around by a four year old. Using a counter where candy is funneled past a beam, like Chicken did with his counter might work though. My idea is that we add GPS along with thumbs up/down buttons. Then he could rate offerings and either store the data as a reminder for next year or send it out over the IOT with location so that his buddies know where the good candy is.
  10. Fmilburn

    MCP3008 ADC Library

    The MCP3008 is an easily used 10bit, 8 channel, Serial Peripheral Interface (SPI) Analog to Digital Converter. I created an Energia library that can be found here and used to read any of the eight pins with a single call. Conversion is done for voltages between 0 and 3.3 V, including on the CC3200, and results in a integer reading between 0 and 1023. This library is for single ended operation only and uses hardware SPI. An example is included that demonstrates reading from all 8 channels. Tested with Energia 0101E0016 on the following LaunchPads * CC3200-LAUNCHXL Rev 4.1 (80 MHz) EMT * CC3200-LAUNCHXL Rev 4.1 (80 MHz) * MSP-EXP432P401R (48 MHz) EMT * MSP430F5529 Rev 1.5 (25 MHz) * MSP-EXP430FR5969 Rev 2.0 (16 MHz) * MSP-EXP430G2553 Rev 1.5 (16 MHz)
  11. SureshBonagiri

    DHT11 sensor reading under timer ISR

    Hi all, I am facing problem while reading DHT values in timer ISR function. I am able to get the data if use i dht.readHumidity() (using dht library) in loop function but not able to get when i use in timer ISR function. Can anyone please help me out. Thanks in Advance.
  12. Hi all I am new to energia and need some help in writing a code into msp430G2553 by using timer interrupt Here what i am trying is taking the analog input from a sensor but using external interrupt and i want this using timer interrupt but i don't know how to do.. Please need ur help. Thank u.
  13. Last updated: May 07, 2015 May 07: added SBM-20 background CPM value vs 1kg potassium salt and python code to log the data. April 26: added deadtime image. April 23: updated to 75
  14. Hey forum! I always wanted to make a synthesizer , so i chose the msp430 launchpad, because it's one of the most inappropriate chip i can use for it :grin: When i started to make it i didn't have real goal, i just wanted to make a sound, so this project is kind if all over the place but i have learned a lot doing it so it was totally worth it. The DAC used is a TI TLC5615, it's not the best choice, but i only had this in my parts bin. Probably any other SPI DAC could be used with minimal modification, or even PWM. (I don't sound good with PWM IMO.) The TLC5615 needs 5 volts, but it seem to run good with 3.6 volt from the launchpad,or you could use TP3 (the USB 5V) but that can be noisy, I used a separate 5V supply. The crystal is required, because it tunes the DCO on every start up to a pre-defined value ( i ran it at 19Mhz without any problems) If you change the frequency , you only need to change the bit rate divider for the USCI UART. There are a lot to optimize/rewrite but i kind of grew tired of playing with variables to get a few more bytes of free ram. Maybe i'll rewrite it on an F5510 as it would be a much better choice because it has 8 x Ram as much ram and a hardware multiplier. This is a synth with 16 voice of polyphony. It accepts midi massages from 1-8 and 10 (for the drum sounds). Each midi channel has it's own different settings for: -MIDI program -LFO width and speed (CC01 for combined mod wheel control, CC02 for width,CC03 for speed -Oscillator type (simple with any waveform or with ADSR square or sine wave) -Pitch bend -Portamento on/of (CC65) -Portamento speed (CC05) -Channel volume (CC07) It plays 8 sine/square with ADSR, 4 with any waveform (now only Saw and triangle), and 4 drum sounds simultaneously. Here are two songs i recorded with it: Soundcloud. I have attached the CCS Project with the source codes in a ZIP, the schematics, and a picture of how it look on my breadboard. mSpYNTH.zip mysy
  15. Hi, I am trying to operate a 3V relay (from OMRON) using MSP430G2553. The relay is a SPDT one, with 6 PINs. I am not quite sure how to wire a6 PIN relay (I have some experience with 5 PIN SPDT relay), and I cannot find much information in the internet. I was also told that, for driving a 3V relay, I would not require transistor + diode combination. For your information, the relay has a rated coil current of 50 mA. Can anyone help me on understanding the wiring structure of the relay? How to interface it with MSP430? Also, is it true that, I can operate the 3V relay without separate transistor + diode combination? I do not have much experience in microcontroller, particularly in MSP430 platform. Any suggestion is welcome. Thank you in advance for your support.
  16. Hello, I bought a Sparkfun ML8511 UV sensor breakout and set it up according to this. It kind of works / I have a weird problem: No matter the voltage (3V or 3.3V), the sensor output values change periodically very strongly: Closer to UV-AB source: ~1.5 to ~10.5 to ~1.5 and so on (with more steps in between) (distance of course doesn't change). More away from the UV source: ~0.2 to ~1.5 to ~0.2 and so on. When I attach a 1.5V battery constant voltage source as a test, the displayed value is indeed rather constant ranging from 4.39 to 4.59, so it must be the sensor's problem? Google-ing this problem didn't reveal any results. I tried using A0 and (A1-A5) because of possible noise? but this unfortunately didn't help. I'm using a MSP430G2553 and its ADC10, on a breadboard. Is this a known problem of such a setup?
  17. Dear Sir/Madam, I am trying to use MSP430 to talk with a wifi module using UART, technically, the msp430G2553 does not need to know the ip address for the wifi module, so the wifi module can be considered as another mcu. I have done the hardware and the calculation of voltage received and also converted to a string value. I can also read the values using hardware UART on serial monitor, but I now wants to send the results to the wifi module and check if the wifi module receives it on socket tools. My code are as below: #include <SoftwareSerial.h> // to the pins used: const int analogInPin = P1_4; //Analog input pin that the output from the current sensor is attached to const int txPin = P1_1;// TXD const int rxPin = P1_2;//RXD SoftwareSerial mySerial(P1_2,P1_1); // I defined a new serial using .....//some definitions here cut that for your easier to read and hopefully help !! void setup() { //initialize serial communications at 9600bps: Serial.begin(9600); mySerial.begin(57600); pinMode(analogInPin,INPUT); } void loop() { // put your main code here, to run repeatedly: //read the analog in value: ............... something here to read and calculate //convert to String //char str[5]; //sprintf(str, "%.2d", current); char curr[6]; itoa(int((current*10+5)/10),curr,10); //int dec = (current - (int)current)*100; //itoa(abs (dec) , buffer, 10); char pow[6]; itoa((power*10+5)/10,pow,10); Serial.println(curr); if (Serial.available()) { mySerial.write(Serial.read()); } } Thank you so much if you can help!
  18. Hi, I'm trying to read analog values from a SHARP IR sensor GP2Y0A41SK0F using the MSP430F5529 launchpad. There was not any error when I verified and uploaded the codes in Energia. However, when I clicked on the Serial Monitor, nothing showed up. But when I chose the MSP430G2452 from the "Tools" menu, the monitor successfully showed the analog values. I connect Vcc (red wire) to 5 V pin, the ground (black wire) to GND pin, and the analog output (white wire) to P6.4 pin/A4 pin. The same thing also happened to the MSP430G2553 launchpad. It only works when MSP430G2452 is selected. I looked at the codes very thoroughly but I couldn't see any mistakes: const int IR = A4; void setup() { Serial.begin(9600); } void loop() { int maxVal = 0, minVal = 1024, n=200; float x_i, total=0, mean; for (int i=1; i <= n; i++) { x_i = analogRead(IR); total += x_i; Serial.println(x_i); if (x_i < minVal) { minVal = x_i; } if (x_i > maxVal) { maxVal = x_i; } } mean = total / n; Serial.print("minimum = "); Serial.print(minVal); Serial.print(", maximum = "); Serial.print(maxVal); Serial.print(", total = "); Serial.print(total); Serial.print(", mean = "); Serial.println(mean); delay(100); }
  19. Someone can helpme, i'm taking incorrect readings of a magnetometer I believe with the problem are in my i2c code implementation. /* * Print all printable characters on usb channel using UART mode of USCI module * the print is based in busy wait to transfer characters */ #include "msp/msp430g2553.h" void configureDCO(); void configureUART(); void putc(char); void print (const char[]); void print (short); void printStatus(); main() { configureDCO(); configureUART(); UCB0CTL1 = UCSWRST; //Reset USCI UCB0CTL0 = // USCI_B0 control register UCMST // set master mode | UCMODE_3 // I2C mode select | UCSYNC; // synchronous UCB0CTL1 = // UCSI_B0 control register UCSSEL_2 //select clock source, SMCLK | UCSWRST; UCB0I2CSA = 0x1e; // write desired slave address to the UCBxI2CSA, magnetometer address // prescaler to generate 75 Hz (1MHz of SMCLK / 13981 of prescaler) UCB0BR0 = 0x9D; UCB0BR1 = 0x36; //configure ports P1SEL |= BIT6 | BIT7; P1SEL2|= BIT6 | BIT7; UCB0CTL1 &= ~UCSWRST; // Initializate USCI print("[system] I2C configured\r\n"); // send start to transmit UCB0CTL1 |= UCTR // setting UCTR for transmitter mode | UCTXSTT; // setting UCTXSTT to generate START condition // point to register A ( address 0x00 ) while ( !(IFG2 & UCB0TXIFG) ); // wait UCBxTXIFG are set, when set the buffer are empty UCB0TXBUF = 0x00; // load data to be trasmitted on UCBxTXBUF // write 0x78 in register A, mean of eight measurements, 75 Hz sample rate while ( !(IFG2 & UCB0TXIFG) ); // wait UCBxTXIFG are set, when set the buffer are empty UCB0TXBUF = 0x78; // load data to be trasmitted on UCBxTXBUF // point to register B ( address 0x01 ) while ( !(IFG2 & UCB0TXIFG) ); // wait UCBxTXIFG are set, when set the buffer are empty UCB0TXBUF = 0x01; // load data to be trasmitted on UCBxTXBUF // write 0xa0 in register B, gain five while ( !(IFG2 & UCB0TXIFG) ); // wait UCBxTXIFG are set, when set the buffer are empty UCB0TXBUF = 0xa0; // load data to be trasmitted on UCBxTXBUF // point to mode register ( address 0x02 ) while ( !(IFG2 & UCB0TXIFG) ); // wait UCBxTXIFG are set, when set the buffer are empty UCB0TXBUF = 0x02; // load data to be trasmitted on UCBxTXBUF // write 0x00 in mode register, continuous operation while ( !(IFG2 & UCB0TXIFG) ); // wait UCBxTXIFG are set, when set the buffer are empty UCB0TXBUF = 0x00; // load data to be trasmitted on UCBxTXBUF // send stop UCB0CTL1 |= UCTXSTP; // send stop while (UCB0CTL1 & UCTXSTP); // wait STOP condition is ack __delay_cycles(6000); // wait 6ms, until change the settings of magnetometer // send start to receive UCB0CTL1 &= ~UCTR; // setting UCTR for receiver mode UCB0CTL1 |= UCTXSTT; // setting UCTXSTT to generate START condition while (UCB0CTL1 & UCTXSTT); // infinit loop, show continually the measuread values while (true) { // allocate space to the measured values, (x,y,z) coordinates, high byte (h prefix), low byte (l prefix) char hx, lx, hz, lz, hy, ly; // receive data output X MSB register while (!(IFG2 & UCB0RXIFG) ); // wait UCBxRXIFG are set, when set read buffer are full hx = UCB0RXBUF; // load data from buffer to local memory // receive data output X LSB register while (!(IFG2 & UCB0RXIFG) ); // wait UCBxRXIFG are set, when set read buffer are full lx = UCB0RXBUF; // load data from buffer to local memory // receive data output Z MSB register while (!(IFG2 & UCB0RXIFG) ); // wait UCBxRXIFG are set, when set read buffer are full hz = UCB0RXBUF; // load data from buffer to local memory // receive data output Z LSB register while (!(IFG2 & UCB0RXIFG) ); // wait UCBxRXIFG are set, when set read buffer are full lz = UCB0RXBUF; // load data from buffer to local memory // receive data output Y MSB register while (!(IFG2 & UCB0RXIFG) ); // wait UCBxRXIFG are set, when set read buffer are full hy = UCB0RXBUF; // load data from buffer to local memory // receive data output Y LSB register while (!(IFG2 & UCB0RXIFG) ); // wait UCBxRXIFG are set, when set read buffer are full ly = UCB0RXBUF; // load data from buffer to local memory // compose (x, y, z) values short x, y, z; x = (static_cast<short>(hx) << 8) | lx; // compose x MSB and LSB z = (static_cast<short>(hz) << 8) | lz; // compose z MSB and LSB y = (static_cast<short>(hy) << 8) | ly; // compose y MSB and LSB //print (x, y, z) measured values print("( "); print(x); print(", "); print(y); print(", "); print(z); print(" )"); print("\r\n"); } } void configureDCO() { WDTCTL = WDTPW + WDTHOLD; // Stop WDT // Set DCO to 1MHz BCSCTL1 = CALBC1_1MHZ; DCOCTL = CALDCO_1MHZ; __delay_cycles(1000000); } void configureUART() { UCA0CTL1 |= UCSWRST; // put USCI in reset mode // P1.1 = RXD, P1.2=TXD P1SEL |= BIT1 | BIT2; P1SEL2 |= BIT1 | BIT2; UCA0CTL1 |= UCSSEL_3; // Use SMCLK // Set baud rate to 9600 with 1MHz clock (Data Sheet 15.3.13) 1MHz / 104 UCA0BR0 = 104; UCA0BR1 = 0; UCA0MCTL = UCBRS0; // Modulation UCBRSx = 1, correction for the fractional part ( the rest, 9600 - 1MHz / 104) UCA0CTL1 &= ~UCSWRST; // put USCI in operad mode (removing reset mode) /*End configuration hardware UART */ print("[system] uart configured\r\n"); }; void putc(char ch) { while(!(IFG2 & UCA0TXIFG)); UCA0TXBUF = ch; } void print (const char msg[]) { for (int i = 0; msg[i] != '\0'; ++i) putc(msg[i]); } void print (short value) { if (value == 0) { putc('0'); return; } if (value < 0) { putc('-'); value *= -1; } unsigned int size; char buffer[20]; for (size = 0; value; ++size, value /= 10) buffer[size] = value % 10; while (size) putc(buffer[--size] + '0'); } void printStatus() { print("Status:\n\r"); #define __PRINT_STATUS(X, MSG) if (UCB0STAT & X) print(#MSG "! "); __PRINT_STATUS(UCNACKIFG, nack); __PRINT_STATUS(UCALIFG, arbitration lost); __PRINT_STATUS(UCGC, receive general call); __PRINT_STATUS(UCBBUSY, bus busy); __PRINT_STATUS(UCSCLLOW, SCL low); __PRINT_STATUS(UCSTPIFG, stop received); __PRINT_STATUS(UCSTTIFG, start received); print("done\n\r"); } Please this is a old problem, someone can helpme? David Kennedy S. Araujo Computer Engineering Student (PUC GO)
  20. Hey Guys, I am new user of Energia. Currently, I am using MSP430G2553 chip to write data in SD card. I found code that works on USCIB0 SPI communication. Here is the link for the code. This code works completely fine. But, I wanted to know how can I change the code to use USCIA0 SPI instead of USCIB0 to do this? I tried going into pins_energia.h and just changing the pins. But it didn't work. Can anybody help me with this problem? Here is port assignment for different SPI buses USCIB0: (Code is using it) P1.6 -> master in slave out (MISO) P1.7 -> master out slave in (MOSI) P1.4 -> slave transit enable P1.5 -> clock input USCIA0: (This is what we want to use) P1.1 -> master in slave out (MISO) P1.2 -> master out slave in (MOSI) P1.5 -> slave transit enable P1.4 -> clock input
  21. Hi, everyone. I want to do a light web server (show temperature value and port control) with MSP430g2553 and ENC28j60 Breakout Module. At this forum, there are many examples about this issue using Energia lib. But I want to use IAR Embedded Workbench as IDE, not using Energia lib.So probably MSP430 and ENC28j60 communicate using SP?. How I do this project at IAR Embedded Workbench.Thank you
  22. Hi guys. For those who like 7-segment led displays, here is easy to use booster pack with digits! It has driver ic to control display and read buttons using I2C. Also is can be topped up with on board EEPROM, TMP102 sensor, Seiko RTC Crystal and 3.3V regulator. And this booster pack can be used standalone also. If you like it and want to get one, please support at Tindie.com Pictures are from prototype.
  23. stasundr

    msp430g2553 goes crazy

    Hi, everyone! (I'm completely newbie, so excuse me if my questions are stupid) I made my first "device" (pic related). It works fine for a short period of time (like an hour or something like that), but then it goes crazy: led start blinking all the time and device don't respond when I change temperature. Could you please tell me, what's wrong? (I tried both - CR3024 battery and 3.3V power supply) #include <msp430.h> #include <RTCplus.h> RealTimeClock rtc; //initialise the global RealTimeClock instance int sensorPin = A3; // select the input pin for the potentiometer int ledPin = P1_1; // select the pin for the LED int sensorValue = 0; #ifdef RTCWITHDATE const char Months[]="JanFebMarAprMayJunJulAugSepOctNovDec"; #endif void DisplayTime() //routine to format & print the time to the serial port { #ifdef RTCWITHDATE const char * MonthText; #endif if (rtc.RTC_hr<10) Serial.write('0'); Serial.print(rtc.RTC_hr); Serial.write(':'); if (rtc.RTC_min<10) Serial.write('0'); Serial.print(rtc.RTC_min); Serial.write(':'); if (rtc.RTC_sec<10) Serial.write('0'); Serial.print(rtc.RTC_sec); #ifdef RTCWITHDATE MonthText=Months+(rtc.RTC_month-1)*3; Serial.write(32); if (rtc.RTC_day<10) Serial.write(32); Serial.print(rtc.RTC_day); Serial.write(32); Serial.write(*(MonthText)); Serial.write(*(MonthText+1)); Serial.write(*(MonthText+2)); Serial.write(32); Serial.print(rtc.RTC_year); #endif Serial.println(" "); } void setup() { Serial.begin(9600); //initialise Serial pinMode(ledPin, OUTPUT); rtc.begin(); //initialise the RTC rtc.Set_Time(23,59,0); //Set the time to 23:56 #ifdef RTCWITHDATE rtc.Set_Date(2013,2,28); //Set the date to 28 Feb 2013 #endif }; void loop() { DisplayTime(); //call our routine that outputs the time digitalWrite(ledPin, LOW); if (rtc.RTC_min < 5) { // CRYSTAL TEST //digitalWrite(ledPin, HIGH); //delay(25); //digitalWrite(ledPin, LOW); //delay(1975); } else { // THERMISTOR TEST sensorValue=analogRead(sensorPin); digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level) delay(25); digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW delay(sensorValue); }; }; RTC_ISR(void) { rtc.Inc(); // Update chunks }; (The overall purpose of this device is just to log temperature on SD card)
  24. Hi Everyone, I am using LED blinking program of Arduino on MSP430. I have configured compilers etc. Now the led turns on but it is not blinking. I have tried changing delay/sampling rate. Can someone point me the issue here?
  25. rdufrene

    MSP430 Nothing on Serial Monitor

    Hello, I am trying to have my MSP430G2553 on a launchpad (Rev.1.5) show anything on the serial monitor using the following code: void setup() { Serial.begin(9600); } void loop() { Serial.println("Test"); delay(1000); } I have downloaded the drivers http://energia.nu/Guide_Windows.html I have switched the jumpers http://energia.nu/img/LaunchPadMSP430G2553-V1.5.jpg I'm just not sure what is wrong. I can load the Blink example and get it to work and even making it do other things but when it comes to reading values and serial the launchpad doesn't want to do anything.
×