Maxim Integrated 71M6513H Power Meter IC Family Software User Manual

Page 65

Advertising
background image

71M651x Software User’s Guide

void count_pulses (void)

{

static SUM xdata pulseW_cnt0, pulseW_cnt1;

static SUM xdata pulseR_cnt0, pulseR_cnt1;

static U16 pulse_tmr;

add_2 (PulseW_Cnt, xPulseW_Cnt, 8);

add_2 (PulseR_Cnt, xPulseR_Cnt, 8);

if (capture_pulse_cnts)

{

memcpy_xx (pulseW_cnt0.a, PulseW_Cnt, sizeof (SUM)); // Sample at start.

memcpy_xx (pulseR_cnt0.a, PulseR_Cnt, sizeof (SUM)); // Sample at start.

capture_pulse_cnts = FALSE;

pulse_tmr = Pulse_Duration;

}

else if (0 != pulse_tmr)

{

if (0 == --pulse_tmr)

{

memcpy_xx (pulseW_cnt1.a, PulseW_Cnt, sizeof (SUM)); //Sample at end.

memcpy_xx (pulseR_cnt1.a, PulseR_Cnt, sizeof (SUM)); //Sample at end.

sub8_8 (pulseW_cnt1.a, pulseW_cnt0.a);

sub8_8 (pulseR_cnt1.a, pulseR_cnt0.a);

memcpy_xx((U08x *) &dPulseW_Cnt, &pulseW_cnt1.a[4], sizeof

(dPulseW_Cnt));

memcpy_xx((U08x *) &dPulseR_Cnt, &pulseR_cnt1.a[4], sizeof

(dPulseR_Cnt));

}

}

}

Revision 2.4

TERIDIAN Proprietary

65 of 137

© Copyright 2005-2006 TERIDIAN Semiconductor Corporation

Advertising