Jump to content

Search the Community

Showing results for tags 'timestamp'.



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 1 result

  1. 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.
×