Example: PWM output and CAP input. More...
#include "BBB/pruio.bi"
#include "BBB/pruio_pins.bi"
Go to the source code of this file.
Macros | |
#define | P_OUT /* P9_21 */ |
The pin for PWM output. | |
#define | P_IN /* P9_42 */ |
The pin for CAP input. | |
Functions | |
int | main () |
Variables | |
VAR | io = NEW PruIo |
Create a PruIo structure, wakeup subsystems. | |
Float_t | f1 |
Variable for calculated frequency. | |
Float_t | d1 |
Variable for calculated duty cycle. | |
Float_t | f0 = 31250 |
The required frequency. | |
Float_t | d0 = .5 |
The required duty cycle. | |
VAR | k = ASC(INKEY()) |
The key code. | |
Example: PWM output and CAP input.
This file contains an example on how to measure the frequency and duty cycle of a pulse train with a eCAP module input. The program sets another pin as eHRPWM output to generate a pulse width modulated signal as source for the measurement. The output can be changed by some keys, the frequency and duty cycle of the input is shown continuously in the terminal output. Find a functional description in section pwm_cap.
Licence: GPLv3, Copyright 2014-2023 by Thomas{ doT ]Freiherr[ At ]gmx[ DoT }net
Compile by: fbc -w all pwm_cap.bas
Definition in file pwm_cap.bas.
int main | ( | ) |
The main function.
Definition at line 96 of file pwm_cap.bas.