Changeset 50

Show
Ignore:
Timestamp:
02/14/10 16:25:17 (15 years ago)
Author:
phil
Message:

added meters AU1 and AU2 (Auxiliary 1 and Auxiliary 2), interrupt handler now uses macros for meters numbers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/webserver/httpd-cgi.c

    r49 r50  
    297297            meterItems[METER_INDEX_EL2].valueBeforeLastTick 
    298298         ); 
    299  
    300  
    301         strcat( uip_appdata, cCountBuf ); 
    302  
    303  
    304  
     299        strcat( uip_appdata, cCountBuf ); 
     300 
     301 
     302        sprintf( cCountBuf, "AU1meter %u %u %u %u %u %u %u %u\r\n", 
     303            meterItems[METER_INDEX_AU1].meterEnabled, 
     304            (portLONG)(meterItems[METER_INDEX_AU1].timeLastTick >> 32), 
     305           (portLONG)(meterItems[METER_INDEX_AU1].timeLastTick & 0xffffffff), 
     306            (portLONG)(meterItems[METER_INDEX_AU1].timeBeforeLastTick >> 32), 
     307           (portLONG)(meterItems[METER_INDEX_AU1].timeBeforeLastTick & 0xffffffff), 
     308            meterItems[METER_INDEX_AU1].valueLastTick, 
     309            meterItems[METER_INDEX_AU1].currentValue, 
     310            meterItems[METER_INDEX_AU1].valueBeforeLastTick 
     311         ); 
     312        strcat( uip_appdata, cCountBuf ); 
     313 
     314        sprintf( cCountBuf, "AU2meter %u %u %u %u %u %u %u %u\r\n", 
     315            meterItems[METER_INDEX_AU2].meterEnabled, 
     316            (portLONG)(meterItems[METER_INDEX_AU2].timeLastTick >> 32), 
     317           (portLONG)(meterItems[METER_INDEX_AU2].timeLastTick & 0xffffffff), 
     318            (portLONG)(meterItems[METER_INDEX_AU2].timeBeforeLastTick >> 32), 
     319           (portLONG)(meterItems[METER_INDEX_AU2].timeBeforeLastTick & 0xffffffff), 
     320            meterItems[METER_INDEX_AU2].valueLastTick, 
     321            meterItems[METER_INDEX_AU2].currentValue, 
     322            meterItems[METER_INDEX_AU2].valueBeforeLastTick 
     323         ); 
     324        strcat( uip_appdata, cCountBuf ); 
    305325 
    306326        //strcat( ( char * ) uip_appdata, ( char * ) "1234test" ); 
  • webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c

    r47 r50  
    171171 
    172172 
     173  // Init Auxiliary meter 1 
     174  meterItems[METER_INDEX_AU1].meterEnabled = 1;  /* 0: item not used, 1: meter enabled */ 
     175  meterItems[METER_INDEX_AU1].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ 
     176  meterItems[METER_INDEX_AU1].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ 
     177  meterItems[METER_INDEX_AU1].valueLastTick = 1;   /* what value did we have at the last tick? */ 
     178  meterItems[METER_INDEX_AU1].currentValue = 1; /* same: start value of the meter */ 
     179  meterItems[METER_INDEX_AU1].valueBeforeLastTick = 0;   /* what value did we have at the tick before the last tick? */ 
     180 
     181  // Init Auxiliary meter 2 
     182  meterItems[METER_INDEX_AU2].meterEnabled = 1;  /* 0: item not used, 1: meter enabled */ 
     183  meterItems[METER_INDEX_AU2].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ 
     184  meterItems[METER_INDEX_AU2].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ 
     185  meterItems[METER_INDEX_AU2].valueLastTick = 1;   /* what value did we have at the last tick? */ 
     186  meterItems[METER_INDEX_AU2].currentValue = 1; /* same: start value of the meter */ 
     187  meterItems[METER_INDEX_AU2].valueBeforeLastTick = 0;   /* what value did we have at the tick before the last tick? */ 
     188 
     189 
    173190 
    174191} 
  • webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h

    r47 r50  
    33unsigned long long getEpochTimeWithMs(void); 
    44 
    5 #define NUMBER_OF_METERS 5 /* the number of meters we use */ 
     5#define NUMBER_OF_METERS 6 /* the number of meters we use */ 
    66 
    7 #define METER_INDEX_TST 0 /* index of the button example meter data */ 
    8 #define METER_INDEX_GAS 1 /* index of the gas meter data */ 
    9 #define METER_INDEX_EL1 2 /* index of the Electricity 1 meter data */ 
    10 #define METER_INDEX_EL2 3 /* index of the Electricity 2 meter data */ 
    11  
    12  
     7#define METER_INDEX_TST 0 /* index of the button example meter data */ 
     8#define METER_INDEX_GAS 1 /* index of the gas meter data */ 
     9#define METER_INDEX_EL1 2 /* index of the Electricity 1 meter data */ 
     10#define METER_INDEX_EL2 3 /* index of the Electricity 2 meter data */ 
     11#define METER_INDEX_AU1  4 /* index of Auxiliary input 1 */ 
     12#define METER_INDEX_AU2  5 /* index of Auxiliary input 1 */ 
    1313 
    1414 
  • webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c

    r47 r50  
    5353  else if ((IO2_INT_STAT_R & (1 << 3)) != 0) /* P0.3 interrupt triggered - connector J4, Pin 3*/ 
    5454  { 
    55     handleMeterTick(3); 
     55    handleMeterTick(METER_INDEX_AU1); 
    5656    IO2_INT_CLR |= (1<<3); 
    5757  } 
    5858  else if ((IO2_INT_STAT_R & (1 << 4)) != 0) /* P0.4 interrupt triggered - connector J4, Pin 4*/ 
    5959  { 
    60     handleMeterTick(4); 
     60    handleMeterTick(METER_INDEX_AU2); 
    6161    IO2_INT_CLR |= (1<<4); 
    6262  } 
    6363 
    6464  /* Clear the interrupt. */  
    65   IO2_INT_CLR |= (1<<10); 
    6665  VICVectAddr = 0; 
    6766