Jump to content
Forum sending old emails Read more... ×

Search the Community

Showing results for tags 'Energia'.



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 526 results

  1. I'm using CCSv8 and Energia on a Win10 machine. In my energia code, I have a bunch of setup/loop routines (setupA/loopA, setupB/loopB, etc.) routines as separate files . I'd like to be able to use CPP (#define/#ifdef/etc.) to control whether certain setup/loop tasks are included in the build by essentially making the content of an individual file empty. If I build the code with a certain setup/loop included and then try to use CPP to exclude it, the compiler is still looking for the one I have now excluded and fails the compilation process. I understand that because the setup/loops were in the previous build, that the setup/loop I have now excluded is still included in the build process somewhere, however, I cannot figure out how to get CCS to re-parse all of the files and recognize that this setup/loop is no longer needed. I thought the "rebuild" or "clean" options would do this, but they don't. I am using the Debug build and I can delete that whole directory and it's still looking for the excluded setup/loop. I tried creating an empty .ino file and that seems ok, so I know empty files don't actually require setup/loops within them. None of the files within the CCS GUI seem to mention the excluded file. If I add a new setup/loop, CCS finds it just fine, it's just the removal of them that seems problematic. As a work around, I can create a new project and then copy all of the needed files (not the excluded one) over to it, but this is a bit of a pain and seems like overkill. Does anyone know how to get CCS to update the list of needed setup/loops in the build process for an existing project? thx, jrd
  2. Rathidevi

    Msp430g2553 and CC3200

    Can anyone help me to transfer the data from msp430g2553 to CC3200? I want to know how to interface these two modules
  3. Hello everyone! I am using the SIM800L module to send SMS through a TivaC TM4C123GXL board, but its clock is 80MHz, and the library only accepts 20, 16 or 8 MHz. In Arduino it worked perfectly, this code found on a website. How do I reduce the TM4C123 clock in Power software? Is there another solution? Thanks in advance! The code: #include <SoftwareSerial.h> SoftwareSerial sim(3, 4); int _timeout; String _buffer; String number = ""; //here I inserted my number phone void setup() { delay(4000); //delay for 7 seconds to make sure the modules get the signal Serial.begin(9600); _buffer.reserve(50); Serial.println("Sistem Started..."); sim.begin(9600); delay(1000); } void loop() { SendMessage(); delay(10000); } void SendMessage() { //Serial.println ("Sending Message"); sim.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode delay(1000); //Serial.println ("Set SMS Number"); sim.println("AT+CMGS=\"" + number + "\"\r"); //Mobile phone number to send message delay(1000); String SMS = "Testing GSM module"; sim.println(SMS); delay(100); sim.println((char)26);// ASCII code of CTRL+Z delay(1000); _buffer = _readSerial(); } String _readSerial() { _timeout = 0; while (!sim.available() && _timeout < 12000 ) { delay(13); _timeout++; } if (sim.available()) { return sim.readString(); } } The error: #error This version of SoftwareSerial supports only 20, 16 and 8MHz processors
  4. JRDavisUF

    SPI.transfer

    I notice in the online documentation for SPI.transfer (https://energia.nu/guide/libraries/spi/spi_transfer/) that 3 prototypes are provided, however in the actual source for my msp432, there are 4 (per SPI.h): uint8_t transfer(uint8_t); uint8_t transfer(uint8_t, uint8_t); uint8_t transfer(uint8_t, uint8_t, uint8_t); uint8_t *transfer(uint8_t *, size_t); <===================== Missing in online docs The missing one is the multi-byte transfer. Arduino documents a similar function in their docs so I assume it's one that is meant to exist (please don't get rid of it ). The main reason I mention it is that because there is another two argument prototype. So it's a bit confusing when trying to debug if one gets errors related to the first prototype (due to a forgotten &), when I was trying to use the second. Also, but perhaps I missed it, I don't see any reference to SPI1 in the documentation. Related to this, are there any plans to provide easy access to the other SPIs? jrd
  5. Interfacing without I2C 1. browse for "Liquid Crystal" folder in C:\Program Files (x86)\energia-1.8.7E21\hardware\energia\msp430\libraries or on the path where you downloaded the energia. 2. copy the folder and paste it to C:\Program Files (x86)\energia-1.8.7E21\libraries. note that this library is made for MSP430. You need to follow the pin convention of cc3200 launchpad. 3. open energia and change the rename the pin number as one given in the launchpad schematic. Make sure you dont use the pins that are connected to push buttons. try using the pins that are less multifunctional. use 5V as Vcc for Vdd and POT for best results. for example, replace LiquidCrystal lcd(P2_0, P2_1, P2_2, P2_3, P2_4, P2_5); with LiquidCrystal lcd(8, 9, 12, 13, 14, 15); 4. There you go!. upload the code. interfacing with I2c best advantage of the I2C is only two pins are used for operation! Connect the LCD module to the I2C module. 1.download the library from https://www.arduinolibraries.info/libraries/liquid-crystal-i2-c . or if you have arduino, you can download the library from "Manage Library" looking for "LiquidCrystal I2C". 2. copy the library to the C:\Program Files (x86)\energia-1.8.7E21\libraries. make the necessary I2C connections 3. change the address from 0x20 to 0x27 and put 0x27,16,2., include the lcd library and upload the code. 4. comment out "WProgram.h" from the .cpp file if shows an error. 5. there you go!
  6. superpanky

    mspflash.h library

    Hello. I have wrote an Energia program for digital potentiometer control. I want to save variable "counter" (it is an integer number from 0-255) in non-volatile memory using mspflash.h library in case of reset or power interrupt. But it doesn't saves. I am allmost sure there is something wrong with initialization of variables or pointers inside my code. Can anyone help? Any improvements in code? My code: #include <SPI.h> #include "MspFlash.h" #define outputA P2_1 #define outputB P2_2 #define flash SEGMENT_D int aState; int aLastState; const int slaveSelectPin = SS; const int shutDownPin = P1_4; int pos=0; int counter=0; int p=0; void setup() { pinMode (outputA,INPUT_PULLUP); pinMode (outputB,INPUT_PULLUP); aLastState = digitalRead(outputA); pinMode (slaveSelectPin, OUTPUT); pinMode (shutDownPin, OUTPUT); SPI.begin(); digitalWrite(shutDownPin, HIGH); digitalPotWrite(1, 0); } void loop() { Flash.read(flash+(pos * sizeof(int)), (unsigned char*)&p, sizeof(int)); counter=p; aState = digitalRead(outputA); if (aState != aLastState){ if (digitalRead(outputB) != aState) { counter=++counter; } else { counter=--counter; } } if (counter <= 255) { if (counter < 0) { digitalPotWrite(1, 0); counter = 0; Flash.erase(flash); Flash.write(flash+(pos * sizeof(int)), (unsigned char*)&counter, sizeof(int)); } else { digitalPotWrite(1, counter); Flash.erase(flash); Flash.write(flash+(pos * sizeof(int)), (unsigned char*)&counter, sizeof(int)); } } if (counter > 255) { digitalPotWrite(1, 255); counter = 255; Flash.erase(flash); Flash.write(flash+(pos * sizeof(int)), (unsigned char*)&counter, sizeof(int)); } aLastState = aState; } int digitalPotWrite(int address, int value) { digitalWrite(slaveSelectPin,LOW); SPI.transfer(address); SPI.transfer(value); digitalWrite(slaveSelectPin,HIGH); } Regards, Superpanky
  7. CPP_Technologist

    MPR121 Touch Sensor and I2C Wire Library

    Hello All! I'm having trouble achieving I2C communication with Sparkfun's MPR121 I2C capacitive touch sensor breakout board. I've used the breakout board (and code) many times before with the Arduino, but for some reason I can't get it to work with the MSP430G2553 and Energia. I'm using an MPR121 library found at http://bildr.org/2011/05/mpr121_arduino/ to help with register configuration. My code compiles fine, but I'm trying to print the output from the touch sensor to the serial monitor and nothing is showing up, so I'm assuming the touch sensor isn't working. I know the serial monitor works fine; I ran the DigitalReadSerial example and I can see the output on the monitor. I've connected the MPR121's SDA to pin 1.7 and the SCL to pin 1.6, and the IRQ (interrupt request) to pin 2.4. The SDA and SCL both have 10K pull up resistors on the MPR121's breakout board. The MPR121 is connected to Vcc and GND on the launchpad. Here is my code: #include <mpr121.h> #include <Wire.h> boolean touchStates[12]; //to keep track of the previous touch states void setup(){ pinMode(P2_4, INPUT); // IRQ pin digitalWrite(P2_4, HIGH); //enable pullup resistor Serial.begin(9600); Wire.begin(); mpr121_setup(); } void loop(){ readTouchInputs0(); } void readTouchInputs0(){ if(!checkInterrupt1()){ //read the touch state from the MPR121 Wire.requestFrom(90,2); byte LSB0 = Wire.read(); byte MSB0 = Wire.read(); uint16_t touched = ((MSB0 << 8) | LSB0); //16bits that make up the touch states for (int i=0; i < 12; i++){ // Check what electrodes were pressed if(touched & (1<<i)){ if(touchStates == 0){ //pin i was just touched Serial.print("pin "); Serial.print(i); Serial.println(" was just touched"); }else if(touchStates == 1){ //pin i is still being touched } touchStates = 1; }else{ if(touchStates == 1){ Serial.print("pin "); Serial.print(i); Serial.println(" is no longer being touched"); //pin i is no longer being touched } touchStates = 0; } } } } void mpr121_setup(void){ set_register(0x5A, ELE_CFG, 0x00); // Section A - Controls filtering when data is > baseline. set_register(0x5A, MHD_R, 0x01); set_register(0x5A, NHD_R, 0x01); set_register(0x5A, NCL_R, 0x00); set_register(0x5A, FDL_R, 0x00); // Section B - Controls filtering when data is < baseline. set_register(0x5A, MHD_F, 0x01); set_register(0x5A, NHD_F, 0x01); set_register(0x5A, NCL_F, 0xFF); set_register(0x5A, FDL_F, 0x02); // Section C - Sets touch and release thresholds for each electrode set_register(0x5A, ELE0_T, TOU_THRESH); set_register(0x5A, ELE0_R, REL_THRESH); set_register(0x5A, ELE1_T, TOU_THRESH); set_register(0x5A, ELE1_R, REL_THRESH); set_register(0x5A, ELE2_T, TOU_THRESH); set_register(0x5A, ELE2_R, REL_THRESH); set_register(0x5A, ELE3_T, TOU_THRESH); set_register(0x5A, ELE3_R, REL_THRESH); set_register(0x5A, ELE4_T, TOU_THRESH); set_register(0x5A, ELE4_R, REL_THRESH); set_register(0x5A, ELE5_T, TOU_THRESH); set_register(0x5A, ELE5_R, REL_THRESH); set_register(0x5A, ELE6_T, TOU_THRESH); set_register(0x5A, ELE6_R, REL_THRESH); set_register(0x5A, ELE7_T, TOU_THRESH); set_register(0x5A, ELE7_R, REL_THRESH); set_register(0x5A, ELE8_T, TOU_THRESH); set_register(0x5A, ELE8_R, REL_THRESH); set_register(0x5A, ELE9_T, TOU_THRESH); set_register(0x5A, ELE9_R, REL_THRESH); set_register(0x5A, ELE10_T, TOU_THRESH); set_register(0x5A, ELE10_R, REL_THRESH); set_register(0x5A, ELE11_T, TOU_THRESH); set_register(0x5A, ELE11_R, REL_THRESH); // Section D // Set the Filter Configuration // Set ESI2 set_register(0x5A, FIL_CFG, 0x04); // Section E // Electrode Configuration // Set ELE_CFG to 0x00 to return to standby mode set_register(0x5A, ELE_CFG, 0x0C); // Enables all 12 Electrodes // Section F // Enable Auto Config and auto Reconfig /*set_register(0x5A, ATO_CFG0, 0x0B); set_register(0x5A, ATO_CFGU, 0xC9); // USL = (Vdd-0.7)/vdd*256 = 0xC9 @3.3V set_register(0x5A, ATO_CFGL, 0x82); // LSL = 0.65*USL = 0x82 @3.3V set_register(0x5A, ATO_CFGT, 0xB5);*/ // Target = 0.9*USL = 0xB5 @3.3V set_register(0x5A, ELE_CFG, 0x0C); } boolean checkInterrupt1(void){ return digitalRead(P2_4); } void set_register(int address, unsigned char r, unsigned char v){ Wire.beginTransmission(address); Wire.write®; Wire.write(v); Wire.endTransmission(); }
  8. neznaika

    problems with MSP432E using energia

    Hello, I am trying to use MSP-EXP432E401Y with energia on W10. So far no luck. At the moment, energia compiles but I get the following error: "Connecting... error: CORTEX_M4_0: Error connecting to the target: Frequency is out of range." Is there a way to patch this error? Or should I dive into CCS... Thanks in advance
  9. Even after downloading all required drivers, I'm unable to successfully upload this basic blink code. I went to I tried uploading with all 4 port options appearing in the option but all of them showed the same error: Energia: 1.8.7E21 (Mac OS X), Board: "MSP-EXP430FR2355LP" Sketch uses 998 bytes (3%) of program storage space. Maximum is 32768 bytes. Global variables use 20 bytes (1%) of dynamic memory, leaving 1004 bytes for local variables. Maximum is 1024 bytes. DSLite version 8.2.0.1400 Configuring Debugger (may take a few minutes on first launch)... Initializing Register Database... Initializing: MSP430 Executing Startup Scripts: MSP430 Connecting... error: MSP430: Error connecting to the target: Unknown device Failed: Operation was aborted the selected serial port Failed: Operation was aborted does not exist or your board is not connected This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. I even went on to check if the MSP430 is detected or not and it showed: I tried a different USB cable but it didn't work out. Please help to solve this problem.
  10. Hi, Does anybody have an idea of when will energia ide support Hercules TMS570LS04x/03x LaunchPad is gonna release? Can we add that board to energia? If yes, can anybody suggest in how to add a new board to energia so that i shall try adding it. Thanks
  11. I am looking for a library for sim800 and i am using energia compiler. I am working on certain project on which i suppose to interface sim800c with msp430G2553. i am doing basic coding of tcp/ip and http as well in that interfacing part. please suggest if there is any library available.
  12. Has anyone else experienced something like this? I have been using Energia on Windows for years on various LaunchPads, including 430, 432, and Stellaris (now Tiva). The Windows 10 PCs are a Surface Pro 3, a Toshiba Satellite, and an HP Pavilion. Over the last few months, builds and uploads fail in multiple ways unpredictably. The Serial Monitor often doesn't work, even when the TX pin has the correct signal (verified with an oscilloscope decoder). Often the fix is simply to click the Upload button over and over until it works. I've changed to shorter USB cables and switched from USB 3 to USB 2. Sometimes the problem is fixed by restarting Energia or rebooting the PC. It never stays fixed. I've had the same kinds of issues on older versions of Energia, but the code I'm currently developing won't compile if I go back too far. So I'm sticking with the latest version, 1.8.7E21. I've searched the forum for this, but haven't found anything like it. It is possible I just don't know what to search for, so I would be grateful for pointers. I don't want to go down the rabbit hole chasing one of these specific error messages just yet. I suspect the problem is caused by Windows and Java updates, but I have had no problems with Arduinos (UNO, Mega2600). BTW, I have no problems with Energia 1.8.7E21 on an older desktop running Windows 7.
  13. I am working on a certain project in which i would like to know that is msp430F2617 is compatible with Energia compiler or should i use ccs?
  14. venkatesh223

    MSP430FR6989 pins_energia file

    Hi there, I've seen that the pins_energia file for MSP430FR6989 is designed for launchpad itself. So i,m developing a custom board using MSP430FR6989 will that same pin out file with the launchpad pin numbers can be used, or is there any pins_energia file only for that IC with all the pin numbers for each pin, or should i modify it accordingly?, if needed to modify then what changes can i do to make it compatible please help. Thank you
  15. [MSP432][Windows10][Energia 21][Board file 5.23.1] Recently I've been struggling with a run-time error in a very simple program (converting time=0 to 1/1/1970 fails using ctime...granted it's not really an Energia thing, but it's available for use in my CCS builds of energia projects) using the latest code composer, energia and board file (BTW, I don't have this problem with the previous board file) for my msp432. I've figured out a way to "fix' my problem, but it's unclear to me what the implications of this change might be. By default, when I create a new project in CCS, the project is setup to use the GNU v6.3.1 compiler by default. If I use this compiler, my program compiles, but it's operation fails. In looking into the properties of the project, I notice that I have 5 (2 TI and 3 GNU - 1 GNU older than the default and 1 GNU newer) compiler choices in the tool chain. As such, I started changing the compiler to see what would happen with my non-functioning code. First, I started with the TI compilers. If I select either of them, I get a notice about the need for "manual" intervention in the compiler config. As such, I gave up on those. I then selected the oldest version of the GNU compiler (4.8.4). Switching to this version and my compilation fails. Once again, I have up on that one. As a last attempt, I changed to the newer version of the GNU compiler (7.2.1) and lo-and-behold, not only does my problem compile, but ctime now works correctly. Newer things are always better, right? The default (non-working one) and older (non-compiling) versions of the GNU compiler appear to be shipped with Energia while the newer (working) one appears to be shipped with CCSv8. As such, although I've fixed my problem, I'm wondering if switching is just going to lead to other problems as I'm assuming energia was vetted with the default 6.3.1 compiler. Anyone have positive/negative experiences with changing the compiler tool chain? As my program runs with the previous board file (but using the latest Energia 21 otherwise), might I just be better to switch to the older board file (and wait for a board file/compiler update with energia) but leave the compiler as the default 6.3.1 version? jrd
  16. Hi, Iam planning to make a project which involves GPS and GSM ive decided to use the Quectel MC60 for this purpose. Can anyone here guide me on how to do this like the libraries required references, example codes . Thanks
  17. Hi, Can anyone provide me the links or code for basic read and write example on FRAM of MSP430FR6989 on energia?
  18. i am trying to program "cc1350 launchpad-433MHz" to receive data over rf sent by another "cc1350 launchpad-433MHz" which is connected with rf-studio. here is my code with changes i made to set frequency on 433MHz ------------------------------------------------------------------------------------------------------------------- #include "EasyLink.h" EasyLink_RxPacket rxPacket; EasyLink myLink; void setup() { Serial.begin(115200); // begin defaults to EasyLink_Phy_50kbps2gfsk myLink.begin(); Serial.println(myLink.version()); EasyLink_setFrequency(433000000); Serial.print("testing frequency: "); Serial.println(EasyLink_getFrequency(),HEX); delay(2000); } uint16_t value; void loop() { // Wait / block for 2 second to receive a packet. // rxTimeout is in Radio time and needs to be converted from miliseconds to Radio Time rxPacket.rxTimeout = EasyLink_ms_To_RadioTime(2000); // Turn the receiver on immediately rxPacket.absTime = EasyLink_ms_To_RadioTime(0); EasyLink_Status status = myLink.receive(&rxPacket); if (status == EasyLink_Status_Success) { memcpy(&value, &rxPacket.payload, sizeof(uint16_t)); Serial.print("Packet received with lenght "); Serial.print(rxPacket.len); Serial.print(" and value "); Serial.println(value); } else { Serial.print("Error receiving packet with status code: "); Serial.print(status); Serial.print(" ("); Serial.print(myLink.getStatusString(status)); Serial.println(")"); } } --------------------------------------------------------------------------------------------------------------------------- the problem is: when i run the code and open comport following message is printed continuously: " Error receiving packet with status code: 6 (Rx Error) " also, when i transmit on 433MHz from one cc1350 and receive on other cc1350 which is connected to rf-studio, "Packet transmitted successfully" is printed on comport but nothing is received on rfstudio i ran the example code on code composer studio for rf on 433MHz by changing "smartrf_setting.c/.h" file, worked fine. i can't figure out why it is not working with energia at 433MHz. i have successfully communicated at 868MHz between two cc1350.
  19. Hi, This is my first time using this forum. I saw that someone has done the code for connecting CC3200 to cayenne, but not for CC3220. Just want to enquire if anyone has done the codes for connecting CC3220 to cayenne MQTT using energia?
  20. Hello, Im getting an error while compiling the 128x64 LCD u8g2 library on msp430fr6989. I tried the hello world code on it full buffer. I complied the same code on msp432p401r it compiled and even the display worked but the same code when changed the board to FR6989 its says fatal error assert.h no such file or directory, the screen shot is attached below. Please help me with it. Thank you U8g2_Arduino-master.zip
  21. Hello. I have been trying to create a serial link between the Launchpad (based on tm4c123gh6pm) and my cellphone. The code is very simple for testing purpose. Here is it: /* This is a demo code for testing Bluetooth functionality ->The peripheral used here was a smartphone; and to obtain the values of 'i' on the terminal of the device, the "display mode" setting must be changed to ' HEX' ->The code doesn't work properly on when the pin 10 and 11 are used as RX and TX ->It has been successfully tested to send the values of i to the Rx terminal and receive the characters sent from there. */ int i=0; void setup() { Serial.begin(9600); Serial.print("Welcome "); } char data_from_Blue=0; //String rx_str = ""; void loop() { for(i=0;i<10;i++) { if(Serial.available()>0) { data_from_Blue = Serial.read(); // reading the data received from the bluetooth module/the peripheral (phone here) Serial.println("I received: "); Serial.println(data_from_Blue); //Serial.println(rx_str); //display it on serial monitor i.e,the reading has been received here!! } Serial.write(i); //Print incrementing value of 'i' across the other terminal(i.e, my cellphone) delay(1000); } } The code works fine for Arduino+HC05 and MSP430G2 Lauchpad Kit+HC05. But for TIVA Launchpad mentioned above, the serial monitor simply displays garbled values with '?' within boxes. I have tried almost everything. Please help me.
  22. Hello there, I have 128x64 graphical dot matrix display lying around with the driver ST7567, so ive been thinking can i interface it with msp432 or 430? i found a library for arduino in github but when i added the library to energia and compiled it i get the following error attached below. I have attached the library and the screen shots below, in that library there are for many lcd controllers i selected " U8G2_ST7567_JLX12864_F_4W_SW_SPI" it worked out fine on arduino. can any one help me out?? U8g2_Arduino-master.zip
  23. venkatesh223

    MSP432P401R SD card interface

    hello there, Ive been trying trying to interface an sd card to msp432p401r but i get many errors. my task is top build a data logger where the sensor readings will be stored in a text file. So i tried basics first. First i tired to serial print the sd card info but had lot of errors (screenshot can be seen below). the files i used is attached in the rar file "SD", in that i tried the Card info example. Please can someone help me what is wrong with this code. Thanks SD.rar
  24. I just installed Energia 1.8.7E21 on macos 10.12.6. From the Finder, the Energia version number is a little goofy. It shows "${version}" instead of the actual text. This is seen in the "Info.plist" file, and can be fixed there. ... <key>CFBundleShortVersionString</key> <string>${version}</string> <key>CFBundleVersion</key> <string>1.8.7</string> ...
  25. Thanks in advance for helping. New to microcontrollers, not fluent in C so would prefer higher level language like Energia. Using an MSP430F5529LP to drive a stepper motor, creating a square wave using timer A interrupt handler. That works fine, but would like an additional input to the MSP to increase/decrease the speed. In the following code, the external interrupt is detected when the TA0CCR0 assignment is commented out. With the line included, the external interrupt is not recognized. Thanks again. int TESTPIN1 = P1_5; int state = LOW; void setup() { // put your setup code here, to run once: pinMode(P1_6,OUTPUT); // step motor clock output pinMode(GREEN_LED,OUTPUT); digitalWrite(GREEN_LED, state); pinMode(TESTPIN1, INPUT_PULLUP); // Configuration word // Bits 15-10: Unused // Bits 9-8: Clock source select: set to SMCLK (16MHz) // Bits 7-6: Input divider: set to 1 // Bits 5-4: Mode control: Count up to TACCRO and reset // Bit 3: Unused // Bits 2: TACLR : set to initially clear timer system // Bit 1: Enable interrupts from TA0 // Bit 0: Interrupt (pending) flag : set to zero (initially) TA0CTL=0b0000001000010010; TA0CCR0=1200; // Set TACCR0 = 2000 to generate a 1ms timebase @ 16MHz with a divisor of 8 TA0CCTL0=BIT4; // Enable interrupts when TAR = TACCR0 attachInterrupt(digitalPinToInterrupt(TESTPIN1), TestISR, CHANGE); } void loop() { // put your main code here, to run repeatedly: } #pragma vector=TIMER0_A0_VECTOR __interrupt void timerA0ISR(void) { // Timer A0 Interrupt service routine static int msCount=0;// Count milliseconds to allow a 1 second pulse static int state=0; // Remember state for toggling purposes msCount++; if (msCount >= 18) { msCount = 0; digitalWrite(P1_6,state); // Write stepper output state=~state; // toggle state } } void TestISR() { state = !state; digitalWrite(GREEN_LED, state); }
×