Enhanced Capture Timer Module


Data Structures

struct  count_notify
struct  Count_Struct

Defines

#define NOE   0
#define RISEE   1
#define FALLE   2
#define ANYE   3
#define ARELOAD   2
#define ASTOP   4

Typedefs

typedef void(* count_callback )(int counter, void *privatedata)

Functions

int IOCPWMem (int Duty, int ioc, unsigned long frequency)
void IOCstart (taskdata ioc)
void IOCstop (taskdata ioc)
int IOC_IC (int ict, u8 trigger, u16 reload, u8 flags)
int IC_CallbackZ (int ic, count_callback callback, void *privatedata)
int IC_Callback_off (int ic)
u16 CountStart (int counter)
u16 ReadCounter (int counter)
int startcounter (int ic)
int stopcounter (int ic)

Detailed Description

This module provides routines to control the Enhanced Capture Timers or ICTs of the IPAC. This corresponds to PORTT of the Motorola DG128 and is the same port as PORT1 when references as a GPIO digital port. These 8 lines can be individually configured as PWMs or 16 bit down counters using the functions in this module.

Define Documentation

#define ARELOAD   2
 

automatic reload of threshold value

Definition at line 23 of file Ioc.h.

#define ASTOP   4
 

automatic stop when counter hits zero

Definition at line 25 of file Ioc.h.

#define NOE   0
 

IC edges

Definition at line 15 of file Ioc.h.


Typedef Documentation

typedef void(* count_callback)(int counter, void *privatedata)
 

callback type for the counter callback These counter callbacks can be registered to happen when a counter hits zero.

Parameters:
counter ICT number that triggered the callback
privatedata generic pointer to a users data
See also:
IC_CallbackZ

Definition at line 33 of file Ioc.h.


Function Documentation

u16 CountStart int  counter  ) 
 

Return the value last loaded into a counter This is either the starting value or the value reloaded after a zero crossing(which could be 0xffff or the reload value depending on the flags) This can be useful for computing how many counts have elapsed in situations where the reload value may vary.

Parameters:
counter the IC to reference
Returns:
the value of the counter that was last loaded to it.

int IC_Callback_off int  ic  ) 
 

Remove an IC callback

Parameters:
ic the IC callback to remove
Returns:
SUCCESS

int IC_CallbackZ int  ic,
count_callback  callback,
void *  privatedata
 

Install a zero cross callback on an IC(ICT configured as a counter)

Parameters:
ic the IC to install the callback on.
callback the callback function to install
privatedata a pointer to user data
Returns:
SUCCESS

int IOC_IC int  ict,
u8  trigger,
u16  reload,
u8  flags
 

turn an ICT into a counter This function is technically misnamed, ICT_IC would make more sense. IOC_IC configures an ICT as a 16 bit down counter with several different options This function has a higher level, the init modules function, Counter_Ipac, which stores all the configuration data sent to it in global variables. This function only configures a counter it does not turn it on, for that use startcounter

Parameters:
ict the ict to configure
trigger what type of edge causes the counter to decrement see IC edges in the defines
reload the reload value and starting counter value
flags control flags, a bitwise combination which can contain ARELOAD or ASTOP
See also:
startcounter

int IOCPWMem int  Duty,
int  ioc,
unsigned long  frequency
 

PWM emulation This function turns the specified ICT into a PWM Typically it is used to emulate PWMs between 1 and 10KHz at varying duty cycles. This is a software PWM so maximum frequencies and duty cycles vary with system load, however low KHz frequencies should support all duty cycles in almost any system load This function does not start the ICT, just configures it. IOCstart must be used for that.

Parameters:
Duty the duty cycle 0-100
ioc the ICT to use for a PWM the frequency to run at.
Returns:
SUCCESS or FAILURE, FAILURES can occur if the frequency/duty cycle combination cannot be achieved with 16 bit counter reloads. This will typically happen at frequencies lower than 300HZ
See also:
IOCstart

void IOCstart taskdata  ioc  ) 
 

starts the IOC (PWM'd ICT) that has been pre-configured by IOCPWMem

Parameters:
ioc 
See also:
IOCPWMem

void IOCstop taskdata  ioc  ) 
 

stops an IOC thats currently running

Parameters:
ioc 

u16 ReadCounter int  counter  ) 
 

Read the current value of a counter This reads the current value of the counter

Parameters:
counter the IC to read
Returns:
the value of the counter

int startcounter int  ic  ) 
 

Turn on an IC

Parameters:
ic the IC to start
Returns:
SUCCESS

int stopcounter int  ic  ) 
 

Turn off an IC Counters that are turned off will not lose their configuration and can be turned back on at any time with startcounter

Parameters:
ic the IC to stop
Returns:
SUCCESS


Generated on Fri Mar 3 17:25:46 2006 for EMAC-HCS12-SDK by  doxygen 1.4.6