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

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

`#include "stdio.h"`
`#include <termios.h>`
`#include <unistd.h>`
`#include <errno.h>`
`#include "../c_wrapper/pruio.h"`
`#include "../c_wrapper/pruio_pins.h"`
Include dependency graph for pwm_cap.c:

Go to the source code of this file.

## Macros

#define | _GNU_SOURCE 1
| Message for the compiler.
#define | P_OUT P9_21
| The pin for PWM output.
#define | P_IN P9_42
| The pin for CAP input.

## Functions

int | isleep (unsigned int mseconds)
| Wait for keystroke or timeout. More...
int | main (int argc, char **argv)
| The main function. More...

## 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: `gcc -Wall -o pwm_cap pwm_cap.c -lpruio`

Definition in file pwm_cap.c.

## Function Documentation

int isleep | ( | unsigned int | mseconds | ) |

Wait for keystroke or timeout.

Parameters

  mseconds | Timeout value in milliseconds.

Returns
  0 if timeout, 1 if input available, -1 on error.

Wait for a keystroke or timeout and return which of the events happened.

Definition at line 42 of file pwm_cap.c.

Here is the caller graph for this function:

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

The main function.

create new driver structure

Definition at line 61 of file pwm_cap.c.

Here is the call graph for this function: