beautypg.com

Add_timer_func(), Remove_timer(), Process_timers() – Maxim Integrated 73S12xxF Software User Manual

Page 58: User io api – available with all 73s12xxf devices, E 58)

background image

73S12xxF Software User Guide

UG_12xxF_016

58

Rev. 1.50

Synopsis

Unsigned Integer *Add_Timer ( IN Unsigned integer nDuration)

Parameters

nDuration: Input parameter
Specifies duration of time in 10 ms units.

Return Value

Pointer to added timer. If the value is zero (NULL), there are no timers available.

This function can be called inside an ISR. When the timer expires (*pTimer == 0), it will be automatically
removed. If all timers are in use, a NULL pointer will be returned. The

Process_Timers()

routine must be

called to keep the timer updated.

Add_Timer_Func()

Purpose

Add a 10 ms software timer and the function to execute on timer expiration.

Synopsis

Unsigned Integer *Add_Timer_Func (

IN unsigned int nDuration,

IN void (*pfExpire (void)) );

Parameters

nDuration: Input parameter
Specifies duration of time in 10 ms units.

pfExpire: Input parameter
Specifies a pointer to the function to execute when the timer expires.

Return Value

Pointer to the added timer. If value is zero, there are no timers available.

Remove_Timer()

Purpose

Stop and remove the selected timer.

Synopsis

Void Remove_Timer ( IN unsigned integer *pTimerId );

Parameters

ptimerID: Input parameter
Specifies which timer to stop and remove. This is the value returned by the

Add_Timer()

or

Add_Timer_Func()

functions.

Return Codes None.

Process_Timers()

Purpose

Process and update the active timers. This function must be called from a
foreground routine whenever there is active timer.

Synopsis

Void Process_Timers ( void );

Parameters

None.

Return Codes None.

4.2.13 User IO API – Available with all 73S12xxF Devices

The USER IO Pins can be configured, individually, as an interrupt source to Timer 0, Timer 1, INT0 or
INT1. For INT0 or INT1, the interrupt can be configured to occur on the rising edge/high level or falling
edge/low level. Only INT0 can be used to wake up the CPU from sleep/halt mode. This API includes:

USR_INT_Config ()

(page 59)

USR_INT_Read()

(page 59)

USER_IO_Config()

(page 60)

USER_IO_Read()

(page 60)

USER_IO_Write()

(page 60)