Other Parts Discussed in Thread: ENERGIA
Hi,
i need to use systick and serial comunication, but i cant serial communication works. I am using TM4C1294XL board.
I've tested diferents values for Serial.setTimeout(10) (2, 10,50, 100) but no results
Any idea?
Thanks
#include <stdint.h> #include "Energia.h" #include "driverlib/systick.h" #include "driverlib/systick.c" #include "driverlib/sysctl.h" #include "driverlib/adc.h" #include "wiring_private.h" #define pin 2 //PE4 #define SamplingFreq 60000 //Sampling frequency in HZ #define TickerPeriod (120000000/SamplingFreq) String inData = ""; // a string to hold incoming data bool onoff = LOW; // Ticker frequency pin test void setup() { SysTickDisable(); //Disable SysTick during configuration Serial.begin(115200); delay(500); // Waiting to seriaal monitor Serial.setTimeout(2);//Sets the maximum milliseconds to wait for serial data initialize serial: // reserve 200 bytes for the inputString: inData.reserve(200); SysTickPeriodSet(TickerPeriod); //Define counter period. When 0, calls interrupt SysTickIntRegister(&Ticker); //Asociate interrupt to ISR SysTick SysTickIntEnable(); //Enable systick interrupt SysTickEnable(); //Ebable configurated SysTick IntMasterEnable(); //Habilitadas todas las interrupciones } void loop() { // print the string when a newline arrives: } /* SerialEvent occurs whenever a new data comes in the hardware serial RX. This routine is run between each time loop() runs, so using delay inside loop can delay response. Multiple bytes of data may be available. */ void serialEvent() { while (Serial.available()) { // get the new byte: inData = Serial.readString(); Serial.println(inData); } } void Ticker() { //Frequency test onoff = !onoff; digitalWrite(pin, onoff); }