All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
pwm_cap.bas File Reference

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

`#include "../pruio/pruio.bi"`
`#include "../pruio/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 continously in the terminal output.

Licence: GPLv3

Copyright 2014 by Thomas{ dOt ]Freiherr[ At ]gmx[ DoT }net

Compile by: `fbc -w all pwm_cap.bas`

Definition in file pwm_cap.bas.

## Function Documentation

int main | ( |  | ) |

The main function.

Definition at line 95 of file pwm_cap.bas.

Here is the call graph for this function: