Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4856

General • Re: RP2040 counter divider by 10

$
0
0
I am currently using an interrupt call to measure the input frequency. I set the input frequency to pin 0. And I output the data to the Serial port. Please help me fix this code by using an interrupt call using PIO.

Code:

uint64_t N;                                                           //const byte interruptPin = 0;//Pin IRQ                                 ////--------------------------------------------------------------------//void freq()                                                           //{                                                                     //  N=N+1;                                                              //}                                                                     ////--------------------------------------------------------------------//void setup()                                                          //{                                                                     //  //---set IRQ--------------------------------------------------------//  pinMode(interruptPin, INPUT_PULLUP);                                //  irq_get_priority (interruptPin);                                    //  irq_set_priority (interruptPin, 0x00);                              //  attachInterrupt(digitalPinToInterrupt(interruptPin), freq, RISING); //  //---set Serial-----------------------------------------------------//  Serial.begin(115200);                                               //  while (!Serial);                                                    //  //------------------------------------------------------------------//}                                                                     //void loop()                                                           //{                                                                     //  Serial.print(" N= ");Serial.print(N);                               //  Serial.print(" T= ");Serial.println(millis());                      //  delay(1000);                                                        //}                                                                     //
viewtopic.php?p=2096480&hilit=rp2040+pi ... q#p2096480
viewtopic.php?p=2118372&hilit=rp2040+pi ... q#p2118372
viewtopic.php?p=2238459&hilit=rp2040+pi ... q#p2238459

Statistics: Posted by Aleks_2024 — Mon Jan 06, 2025 7:03 pm



Viewing all articles
Browse latest Browse all 4856

Trending Articles