libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
pwm_cap.bas File Reference

Example: PWM output and CAP input. More...

#include "BBB/pruio.bi"
#include "BBB/pruio_pins.bi"
Include dependency graph for pwm_cap.bas:

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.
 

Detailed Description

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

Since
0.2

Definition in file pwm_cap.bas.

Function Documentation

◆ main()

int main ( )

The main function.

Definition at line 96 of file pwm_cap.bas.

Here is the call graph for this function: