Jump to content

Search the Community

Showing results for tags 'time'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


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


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 4 results

  1. I am trying to find the timing of how long it takes for an analogread operation like below. How do I do that in energia? Is there a way I can timestamp before and after the code and take the difference? voltSensor= analogRead(A7);
  2. A decoder from a motor has 2 square wave outputs that deliver 256 pulses/revolution (duty cycle 1:1). The two outputs are 90 degree out of phase for direction information. I want to count pulse, in one direction up, in the other down. Towards this aim I attach to the first decoder output following routine: void countStep(){ if(digitalRead(_CIN2)){_pos++;} else {_pos--;} } "_CIN2" is the second decoder output and "pos" the counter variable. This works well until up to approx. 16kHz. But for higher frequencies it counts in the wrong direction. I first guessed, that the phase relation between the 2 signals is not constant, but an independent measurement showed it to be rock stable. Another guess is, that the interrupt is too slow (maybe because of the "digitalRead"). I am running a MSP430G2553 with 16MHz. Can somebody verify or falsify this guess?
  3. If I try to read the "micros()" function, I only get multiples of 512. I run a MSP430G2553 that, according to specs, should run with 16MHz. here is a minimalistic code: void setup() { Serial.begin(9600); } void loop() { Serial.println(micros()); } Any ideas why I can not get higher resolution than 512 uSec? cheers, Daniel
  4. Hi, I am trying to get the ADC sample timestamp on Energia, but I can not figure it out how it works. From the TI API I know that the ADC data saved on the register is made by two parts. bits [13:0] : ADC sample bits [31:14]: time stamp per ADC sample So I took the Energia library. From <driverlib/adc.h> and I found a method that returns only the time stamp. //***************************************************************************** // //! Gets the current value of ADC internal timer //! //! \param ulBase is the base address of the ADC //! //! This function the current value of 17-bit ADC internal timer //! //! \returns Return the current value of ADC internal timer. // //***************************************************************************** unsigned long ADCTimerValueGet(unsigned long ulBase) { return(HWREG(ulBase + ADC_O_adc_timer_current_count)); } So I have modified the wiring_analog.c library: uint16_t analogRead(uint8_t pin) { uint16_t channel, val; uint16_t pinNum = digitalPinToPinNum(pin); switch(pinNum) { case PIN_57: {channel = ADC_CH_0;}break; case PIN_58: {channel = ADC_CH_1;}break; case PIN_59: {channel = ADC_CH_2;}break; case PIN_60: {channel = ADC_CH_3;}break; default: return 0; } while(ADCFIFOLvlGet(ADC_BASE, channel)) { // flush the channel's FIFO if not empty ADCFIFORead(ADC_BASE, channel); } PinTypeADC(pinNum,0xFF); ADCChannelEnable(ADC_BASE, channel); ADCTimerConfig(ADC_BASE,2^17); ADCTimerEnable(ADC_BASE); ADCEnable(ADC_BASE); while(!ADCFIFOLvlGet(ADC_BASE, channel)); val = ADCFIFORead(ADC_BASE, channel) & 0x3FFF; // ***** TIME STAMP FIELD **** timestamp = ADCTimerValueGet(ADC_BASE); // ***** TIME STAMP FIELD **** ADCDisable(ADC_BASE); ADCChannelDisable(ADC_BASE, channel); ADCTimerDisable(ADC_BASE); val = val >> 2; return val; } // Return the ADC sample time stamp unsigned long ADCGetTime() { return timestamp; } And this is my test sketch #include <wiring_analog.c> int sensorPin = 2; // select the input pin for the potentiometer uint16_t long sensorValue[5] = {0}; // variable to store the value coming from the sensor unsigned long time[5] = {0}; unsigned long m = 0; unsigned int seconds = 0; unsigned int minutes = 0; unsigned int hours = 0; void setup() { Serial.begin(115200); } void loop() { // read the value from the sensor: for (int i = 0; i< 5; i++) { sensorValue [i] = analogRead(sensorPin); time[i] = ADCGetTime(); delay(1); } for(int i = 0; i < 5; i++) { minutes = ( time[i] / 1000 / 60); seconds = ( time[i] / 1000) % 60; m = ( time[i] % 100); Serial.println("ADC VALUE: "); Serial.print(sensorValue[i]); Serial.print(" --- TIME STAMP: "); Serial.print(minutes); Serial.print(":"); Serial.print(seconds); Serial.print(":"); Serial.println(m); Serial.print("\n"); } delay(5000); } The problem is that the value of the variable time do not change. It's always the same. What is wrong with my test sketch? How can I access to the time stamp of my samples? Thank you in advance.
  • Create New...