beautypg.com

2 mapi_relaycontrol (), 3 mapi_closecircuit_0x(), 4 mapi_opencircuit_0x() – Maxim Integrated 78M6612 M-API Library User Manual

Page 33: Mapi_relaycontrol (), Mapi_closecircuit_0x(), Mapi_opencircuit_0x()

background image

UG_6612_036

78M6612 M-API Library User Guide

Rev. 1.00

33

4.5.2 MAPI_RelayControl ()

Purpose

Turning Relay ON/OFF (close/open circuit) on all channels.

Synopsis

void MAPI_RelayControl( IN unsigned char Channels);

Parameters

Channels

Input parameter.
Each bit indicates turning ON(1) or OFF(0). The bit’s position
represents the specific channel/outlet number. For example:


0x01h – Turn relay ON on channel 1/A. Turn relays OFF on channel 2/B.
0x02h – Turn relay ON on channel 2/B. Turn relays OFF on channel 1/A.

Both channels can be turned ON with a single call to this API by setting 1 at the
bits representing the channels. For example:
0x03h – Turn relay ON on both channels.
Note: in the library code, channel 1 relay is mapped to DIO7 and channel 2 to
DIO19. But all other evaluation boards (6612, 6613, etc) are setup such that
DIO19 to TP4 and DIO7 is grounded. This means relay control doesn’t mean
much since only DIO19 would be suitable to be controlled in this case but since
there is only one channel, there is no point of having a control.

Return Codes None.

4.5.3 MAPI_CloseCircuit_0X()

Purpose

Get zero-crossing status when positioning from open circuit to close circuit. The
value returned TRUE/FALSE indicates whether Voltage

zero-crossing has

occurred. The usage of this API is intended to be for when the circuit is
transitioning from open to close. This API uses the hardware Timer 1 in the case
when zero crossing does not take place. A delay of 12ms is set for such break.

Synopsis

bool MAPI_CloseCircuit_0X( void );


Parameters

None.

Return Codes TRUE – Zero crossing occurs.

FALSE – Zero crossing does not occur.

4.5.4 MAPI_OpenCircuit_0X()

Purpose

Get zero-crossing status when transitioning from close circuit to open circuit.
The value returned TRUE/FALSE indicates whether Current

zero-crossing has

occurred for a specific channel. There is no indication of either direction
(falling/rising). The usage of this API is intended to be for when the circuit is
transitioning from close to open. This API uses the hardware Timer 1 in the case
when zero crossing does not take place. A delay of 10ms is set for such break.

Synopsis

bool MAPI_OpenCircuit_0X( unsigned char Channel );

Parameters

Channel

Input parameter.
Channel/outlet number (1 or 2) where zero crossing will be
detected.

Return Codes TRUE – Zero crossing occurs.

FALSE – Zero crossing does not occur.