Hello,
I work with teensy 4.0, and I have a pin (Pin number 1 on the board) which output 50% duty-cycle PWM at 1Mhz. This clock is produced using these 2 rows at the setup:
analogWriteFrequency(1, 1000000);
analogWrite(1, 128);
I want to synchronize other signals to this clock and therefore I need to detect when there is a rising edge on that pin. How can I detect the rising edge? I tried using:
digitalReadFast(1)
but it's not working.
which register should I check for this pin state (let's assume i check the state inside a while loop so I check fast enough so the first time I detect HIGH state is close enough to the rising edge time)?
Thank you,
Amit Prigozin
I work with teensy 4.0, and I have a pin (Pin number 1 on the board) which output 50% duty-cycle PWM at 1Mhz. This clock is produced using these 2 rows at the setup:
analogWriteFrequency(1, 1000000);
analogWrite(1, 128);
I want to synchronize other signals to this clock and therefore I need to detect when there is a rising edge on that pin. How can I detect the rising edge? I tried using:
digitalReadFast(1)
but it's not working.
which register should I check for this pin state (let's assume i check the state inside a while loop so I check fast enough so the first time I detect HIGH state is close enough to the rising edge time)?
Thank you,
Amit Prigozin