Changeset 72 for webserver/example

Show
Ignore:
Timestamp:
10/23/10 12:36:15 (14 years ago)
Author:
phil
Message:

- switched baud rate to 2400 (try to minimize errors)
- corrected binary coded hex number conversion algorithm for yield calculation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/EnergyMeters/ARM7_LPC2368_Rowley/EnergyMeters.hzs

    r71 r72  
    2121  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;Demo Source" name="unnamed" /> 
    2222  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;EnergyMeters" name="unnamed" /> 
     23  <ProjectSessionItem path="EnergyMetersEmbedded;EnergyMetersEmbedded;FreeRTOS.org Source" name="unnamed" /> 
    2324 </Project> 
    2425 <Register1> 
     
    4041 <Watch1> 
    4142  <Watches active="0" update="Three Seconds" > 
     43   <Watchpoint linenumber="64" radix="-1" name="currentTime" expression="currentTime" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
     44   <Watchpoint linenumber="547" radix="16" name="PINSEL0" expression="PINSEL0" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     45   <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="16" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    4246   <Watchpoint evalMode="2" linenumber="312" numelements="10" evalType="0" radix="16" name="rxUART3" expression="rxUART3" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    43    <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="16" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    44    <Watchpoint linenumber="547" radix="16" name="PINSEL0" expression="PINSEL0" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    45    <Watchpoint linenumber="64" radix="-1" name="currentTime" expression="currentTime" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    4647  </Watches> 
    4748 </Watch1> 
     
    5556 </Watch3> 
    5657 <Watch4> 
    57   <Watches active="1" update="Twice a Second" > 
     58  <Watches active="1" update="Each Second" > 
     59   <Watchpoint linenumber="1231" radix="16" name="currentCha" expression="currentCha" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     60   <Watchpoint linenumber="1214" radix="-1" name="lastSrcByte" expression="lastSrcByte" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    5861   <Watchpoint evalMode="2" linenumber="677" numelements="6" evalType="0" radix="16" name="dayRxYield" expression="dayRxYield" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     62   <Watchpoint linenumber="1231" radix="16" name="currentCharValue" expression="currentCharValue" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    5963   <Watchpoint evalMode="2" linenumber="678" numelements="100" evalType="0" radix="-1" name="rxUART3" expression="rxUART3" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    60    <Watchpoint evalMode="2" linenumber="699" numelements="21" evalType="0" radix="-1" name="yield_day_rsp" expression="yield_day_rsp" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     64   <Watchpoint evalMode="1" linenumber="1231" evalType="1" radix="-1" name="srcDataStart" expression="srcDataStart" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    6165   <Watchpoint linenumber="667" radix="16" name="rxYieldChkSum" expression="rxYieldChkSum" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     66   <Watchpoint linenumber="673" radix="-1" name="currentChannel" expression="currentChannel" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     67   <Watchpoint evalMode="2" linenumber="1290" numelements="13" evalType="0" radix="-1" name="req_day_yield" expression="req_day_yield" filename="d:/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    6268  </Watches> 
    6369 </Watch4> 
    6470 <Files> 
    65   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" y="662" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" left="0" selected="0" name="unnamed" top="637" /> 
     71  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" y="1216" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" left="0" selected="0" name="unnamed" top="1205" /> 
    6672  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\MetersIncludes.h" y="36" path="D:\repo\webserver\example\EnergyMeters\Source\EnergyMeters\MetersIncludes.h" left="0" selected="0" name="unnamed" top="11" /> 
    67   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="115" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="1" name="unnamed" top="99" /> 
    68   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" y="216" path="D:\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" left="0" selected="0" name="unnamed" top="195" /> 
     73  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="115" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="1" name="unnamed" top="97" /> 
     74  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" y="220" path="D:\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" left="0" selected="0" name="unnamed" top="195" /> 
    6975  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\queue.c" y="799" path="D:\repo\webserver\example\EnergyMeters\Source\queue.c" left="0" selected="0" name="unnamed" top="781" /> 
    70   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\tasks.c" y="1128" path="D:\repo\webserver\example\EnergyMeters\Source\tasks.c" left="0" selected="0" name="unnamed" top="1104" /> 
     76  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\Source\tasks.c" y="1897" path="D:\repo\webserver\example\EnergyMeters\Source\tasks.c" left="0" selected="0" name="unnamed" top="1879" /> 
    7177  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" y="287" path="D:\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\webserver\httpd-cgi.c" left="0" selected="0" name="unnamed" top="269" /> 
     78  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="2" debugPath="D:\repo\webserver\example\EnergyMeters\Source\serial.c" y="225" path="D:\repo\webserver\example\EnergyMeters\Source\serial.c" left="0" selected="0" name="unnamed" top="209" /> 
    7279 </Files> 
    7380 <ARMCrossStudioWindow activeProject="EnergyMetersEmbedded" autoConnectTarget="Segger J-Link" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388479" debugSearchPath="" buildConfiguration="ARM Flash Debug" /> 
  • webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c

    r71 r72  
    929929{ 
    930930 
    931   unsigned int baud = 57600; 
     931  unsigned int baud = 2400; 
    932932  unsigned int divisor = get_uart_clk(3, OSCILLATOR_CLOCK_FREQUENCY) / (16 * baud); 
    933933 
     
    12031203                                    ) 
    12041204{ 
     1205  unsigned char currentChar; 
     1206  unsigned char conversionError = 0; 
    12051207 
    12061208  unsigned char x; 
    12071209  int resultValue = 0; /* initial value */ 
    12081210  unsigned char round = 0; /* which digit? 0 = LSB */ 
    1209   unsigned char currentCharValue; 
     1211  int currentCharValue; 
    12101212 
    12111213  /* go through the bytes backwards (least significant to most significant) */ 
    12121214  for (x = lastSrcByte; x >= firstSrcByte; x--) 
    12131215  { 
    1214  
    1215     currentCharValue = (srcDataStart[x]) - 0x30; 
     1216    currentChar = srcDataStart[x]; 
     1217    if ((currentChar < 0x30) || (currentChar > 0x46)) 
     1218    { 
     1219      conversionError = 1; 
     1220    } 
     1221    else if (currentChar <= 0x39) 
     1222    { 
     1223      // 0x0 to 0x9 
     1224      currentCharValue = (srcDataStart[x]) - 0x30; 
     1225    } 
     1226    else 
     1227    { 
     1228      // 0xA to 0xF 
     1229      currentCharValue = 0xA + ((srcDataStart[x]) - 0x41); 
     1230    } 
    12161231    resultValue = resultValue + (currentCharValue << (4 * round)); 
    12171232 
    12181233    round++; 
    12191234  } /* for */ 
     1235 
     1236  /* if a conversion error occurred, nullify the result */ 
     1237  if (conversionError == 1) 
     1238  { 
     1239      resultValue = 0xFFFF; 
     1240  } 
    12201241 
    12211242  return resultValue; 
  • webserver/example/EnergyMeters/Source/serial.c

    r37 r72  
    224224 
    225225 
    226   unsigned int baud = 57600; 
     226  unsigned int baud = 2400; 
    227227  unsigned int divisor = get_uart_clk(3, OSCILLATOR_CLOCK_FREQUENCY) / (16 * baud); 
    228228