Main Page | Modules | Data Structures | File List | Data Fields | Globals

mcpwm.h File Reference

MCPWM TPU functions. More...

#include <68332/types.h>
#include <68332/tpu.h>

Go to the source code of this file.

Data Structures

struct  _MCPWMObject

Typedefs

typedef _MCPWMObject MCPWMObject
typedef _MCPWMObjectMCPWMObjectP

Functions

MCPWMObjectP mcpwm_init (uint16 tpu_num, uint16 chan, uint16 priority, uint16 period, uint16 irqr)
int mcpwm_start (MCPWMObjectP handle)
void mcpwm_shutdown (MCPWMObjectP handle)
int mcpwm_add_ea (MCPWMObjectP handle, uint16 chan, uint16 high)
int mcpwm_set_ea_hightime (MCPWMObjectP handle, uint16 chan, uint16 high)


Detailed Description

This file contains the global function prototypes and data structures for the MultiChannel Pulse-Width Modulation (MCPWM) functionality of the libtpu library.

To use the functions defined in this file, include <68332/mcpwm.h> and link libtpu.a.


Typedef Documentation

typedef struct _MCPWMObject MCPWMObject
 

Alias for the structure struct _MCPWMObject, which represents a MCPWM object.

typedef struct _MCPWMObject* MCPWMObjectP
 

Alias for a pointer to struct _MCPWMObject


Function Documentation

MCPWMObjectP mcpwm_init uint16  tpu_num,
uint16  chan,
uint16  priority,
uint16  period,
uint16  irqr
 

Create and initialize a new MCPWM Object

This function creates and initializes a new MCPWM TPU function. This function only initializes the master channel, use the mcpwm_add... functions to initialize any slave channels you wish to add.

Parameters:
tpu_num The TPU to attach this function to.
chan The channel you wish to put the master channel on.
priority The priority of this TPU function (1-3).
period The period of the PWM waveform.
irqr The IRQ rate for this function (see TPUN05/D). IRQs must be enabled for this channel for this to have any effect.
Returns:
MCPWM object handle.

int mcpwm_start MCPWMObjectP  handle  ) 
 

Start an MCPWM function.

This function is used to start all the MCPWM channels after they have been added with the various mcpwm_add... functions. This is used to ensure all the channels start up at the same time.

Parameters:
handle The MCPWM object you wish to start.
Returns:
0 = success, -1 = failure.

void mcpwm_shutdown MCPWMObjectP  handle  ) 
 

Shutdown a MCPWM function.

This function shuts down a MCPWM system. You need to free the the MCPWMObject yourself after this function returns.

Parameters:
handle The MCPWM object you wish to shut down.

int mcpwm_add_ea MCPWMObjectP  handle,
uint16  chan,
uint16  high
 

Add an edge-aligned TPU slave channel.

This function allows you to create an edge-aligned TPU channel associated with the master channel created with the function mcpwm_init().

Parameters:
handle The MCPWM object you wish to add an edge-aligned channel to.
chan The channel you wish to put this on (should be in sequence).
high The initial high time you wish the channel to have when it is started.
Returns:
0 = success, -1 = failure.

int mcpwm_set_ea_hightime MCPWMObjectP  handle,
uint16  chan,
uint16  high
 

Set the high time (pulse width) for an edge-aligned channel.

This function allows you to set the high time on an edge aligned channel.

Parameters:
handle The MCPWM object you are manipulating.
chan The EA channel you wish to set the high time of.
high The value you wish to set the high time to (0-period).
Returns:
0 = success, -1 = failure.


Generated on Wed Sep 6 03:02:22 2006 for MotoRobots by doxygen 1.3.6