Jump to content

Search the Community

Showing results for tags 'MSP430'.



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.


Found 282 results

  1. Hello, I'm using energia 1.6.10E18 with the launchpad MSP430G2 and the MSPG2553 installed. So I saw that in another forum the library from cactus.io was used for the BME280. That library was for the I2C. Now I want to use the SPI library and they had one.(http://cactus.io/hookups/sensors/barometric/bme280/hookup-arduino-to-bme280-barometric-pressure-sensor-spi). So I installed the library changed it to hardware SPI with the cs pin on P2_1. And it compiled, but i'm only getting these results: 813.81 mb 100.00 % 0.00 *C 32.00 *F 813.81 mb 100.00 % 0.00 *C 32.00 *F 813.81 mb 100.00 % 0.00 *C 32.00 *F 813.81 mb 100.00 % 0.00 *C 32.00 *F It looks like the msp430 is not getting any data in/out. I probed the SPI connections with my oscilloscope en there is literally nothing happening. While with the basic example sketch I can clearly see what code is sending. Can anyone help me understand this problem and hopefully fix this. I want the SPI connection to work because I want the nrf24l01 and BME280 working side by side. The msp430 can't do SPI and I2C together like an arduino so you need to chose between them. This is the code I'm using and the library on the website. #include <SPI.h> #include "cactus_io_BME280_SPI.h" #define BME_CS P2_1 BME280_SPI bme(P2_1); void setup() { Serial.begin(9600); Serial.println("Bosch BME280 Pressure - Humidity - Temp Sensor | cactus.io"); if (!bme.begin()) { Serial.println("Could not find a valid BME280 sensor, check wiring!"); while (1); } Serial.println("Pressure\tHumdity\t\tTemp\ttTemp"); } void loop() { bme.readSensor(); Serial.print(bme.getPressure_MB()); Serial.print(" mb\t"); // Pressure in millibars Serial.print(bme.getHumidity()); Serial.print(" %\t\t"); Serial.print(bme.getTemperature_C()); Serial.print(" *C\t"); Serial.print(bme.getTemperature_F()); Serial.println(" *F"); // Add a 2 second delay. delay(1000); //just here to slow down the output. }
  2. CoRTOS: An open source minimalist RTOS

    CoRTOS is a Cooperative Real Time Operating System for bare-metal applications. Its advantages over other systems are that it is fully documented with a manual and examples, is easy to understand and use and is astonishingly simple: The kernel is just 16 lines of C. The CoRTOS module compiles to ~200 bytes of code. The system includes optional modules implementing delays, timers, messaging, mutexes and signaling. It is intended for smaller microprocessors, such as the MSP430, Cortex M0+, AVR and PIC24, and for smaller systems of maybe a dozen tasks. CoRTOS is not a task scheduler. CoRTOS works like any other RTOS. Tasks schedule themselves, picking up where they left off after making a call to the OS. Please feel free to send questions to nolindan@ix.netcom.com The intended audience includes: • Those needing a small footprint RTOS; • Students learning about real time systems; • Makers wanting to program "close to the metal" Features World's simplest RTOS CoRTOSV1d.zip
  3. Hello, I'm using IRremote library and IRrecvDemo is working perfectly, however IRsendDemo is not working. I've commented out these lines in IRremote.cpp //pinMode(TIMER_PWM_PIN, OUTPUT); //digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low and removed the if (Serial.read() != -1) condition, but it is still not working. Do you have any idea what might be the problem? Thanks.
  4. Hello, I'm using IRremote library and IRrecvDemo is working perfectly, however IRsendDemo is not working. I've commented out these lines in IRremote.cpp //pinMode(TIMER_PWM_PIN, OUTPUT); //digitalWrite(TIMER_PWM_PIN, LOW); // When not sending PWM, we want it low and removed the if (Serial.read() != -1) condition, but it is still not working. Do you have any idea what might be the problem? Thanks.
  5. msp430g2553 with cc1101

    Hi All, I am trying to create a transmitting and receiving node. My setup is as follows My transmitting node #1 is mbed-K64F with cc1101.(working fine sending data) My transmitting node #2 is msp430g2553 with cc1101.(giving me challenges) My receiving node is mbed-lpc1768 with cc1101 (working fine and received data from node #1) my connection for msp430 are as follows: csn is at pin 8 sck is at pin 7 mosi is at pin14 miso is at pin 15 I just declare csn as output, the rest of the pins i assume gets configured when we call spi.begin()? I imported the cc1101 library from mbed and managed to convert and compile it without errors. However I am still struggling to send the message to receiving node. My logic is as follows: initialize SPI library (1 MHZ of frequency,SPI msb datamode and SPI_mode0) initialize registers of cc1101 send data after every 4 seconds I used Serial.println to debug my program and I can see it is calling the spi_send function in usci_spi.cpp file but i cant see any packet in the receiving end. Almost same logic and code is running on k64f, even my print statements are giving me same values of registers,addresses and data. But msp430 is not sending data mbed-k64f is sending data. Anyone got a joy to successfully sending the data with msp430g2553 please help!!! I have also attached my cc1101.h/cpp files. Please feel free to have a look and let me know if I am doing anything wrong. thanks in advance, Zain CC1101.cpp CC1101.h
  6. Hello ,I'm using MSP430F5131 Microcontroller of TI.I also use a MSP-FET Emulator in order to program that device.i have written a code in Code Composer Studio (Defined the properties of CCS's project to the devices im using).I compiled the program and no errors has found.Then i connected the MSP-FET to the board according to the datasheet SLA138H , page 26 . (The board supplies the 3.3V so i connected it to pin 4 in the JTAG connector of the MSP-FET). I didn't connect the TEST/VPP and didnt connect the the resistor R2 330Ohms as instructed in that datasheet coz i dont need to use the fuse blow protection functionality.My problem occurs when i try to download the program to the MSP430 device , when i hit on the downloading button an error message pops up :"Error connecting to the target: Unknown device".I tried to do the same in IAR Embedded Workbench (Same code , same properties) it asks me to update my firmware of the MSP-FET i click ok and it updates the firmware , but then i get the same error as i have got in the Code Composer Studio : "Tue May 01, 2018 11:08:46: Fatal error: Could not find device (or device not supported) Session aborted! "It is needed to be said that when i hit on the download button the "MODE" red led on the MSP-FET flashes and then stays on after the error message has been popped.I tried to get the 3.3V supply voltage for the downloading purposes from the MSP-FET (JTAG pin 2) and it still doesn't work and get the same error.I also made sure that the MSP430 gets the amount of voltage its needed (3.3V from the board by a regulator).I would like to know how i can solve this problem and download my code into the MSP430.I have attached a wiring schematic of the board. hope it will help.thanks in advance. updated electrical drawing.pdf
  7. Hi everyone, I am new here so please forgive if I am posting this in the wrong place. I am trying to develop a simple game (snake or tic tac toe) using the boosterpack mkii and MSP430FR6989 but I am having terrible hard time even getting started with the project. I would also like to know which libraries to download and etc. There are a lot of tutorials for boosterpack mkii but none of them use the FR6989 board. If someone could get me started and guide me the right way it would be really appreciated.
  8. In case you need to stock up on MSP430 dev boards, it's MSP430 week in the TI store. http://www.ti.com/store/featured/msp430week18.html
  9. Hello Guys Good Day for All, I just open the Mspflash example from energia example using MSP4305969LP board. But when I compile, it show error as below picture. Any one can help me? Thanks a lot. Best Regards, Lukman
  10. Total Noob With Interrupt Problems

    I just started playing with the MSP430 with the G2553 chip and am having problems with interrupts. I have the following code just for testing and sometimes pressing the button works and sometimes it doesn't. I thought maybe I had a bad board and replaced it but I still have the same problem. I am beginning to think I am just doing something wrong in the debugging or something. But, here is my code: #include <msp430g2553.h> #define LED1 BIT0 int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; //Set DCO to 1Mhz DCOCTL = CALDCO_1MHZ; P1OUT=BIT0; P1DIR=BIT0; //P1.0 (LED) as output) P1IES |= BIT3; // high -> low is selected with IESx = 1. P1IFG &= ~BIT3; // To prevent an immediate interrupt, clear the flag for // P1.3 before enabling the interrupt. P1IE |= BIT3; // Enable interrupts for P1.3 __enable_interrupt(); P1OUT |= BIT0; //Initially the led will glow while(1) {} return 0; } #pragma vector = PORT1_VECTOR //PORT1 interrupt vector name __interrupt void P1_ISR(void) { P1OUT ^= BIT0; P1IFG &= ~BIT3; // clear the interrupt flag } So I hit the debug button in CCS 7.4, and it loads to the board. I have a breakpoint at stopping the watchdog timer and a breakpoint at toggling BIT0 in the ISR. I hit resume at the watchdog timer and start trying the button at P1.3. Maybe 1 out of 10 times I'll hit the breakpoint in the ISR but the rest of the time I get nothing. I apologize if this is just a really basic and dumb question, but I have Googled everything I can think of and searched the forums and come up with nothing. Any help is appreciated,
  11. Hi, I have an MSP430G2553 board that I need to work with. However, when using Energia, the program usually freezes or becomes extremely slow to the point that I just have to terminate the process and close it. I really doubt it's a code problem, since the only codes I've used have been from the Examples (Blink and AnalogReadSerial). I've tried a couple of things: uninstalling and re-installing drivers, following all the steps in the Windows guide for Energia, re-downloading Energia. But nothing works. The problem is most certainly a communication problem with the board since, upon unplugging the board, the program starts working again with no freezes whatsoever. I really need to get this to work, so any suggestion is apreciated. Windows 10 by the way. Thanks. - Raimundo
  12. An extra USB for MSP430

    Hi! It's my first time using MSP430 and I'm a little bit lost . I want to connect a barcode scanner module with the MSP430. In order to do that, I need an USB port extra. I know that Arduino has a USB Host shield, but MSP430 doesn't have any shields, does it? So, how can I do it? Is there any way to use the USB Shield of Arduino for the MSP430? Thanks!
  13. Hi All, I need to compile and run c++ codes and .ino codes I have for my device. Since these codes interact with each other, I need to write a script to compile and run them from a terminal window rather than compiling and uploading my .ino code from the Arduino IDE ( Energia). Can someone help in this regard? I use Mac OS, but I am fine to switch to Windows if necessary. I use MSP430G223. Thanks Navid
  14. Hello, I'm currently working on a project temperature data logger. Now I'm using mc: MSP430f5529 I integrated with sd card using the petit fatfs library. Due to some limitation, i cant use full functionality. so I'm planning to make it work on fatfs. but there is no footprint for that. can you help me to come out of this issue? Thank you, sir Limitations: 1. Cant create a file 2. while saving the data in the same file previous entries are all given garbage value at sometimes. because it is not an empty file filled with null.
  15. Hello, I'm currently working on a project temperature data logger. Now I'm using mc: MSP430f5529 I integrated with sd card using the petit fatfs library. Due to some limitation, i cant use full functionality. so I'm planning to make it work on fatfs. but there is no footprint for that. can you help me to come out of this issue? Thank you, sir Limitations: 1. Cant create a file 2. while saving the data in the same file previous entries are all given garbage value at sometimes. because it is not an empty file filled with null.
  16. Hi , I am using MSP430FR4133LP , in energia the GPIO pins are predefined in the pins_energia.h for MSP430FR4133 LP based on the silkscreen on the board. I using this MSP430FR4133 chip for another project and in that i am not using a LCD so i thought that i can also use LCD pins as GPIO. For this purpose i need to add the pins in the pins_energia.h but i am not able to crack it. Can anyone help me with this ....? if i try to use any other pins other than the defined ones (say P2_2) ... it throws an error as " P2_2 not defined in the scope" // Pin names based on the silkscreen // static const uint8_t P1_0 = 4; static const uint8_t P1_1 = 3; static const uint8_t P1_2 = 24; static const uint8_t P1_3 = 13; static const uint8_t P1_4 = 12; static const uint8_t P1_5 = 11; static const uint8_t P1_6 = 18; static const uint8_t P1_7 = 19; //static const uint8_t P2_0 = ; //static const uint8_t P2_1 = ; //static const uint8_t P2_2 = ; <------ What should i do in order to add this pin static const uint8_t P2_3 = 22; static const uint8_t P2_4 = 21; static const uint8_t P2_5 = 8; static const uint8_t P2_6 = 25; static const uint8_t P2_7 = 5; //static const uint8_t P3_0 = ; //static const uint8_t P3_1 = ; //static const uint8_t P3_2 = ; //static const uint8_t P3_3 = ; //static const uint8_t P3_4 = ; //static const uint8_t P3_5 = ; //static const uint8_t P3_6 = ; //static const uint8_t P3_7 = ; static const uint8_t P4_0 = 23; //static const uint8_t P4_1 = ; //static const uint8_t P4_2 = ; //static const uint8_t P4_3 = ; //static const uint8_t P4_4 = ; //static const uint8_t P4_5 = ; //static const uint8_t P4_6 = ; //static const uint8_t P4_7 = ; static const uint8_t P5_0 = 17; static const uint8_t P5_1 = 7; static const uint8_t P5_2 = 15; static const uint8_t P5_3 = 14; //static const uint8_t P5_4 = ; //static const uint8_t P5_5 = ; //static const uint8_t P5_6 = ; //static const uint8_t P5_7 = ; static const uint8_t P8_0 = 6; static const uint8_t P8_1 = 2; static const uint8_t P8_2 = 9; static const uint8_t P8_3 = 10; //static const uint8_t P8_4 = ; //static const uint8_t P8_5 = ; //static const uint8_t P8_6 = ; //static const uint8_t P8_7 = ; //static const uint8_t PJ_0 = ; //static const uint8_t PJ_1 = ; //static const uint8_t PJ_2 = ; //static const uint8_t PJ_3 = ; //static const uint8_t PJ_4 = ; //static const uint8_t PJ_5 = ; //static const uint8_t PJ_6 = ; //static const uint8_t PJ_7 = ; These are the pin definitions that are already in the pins_energia.h based on the silkscreen. If i want to use a pin (say P2.2) what must i do in order to define that pin in the pins_energia.h file ?? thank you in advance.....
  17. MSP430F149 Board

    A while back @omnicron generously offered up some surplus boards sporting a MSP430F149 and a good mix of conditioned I/O on the board including a couple of 5.8psi pressure transducers. I feel that this, along with the programming header on the board, makes it a good all-around board for general purpose projects. The board also supports a standby NiMH battery (6v, 1800mAh) with charging/discharging capability and voltage monitoring all controlled by the MCU. The battery switches in via a relay upon primary power loss. One of the pushbuttons is configured in hardware to be used as a soft power on/off and requires just a little bit of code to work. One of the concerns upon getting the board is that, even though it has a programming header, the fuse may have been blown to protect the original code. With the fuse setup on the MSP430F149 that would be a show stopper and the board would have been a paper weight. Thankfully, when I connected my MSP-FET I was able to talk to the MCU as well as program it. So what does one do when presented with a new piece of hardware? Write code to flash LEDs and exercise the hardware, of course. Since I wanted to make this a general purpose, “throw it at a project” kind of board, I wanted to write some functions to simplify the main program code. So far I have routines for digital I/O, analog in, chip temperature and a function to display a binary result on the eight LEDs on the board. One downside to the way this particular board was designed is the lack of easily accessible serial ports. One way around this is to solder directly to the MCU pins to utilize the secondary serial ports , but that wasn't very attractive. Looking at the schematic I found that by removing three passives from each of the two serial lines, I could repurpose what were originally a couple of digital outputs and have a serial port (UART only, no I2C on this MCU). SPI is also possible using the same technique, but a little more cumbersome to implement. I haven't written the functions for serial yet and will probably wait until I actually need serial I/O. The video demonstrates my demo code that utilizes soft power using the switch shown at the bottom left. Default power up behavior is the 8 LEDs chasing up and down. The next switch to the right of the power switch toggles the beeper which, when activated, sounds every time the LED furthest to the left (LSB) lights up. The next switch to the right toggles the speed of the LEDs and the final button displays the chip temp in binary (75 degrees in this case), pauses to allow it to be read and then resumes the LED chasing. There… hardware reasonably exercised. J I have included pictures of the front and back of the board as well as a PDF schematic. If you have the inclination I welcome feedback on the code and the resulting opportunity to learn to code more efficiently. // Since I used portions of TI’s MSP430ware examples in two functions (chiptemp and analogIN) I am //including the TI copyright notice below: /* --COPYRIGHT--,BSD_EX * Copyright (c) 2012, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ******************************************************************************* * * MSP430 CODE EXAMPLE DISCLAIMER * * MSP430 code examples are self-contained low-level programs that typically * demonstrate a single peripheral function or device feature in a highly * concise manner. For this the code may rely on the device's power-on default * register values and settings such as the clock configuration and care must * be taken when combining code from several examples to avoid potential side * effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware * for an API functional library-approach to peripheral configuration. * * --/COPYRIGHT--*/ #include <msp430.h> #define ana_ch_a 0x01 // Port 6.0, A0 #define ana_ch_b 0x02 // Port 6.1, A1 #define ana_batt 0x03 // Port 6.2, A2 #define ana_9v 0x04 // Port 6.3, A3 #define ON 0x01 #define OFF 0x00 #define LED_1 0x01 // Port 2.0 #define LED_2 0x02 // Port 2.1 #define LED_3 0x03 // Port 2.2 #define LED_4 0x04 // Port 2.3 #define LED_5 0x05 // Port 2.4 #define LED_6 0x06 // Port 2.5 #define LED_7 0x07 // Port 2.6 #define LED_8 0x08 // Port 2.7 #define LED_9 0x09 // Port 3.0 #define LED_10 0x0A // Port 3.1 #define valve_a 0x0B // Port 3.2 #define valve_b 0x0C // Port 3.3 #define pump_a 0x0D // Port 3.4 #define pump_b 0x0E // Port 3.5 #define charge 0x0F // Port 3.6 #define discharge 0x10 // Port 3.7 #define beep 0x11 // Port 4.0 #define chkbatt 0x12 // Port 4.1 #define VCCEN 0x13 // Port 4.2 //array and variables to support functions const int BitValue[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; unsigned int var1; unsigned int var2; unsigned int var3; unsigned int var4; unsigned int a; unsigned int b; unsigned int c; unsigned int ADCvalue; int long IntDegF; void PostLEDValue (unsigned int Var4); void chiptemp(int long degree_f); void analogIN(unsigned int var3); // values= ana_ch_a/b, ana_batt, ana_9v void digitalWrite(unsigned int var1, unsigned int var2); // values = LED_1-10, valve_a/b, pump_a/b, beep, charge, discharge, chkbatt, VCCEN, and var2 = ON, OFF volatile unsigned int i=0; unsigned int led_count; volatile unsigned int j; unsigned int l=2; unsigned int sw_press = 0; unsigned int beep_status = 0; unsigned int speed = 6000; int long temp; void main() { WDTCTL = WDTPW + WDTHOLD; DCOCTL = DCO0 + DCO1; BCSCTL1 = RSEL0 + RSEL1 + RSEL2; P1DIR |= 0x00; P4DIR |= BIT0 + BIT1 + BIT2; P4OUT |= 0x00; P4OUT |= 0x04; // Set P4.4 to 1 (VCCEN) P2DIR |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7; P2OUT &=~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7); P2OUT |= (BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7)& 0xFF; P3DIR |= BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7; P3OUT &=~(BIT0+BIT1+BIT2+BIT3+BIT4+BIT5+BIT6+BIT7); P3OUT |= (BIT0 + BIT1) & 0xF; P1IES |= 0x00; P1IFG |= 0x00; P1IE |= (BIT0 + BIT1 + BIT2 + BIT3 + BIT4 + BIT5 + BIT6 + BIT7); _enable_interrupt(); // MAIN CODE STARTS HERE ---------------------------------------------------------- l=2; do { led_count = 11; do { led_count--; j = speed; // Delay 6000 or 1500 do (j--); while (j != 0); if (led_count == 9){ led_count = 8;} if (led_count == 7){ led_count = 6;} digitalWrite(led_count, ON); } while (led_count != 1); i = 45000; do (i--); while (i != 0); if (sw_press == 3) { // Toggle beep at LSB transistion beep_status ^= 0x01; sw_press = 0; } digitalWrite(beep, beep_status); i = 5000; do (i--); while (i != 0); // Delay 5000 digitalWrite(beep, OFF); if(sw_press == 1) { // Soft Power Down P4OUT ^= 0x04; sw_press = 0;} if (sw_press == 4 && speed == 6000) { //Toggle LED chase speed speed = 1500; sw_press = 0;} if (sw_press == 4 && speed == 1500) { speed = 6000; sw_press = 0;} if (sw_press == 5) { sw_press = 0; chiptemp(0);} led_count = 0; do { led_count++; j = speed; // Delay 6000 or 1500 do (j--); while (j != 0); if (led_count == 7){ led_count = 8;} if (led_count == 9){ led_count = 10;} digitalWrite(led_count, OFF); } while (led_count != 10); i = 50000; do (i--); while (i != 0); // Delay 50000 } while (l != 0); } // MAIN CODE ENDS HERE ------------------------------------------------------------------------------------ #pragma vector=PORT1_VECTOR __interrupt void PORT1_ISR(void){ _disable_interrupt(); if(P1IFG & BIT0) { sw_press = 1; P1IFG &= ~BIT0; } if(P1IFG & BIT1) { sw_press = 2; P1IFG &= ~BIT1; } if(P1IFG & BIT2) { sw_press = 3; P1IFG &= ~BIT2; } if(P1IFG & BIT3) { sw_press = 4; P1IFG &= ~BIT3; } if(P1IFG & BIT4) { sw_press = 5; P1IFG &= ~BIT4;} if(P1IFG & BIT5) { sw_press = 6; P1IFG &= ~BIT5; } if(P1IFG & BIT6) { sw_press = 7; P1IFG &= ~BIT6; } if(P1IFG & BIT7) { sw_press = 8; P1IFG &= ~BIT7; } _enable_interrupt(); } #pragma vector=ADC12_VECTOR __interrupt void ADC12ISR (void) { _disable_interrupt(); temp = ADC12MEM0; _enable_interrupt(); } // FUNCTIONS BEGIN HERE -------------------------------------------------------------------------------------------- void digitalWrite(unsigned int var1, unsigned int var2){ a=0; b=0; c=0; if (var1 <= 0x0A){ //Flip ON/OFF on LED outputs since they are active low. var2 ^= 0x01;} if (var1 >= 0x10 && var1 <= 0x13){ c = (var1-17); if (var2==1){ a=P4OUT; a=a|(BitValue[c]); P4OUT=a;} if (var2==0){ a=P4OUT; b=~(BitValue[c]); P4OUT = (a&b);} } if (var1 >= 0x09 && var1 <= 0x10){ c = (var1-9); if (var2==1){ a=P3OUT; a=a|(BitValue[c]); P3OUT=a;} if (var2==0){ a=P3OUT; b=~(BitValue[c]); P3OUT = (a&b);} } if (var1 >= 0x01 && var1 <= 0x08){ c = (var1-1); if (var2==1){ a=P2OUT; a=a|(BitValue[c]); P2OUT=a;} if (var2==0){ a=P2OUT; b=~(BitValue[c]); P2OUT = (a&b);} } } void chiptemp (long int degree_f) { ADC12CTL0 = SHT0_8 + REFON + ADC12ON; ADC12CTL1 = SHP; ADC12MCTL0 = SREF_1 + INCH_10; ADC12IE = 0x001; ADC12CTL0 |= ENC; ADC12CTL0 |= ADC12SC; i = 5000; do (i--); while (i != 0); IntDegF = (temp - 2519) * 761; IntDegF = IntDegF / 4096; temp = 0; degree_f = IntDegF; PostLEDValue (degree_f); } void PostLEDValue (unsigned int var4){ led_count = 0; do { led_count++; j = 250; do (j--); while (j != 0); // turn off LEDs if (led_count == 7){ led_count = 8;} if (led_count == 9){ led_count = 10;} digitalWrite(led_count, OFF); } while (led_count != 10); if (var4 > 64){ var4 = var4 - 64; digitalWrite(LED_8, ON); } if (var4 > 32) { var4 = var4 - 32; digitalWrite(LED_6, ON); } if (var4 > 16) { var4 = var4 - 16; digitalWrite(LED_5, ON); } if (var4 > 8) { var4 = var4 - 8; digitalWrite(LED_4, ON); } if (var4 > 4) { var4 = var4 - 4; digitalWrite(LED_3, ON); } if (var4 > 2) { var4 = var4 - 2; digitalWrite(LED_2, ON); } if (var4 == 1) { digitalWrite(LED_1, ON); } j = 20; //delay to allow reading of LEDs do { i = 50000; do (i--); while (i != 0); j--; } while (j != 0); } void analogIN (unsigned int var3){ ADC12CTL0 = SHT0_8 + REFON + ADC12ON; ADC12CTL1 = SHP; if (var3==1){ ADC12MCTL0 = SREF_1 + INCH_0; } if (var3==2){ ADC12MCTL0 = SREF_1 + INCH_1; } if (var3==3){ ADC12MCTL0 = SREF_1 + INCH_2; } if (var3==4){ ADC12MCTL0 = SREF_1 + INCH_3; } ADC12MCTL0 = SREF_1 + INCH_10; ADC12IE = 0x001; ADC12CTL0 |= ENC; ADC12CTL0 |= ADC12SC; i = 5000; do (i--); while (i != 0); ADCvalue = (temp/16); PostLEDValue (ADCvalue); } - Circuit Diagram.pdf Demo_Program_Video.MOV
  18. I worked on a new servicing routine for my kit oscilloscope's quadrature rotary encoder, and decided to write it all up and post it on Github. Included are routines for periodic polling and for pin-interrupt servicing. Hardware switch debouncing is not needed. The routines are for general use, but I wrote testing code for the MSP430G2231 installed on the Launchpad. The scope guys have used the "lookup table" state transition routine that most people use today, but it doesn't work very well on the scope, and I haven't found it to work very well generally. My routines are designed to avoid all effects of switch bouncing, and seem to work very well and efficiently. Everything is explained in the PDF file in the repo. All the testing code is also included, both source code and executable hex files, and I'm afraid it's all in assembler. But I hope it wouldn't be too difficult to create Energia versions if anyone is interested. I've provided hex files for both types of encoders - those with the same number of pulses as detents per revolution, and those with half as many pulses as detents. The code produces one "tick" per detent in both cases. https://github.com/gbhug5a/Rotary-Encoder-Servicing-Routines
  19. Setting up timers/ccr MSP430G2152

    I'm trying to replicate the project shown here http://www.mjlorton.com/forum/index.php?topic=284.0 but instead of the g2211 I'm using the g2152. I somewhat understand what the code is doing, however I'm having a hard time setting up the timers and capture compare registers. Additionally I'm not sure how the timer/ccr is being used to differentiate between a long or short button press (is it using nested interrupts?) The original code uses grace included configs which obviously aren't there,I'm trying to infer how things were set up originally. I have the gpio and wdt config figured out but not the timer or ccr (I'm probably missing other things as well) Any insight or hints to push me in the right direction would be helpful. Thanks. //#define DATALOG BIT3 //P1.3 //#define BACKLIGHT BIT4 //P1.4 //#define MAXMIN BIT5 //P1.5 //#define DCAC BIT1//P1.1 //#define VHz BIT2//P1.2 //#define DCAC_OUT BIT6//P2.6 //#define VHz_OUT BIT7//P2.7 /* * ======== Standard MSP430 includes ======== */ #include <msp430g2152.h> /* * ======== main ======== */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer P1OUT = BIT1 | BIT2 | BIT3 | BIT4 | BIT5; P1DIR = BIT3 | BIT4 | BIT5; P1REN = BIT1 | BIT2; P1IES = BIT1 | BIT2; P1IFG = 0; P1IE = BIT1 | BIT2; P2SEL2 = BIT3; P2OUT = BIT6 | BIT7; P2SEL &= ~(BIT6 | BIT7); P2DIR = BIT6 | BIT7; P2IES = 0; P2IFG = 0; __bis_SR_register(LPM3_bits | GIE); } #pragma vector = PORT1_VECTOR __interrupt void PORT1_ISR( void ) { P1IE &= ~(BIT1 | BIT2); // // disable interrupt on these pins __delay_cycles(10000); TA0CCR1 = 0; TA0CCTL0 &= ~CCIFG; TA0CTL |= MC_1; // Start timer switch(P1IN & (BIT1 | BIT2)){ case 0: //VHz+DCAC buttons pressed if(P1OUT & BIT3) P1OUT &= ~(BIT3); else P1OUT |= (BIT3); __delay_cycles(20000); break; case 2: //VHz button pressed while (!(P1IN & BIT2) && !(TA0CCTL0 & CCIFG)); TA0CTL &= ~MC1; if (!(TA0CCTL0 & CCIFG)){ P2OUT &= ~(BIT7); __delay_cycles(10000); P2OUT |= (BIT7); } else{ P1OUT &= ~(BIT4); __delay_cycles(10000); P1OUT |= (BIT4); } break; case 4: //DCAC button pressed while (!(P1IN & BIT1) && !(TA0CCTL0 & CCIFG)); TA0CTL &= ~MC1; if (!(TA0CCTL0 & CCIFG)){ P2OUT &= ~(BIT6); __delay_cycles(10000); P2OUT |= (BIT6); } else{ P1OUT &= ~(BIT5); __delay_cycles(10000); P1OUT |= (BIT5); } break; case 6: //no button pressed break; } TA0CTL &= ~(MC1 + MC0); // Clear MCx bits to stop timer while(!(P1IN & (BIT1 | BIT2))) P1IFG &= ~(BIT1 | BIT2); // sets register flag for interrupt to 0: No interrupt is pending P1IE |= (BIT1 | BIT2); // re-enable interrupt on these pins }
  20. Porting Arduino Library

    Hello All, I'm an electronics engineering student and I know little about programming.I was using arduino and I want to use TI MCU's. So for that reason I'm recreating my arduino projects on energia (tried code composer studio but it is too complicated for me). Some of my projects worked well on energia and i didn't make any changes of my codes it was wonderful but my end term project didn't compiled because of the library that i'm using so I'm trying to port a library from arduino to energia. The library that i'm trying to port is based on the SoftwareSerial library (formerly NewSoftSerial), authored by: ladyada (http://ladyada.net),Mikal Hart (http://www.arduiniana.org),Paul Stoffregen (http://www.pjrc.com),Garrett Mace (http://www.macetech.com), Brett Hagman (http://www.roguerobotics.com/) and it uses pin change interrupts. the library that i'm trying to port energia uses digitalPinToPCMSK and digitalPinToPCICR macros from the pins_arduino.h I was successful running this library on arduino but i cannot get it to work on energia. The error I'm gettin when i try to compile the code is; error: 'digitalPinToPCICR' was not declared in this scope 'error: digitalPinToPCMSK' was not declared in this scope it is going like this. The library i want to port from arduino is Arduino-SDI-12 created by Kevin M. Smith, S. Hicks and their team members the library is located at github (link: https://github.com/EnviroDIY/Arduino-SDI-12 ). What should I do to make it work? Any help will be appreciated. Thanks in advance, I'm using LaunchPad MSP-EXP430G2 v1.5 MCU MSP430G2553 Windows 10 PC and Energia 1.6 10E18 IDE
  21. MSP430F5529 and RFM12b used together

    Hello, I hope this is the right forum to post in, I'm a new user here... So, I have been trying to get the RFM12b module to work with my MSP430F5529. The connections are as follows for transmission: VDD --> 3.3V GND--> GND SDO-->P6.5 nIRQ-->P3.4 nSEL-->P3.3 SCK-->P1.6 SDI-->P6.6 Now, I have the following code, in which I only configure the module and try to read its status register: #include "main.h" void WriteCMD(unsigned int CMD); void Write1(); void Write0(); int check_status(); void main() { //init ports P6DIR |= BIT5; //set SDO as output on P6.5 P3DIR &= ~BIT4; //set nIRQ as input on P3.4 P3REN |= BIT4; P3DIR |= BIT3; //set nSEL as output on P3.3 P1DIR |= BIT6; //set SCK as output on P1.6 P6DIR &= ~BIT6; //set SDI as input on P6.6 P6REN &= ~BIT6; //init rfm12b WriteCMD(0x80D8);//enable register,433MHz,12.5pF WriteCMD(0x82D8);//enable receive,!PA WriteCMD(0xA640);// WriteCMD(0xC647);// WriteCMD(0x94A0);//VDI,FAST,134kHz,0dBm,-103dBm WriteCMD(0xC2AC); WriteCMD(0XCC77);// WriteCMD(0xCA80); WriteCMD(0xCA83);//FIFO8,SYNC, WriteCMD(0xC49B); WriteCMD(0x9850);//!mp,9810=30kHz,MAX OUT WriteCMD(0xE000);//NOT USE WriteCMD(0xC800);//NOT USE WriteCMD(0xC000);//1.0MHz,2.2V //statusregister auslesen int cnt = 16; int result = 0; int temp = 0; P3OUT &= ~BIT3; //set nSEL low P6OUT &= ~BIT5; //set SDO low while(cnt--) { __delay_cycles(10); temp = P6IN; temp = temp <<2; result |= temp; result = result <<1; P1OUT |= BIT6; // set SCK high __delay_cycles(10); __no_operation(); P1OUT &= ~BIT6; //set SCK low __delay_cycles(10); P3OUT |= BIT3; //set nSEL high; } __no_operation(); while(1) { __no_operation(); result= result-1; result = result+1; } } void WriteCMD( unsigned int CMD ) { unsigned char n=16; P1OUT &= ~ BIT6; //set SCK low P3OUT &= ~BIT3; //set nSEL low, selecting the rfm12b __delay_cycles(10); while(n--) { if(CMD&0x8000) { Write1(); } else { Write0(); } CMD=CMD<<1; } P1OUT &= ~ BIT6; //set SCK low P3OUT |= BIT3; //set nSEL high, deselecting the rfm12b __delay_cycles(10); } void Write0 (void) { P1OUT &= ~BIT6; //set SCK low __delay_cycles(10); P6OUT &= ~BIT5; //set SDO low __delay_cycles(10); P1OUT |= BIT6; //set SCK high, rfm now reads SDO __delay_cycles(10); P1OUT &= ~BIT6; //set SCK low } void Write1(void) { P1OUT &= ~BIT6; //set SCK low __delay_cycles(10); P6OUT |= BIT5; //set SDO high __delay_cycles(10); P1OUT |= BIT6; //set SCK high, rfm now reads SDO __delay_cycles(10); P1OUT &= ~BIT6; //set SCK low } Now, the status register should read "0x4000", but I always get "0xFFF8" and this makes me nervous. I have also tried simply connecting two modules and sending data between the two with a bit different programms, but that also didn't yield any results. Can anyone here help me? I've been to the 10th site of Google search results and haven't found anything that could help me. I got my instructions from the following site: https://gobotronics.wordpress.com/2010/10/07/rfm12-programming/. Thanks in advance!
  22. Hello, I'm actually trying to communicate with Gps through Uart. But every time its giving error like this. error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors. I don't know how to solve it. so, please help me to finish this project. it's very urgent Thanks in advance.
  23. while integrating GPS with my msp430. I'm getting these errors from the library. so please someone help me out. C:\Users\softdesigners\Desktop\energia-1.6.10E18\libraries\SoftwareSerial\SoftwareSerial.cpp:81:2: error: #error This version of SoftwareSerial supports only 16MHz processors C:\Users\softdesigners\Desktop\energia-1.6.10E18\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)': C:\Users\softdesigners\Desktop\energia-1.6.10E18\libraries\SoftwareSerial\SoftwareSerial.cpp:251:31: error: 'table' was not declared in this scope C:\Users\softdesigners\Desktop\energia-1.6.10E18\libraries\SoftwareSerial\SoftwareSerial.cpp: In member function 'virtual size_t SoftwareSerial::write(uint8_t)': C:\Users\softdesigners\Desktop\energia-1.6.10E18\libraries\SoftwareSerial\SoftwareSerial.cpp:319:26: error: 'XMIT_START_ADJUSTMENT' was not declared in this scope
  24. Compute float number in msp430g2

    Hi everyone, I use the following function to compute the angle from accelerometer: float a =atan2f(-0.143798828, -0.680053711); But it can not return a proper result (a huge number ~10^22). How I can compute the angle directly on the chip. (I used CCS IDE). Thanks!
  25. Serial port does not exist

    Mac OS 10.9.5; MSP-EXP430G2; just downloaded Energia 1.6.10E18; installed MSP430LCPDC 1.0.3b drivers. I installed the drivers and restarted my Mac. I was able to select the /dev/cu.art-XXXXX port, but running Blink gave me a long error, which ended in the selected serial port fet: identify failed does not exist or your board is not connected Power LED on the launchpad works. I've had the board sitting on a shelf for about 3 years, if that makes any difference. I could not locate these drivers on my Mac to verify they were the right ones, but other forum posts leads me to believe that is the right port. Can anyone help me? Thanks.
×