Jump to content

Search the Community

Showing results for tags 'frequency counting'.



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

  1. Hello guys,i have a question for my project im using the msp430g2231 microcontroller and i want to measure frequencies up to 10Mhz.Im new to microcontrollers(not programming),and im not sure how to make the overflow work void main(void) { WDTCTL = WDTPW + WDTHOLD; // stop watchdog timer BCSCTL1 = CALBC1_1MHZ; // Set range DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation delay(100); // delay 100mS until next screen refresh /*** Timer_A Set-Up ***/ TA0CCR0 = SampleTuneTime; TA0CCTL0 |= CCIE; // Interrupt enable TA0CTL |= TASSEL_1 + ID_3; // SMCLK TA0CCTL1 |= CCIE + CCIS_0 + CM_1 + CAP; // Interrupt enable, capture select CCIxA, Positive edge, capture mode TA0CTL |= TASSEL_1; //SMCLK _BIS_SR(GIE); // Enter LPM0 with interrupts enabled while(1) { TA0CTL |= MC0; // Start timer up mode.Timer counts up to TACCR0 TA0CTL |= MC1; // Start timer //while(CounterValue != 400); // Wait while CounterValue is not equal to 400 TA0CTL &= ~MC0; // Stop timer mode TA0CTL &= ~MC1; // Stop timer Result >>= 2; // Divide Result by 4 calc_freq(); //convert long into frequency char buffer[8]= { 0, }; unsigned long toLCD = Frequency; // int Base = 10; itoa(toLCD,buffer); //convert decimal lcd_init(); send_string("FREQUENCY IS"); send_command(0xC0); send_string(buffer); send_command(0xC8); send_string("HZ"); Result = 0; // Zero Result CounterValue = 0; // Zero CounterValue StoredCount = 0; // Zero StoredCount TA0R = 0; // Zero Timer_A0 register } } #pragma vector=TIMER0_A0_VECTOR __interrupt void Timer0_A0(void) { TA0CTL &= ~MC0; // Stop timer TA0CTL &= ~MC1; // Stop timer CounterValue++; // Increment CounterValue if (CounterValue >= (NumberSamples +1)) // Reset values if NumberSamples +1 is reached { CounterValue = 0; // Zero CountValue StoredCount = 0; // Zero StoredCount } Result += StoredCount; // Store accumulated count in Result StoredCount = 0; // Zero StoredCount TA0CTL |= MC1; // Start timer TA0CTL |= MC0; // Start timer StoredCount++; // Increment StoredCount } this is the main code of the program im using custom made function for the itoa and the communication with the LCD.I have two questions 1.) Can i make the frequency meter up to 10Mhz cuz the g2231 has one timer and 1Mhz calibration available. 2.)Can i somehow check if the code is working cuz i dont have any way to send frequency right now,like counting the internal frequency or something like that. Thank you for your time.
  2. Hi all, I have recently found a sketch in arduino forum for frequency counting, which I tried running in MSP432 with energia and MSP430 with energia sketch on Code composer studio. The sketch basically counts the frequency using interrupts and prints the frequency on serial monitor but serial monitor is empty while running the program,.The sketch is as shown below, // Frequency counter sketch, for measuring frequencies low enough to execute an interrupt for each cycle // Connect the frequency source to the INT0 pin (digital pin 2 on an Arduino Uno) volatile unsigned long firstPulseTime; volatile unsigned long lastPulseTime; volatile unsigned long numPulses; void isr() { unsigned long now = micros(); if (numPulses == 1) { firstPulseTime = now; } else { lastPulseTime = now; } ++numPulses; } void setup() { Serial.begin(115200); // this is here so that we can print the result pinMode(3, OUTPUT); // put a PWM signal on pin 3, then we can connect pin 3 to pin 2 to test the counter analogWrite(3, 128); } // Measure the frequency over the specified sample time in milliseconds, returning the frequency in Hz float readFrequency(unsigned int sampleTime) { numPulses = 0; // prime the system to start a new reading attachInterrupt(0, isr, RISING); // enable the interrupt delay(sampleTime); detachInterrupt(0); return (numPulses < 3) ? 0 : (1000000.0 * (float)(numPulses - 2))/(float)(lastPulseTime - firstPulseTime); } void loop() { float freq = readFrequency(1000); Serial.println(freq); delay(1000); }
  3. Hi all, I'm building a project in msp432 where I need to determine the speed of an object using doppler shift frequency based calculations.Is there any libraries or methods for calculating frequency precisely in the 1-100 Hz range?
×
×
  • Create New...