Changeset 35 for webserver/example

Show
Ignore:
Timestamp:
01/03/10 11:19:00 (15 years ago)
Author:
phil
Message:

first round now works

Files:

Legend:

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

    r34 r35  
    33 <Bookmarks/> 
    44 <Breakpoints> 
    5   <BreakpointListItem line="108" action="" hardwareBreakpoint="" trigger="" useHWbreakpoint="false" group="Breakpoints" type="Breakpoint" state="2" counter="0" isFunctionBreakpoint="false" filename="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" expression="" /> 
     5  <BreakpointListItem line="335" action="" hardwareBreakpoint="" trigger="" useHWbreakpoint="false" group="Breakpoints" type="Breakpoint" state="2" counter="0" isFunctionBreakpoint="false" filename="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" expression="" /> 
    66 </Breakpoints> 
    77 <ExecutionCountWindow/> 
     
    4242 <Watch1> 
    4343  <Watches active="0" update="Three Seconds" > 
    44    <Watchpoint evalMode="2" linenumber="216" 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" /> 
     44   <Watchpoint linenumber="64" radix="-1" name="currentTime" expression="currentTime" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
     45   <Watchpoint linenumber="445" radix="16" name="PINSEL0" expression="PINSEL0" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    4546   <Watchpoint evalMode="2" linenumber="72" numelements="10" evalType="0" radix="16" name="meterItems" expression="meterItems" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
    46    <Watchpoint linenumber="419" radix="16" name="PINSEL0" expression="PINSEL0" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    47    <Watchpoint linenumber="64" radix="-1" name="currentTime" expression="currentTime" filename="d:/energymetersproject/source/energymeters/meters_isrs.c" /> 
     47   <Watchpoint evalMode="2" linenumber="229" 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" /> 
    4848  </Watches> 
    4949 </Watch1> 
     
    5858 <Watch4> 
    5959  <Watches active="1" update="Five Seconds" > 
    60    <Watchpoint linenumber="86" radix="16" name="compareBuf" expression="compareBuf" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    61    <Watchpoint linenumber="197" radix="16" name="compareBufMask" expression="compareBufMask" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    62    <Watchpoint linenumber="197" radix="16" name="compareBuf" expression="compareBuf" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    63    <Watchpoint linenumber="211" radix="16" name="numRxBytes" expression="numRxBytes" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    64    <Watchpoint linenumber="211" radix="16" name="numRxBytes" expression="numRxBytes" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    65    <Watchpoint evalMode="2" linenumber="375" numelements="6" evalType="0" radix="-1" name="chanWatt" expression="chanWatt" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    66    <Watchpoint evalMode="2" linenumber="414" numelements="100" evalType="0" radix="-1" name="rxUART3" expression="rxUART3" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    67    <Watchpoint linenumber="211" radix="-1" name="lengthCompare" expression="lengthCompare" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    68    <Watchpoint evalMode="2" linenumber="375" numelements="6" evalType="0" radix="-1" name="chanVolt" expression="chanVolt" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    69    <Watchpoint linenumber="214" radix="16" name="k" expression="k" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     60   <Watchpoint linenumber="227" radix="16" name="k" expression="k" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     61   <Watchpoint evalMode="2" linenumber="389" numelements="6" evalType="0" radix="-1" name="chanVolt" expression="chanVolt" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     62   <Watchpoint linenumber="224" radix="-1" name="lengthCompare" expression="lengthCompare" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     63   <Watchpoint evalMode="2" linenumber="440" numelements="100" evalType="0" radix="-1" name="rxUART3" expression="rxUART3" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     64   <Watchpoint evalMode="2" linenumber="389" numelements="6" evalType="0" radix="-1" name="chanWatt" expression="chanWatt" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     65   <Watchpoint linenumber="224" radix="16" name="numRxBytes" expression="numRxBytes" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     66   <Watchpoint linenumber="224" radix="16" name="numRxBytes" expression="numRxBytes" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     67   <Watchpoint linenumber="210" radix="16" name="compareBuf" expression="compareBuf" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     68   <Watchpoint linenumber="210" radix="16" name="compareBufMask" expression="compareBufMask" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
     69   <Watchpoint linenumber="87" radix="16" name="compareBuf" expression="compareBuf" filename="c:/dokumente und einstellungen/phil/desktop/repo/webserver/example/energymeters/source/energymeters/solarcountuart.c" /> 
    7070  </Watches> 
    7171 </Watch4> 
    7272 <Files> 
    7373  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" y="108" path="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\portable\GCC\ARM7_LPC23xx\portISR.c" left="0" selected="0" name="unnamed" top="85" /> 
    74   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" y="14" path="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" left="0" selected="1" name="unnamed" top="12" /> 
    75   <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="113" path="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="0" name="unnamed" top="105" /> 
     74  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" y="35" path="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\Source\EnergyMeters\SolarCountUART.c" left="0" selected="1" name="unnamed" top="35" /> 
     75  <SessionOpenFile useTextEdit="1" useBinaryEdit="0" codecName="Latin1" x="0" debugPath="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" y="113" path="C:\Dokumente und Einstellungen\phil\Desktop\repo\webserver\example\EnergyMeters\EnergyMeters\ARM7_LPC2368_Rowley\main.c" left="0" selected="0" name="unnamed" top="96" /> 
    7676 </Files> 
    7777 <ARMCrossStudioWindow activeProject="EnergyMetersEmbedded" autoConnectTarget="Macraigor Wiggler (20 Pin)" debugSearchFileMap="" fileDialogInitialDirectory="C:\Dokumente und Einstellungen\phil\Desktop\repo\Examples_CP-JR_ARM7_LPC2368\ETT_LPC2368_Examples\PERIPHERAL_DEMO\LED_Blink" fileDialogDefaultFilter="*.c" autoConnectCapabilities="388479" debugSearchPath="" buildConfiguration="ARM Flash Debug" /> 
  • webserver/example/EnergyMeters/Source/EnergyMeters/SolarCountUART.c

    r34 r35  
    55// Pin I/O LED Control Maskbit 
    66#define  DIR_RS485   0x00080000                 // P1.19(0000 0000 0000 x000 0000 0000 0000 0000) 
    7 #define  RXD_RS485() IOCLR1 = DIR_RS485         // RS485 Direction = 0 (Receive) 
    8 #define  TXD_RS485() IOSET1 = DIR_RS485         // RS485 Direction = 1 (Transmit) 
     7 
    98 
    109#define RX_UART3_BUF_SIZE 100 
     
    3837const unsigned char init1_rsp[] = "\x02\xf0\xb0\x08\x00\x84\x09\x0c\x04\x0a\x26\x86\xcd\x00\x03"; /* exp. init seq response */ 
    3938const unsigned char init1_r_m[] = "\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff"; /* exp. init seq response mask */ 
     39/* init1_r_m: response after first init: \x02\xf0\xb0\x08 , later: \x02\xf0\xb0\x09 */ 
    4040 
    4141 
     
    5050 
    5151const unsigned char init_after_all_chan[]     = "\x02\xb0\xf0\x04\x00\x21\x00\xcc\x35\x03"; // send to SC after all channels have been scanned 
     52// ^^ equals init1[] 
    5253 
    5354const unsigned char init_after_all_chan_rsp[] = "\x02\xf0\xb0\x09\x00\xa1\xfd\x03\x00\x00\x00\x00\x07\x21\x03"; // response from SC to init_after_all_chan[] 
     
    8990 
    9091 
     92void RXD_RS485(void) 
     93{ 
     94  IOCLR1 = DIR_RS485;           // RS485 Direction = 0 (Receive) 
     95} /* RXD_RS485 */ 
     96 
     97void TXD_RS485(void)  
     98{ 
     99  delay(500000); 
     100  IOSET1 = DIR_RS485;           // RS485 Direction = 1 (Transmit) 
     101} /* TXD_RS485 */ 
     102 
     103 
    91104 
    92105void testUART3(void) 
     
    256269  { 
    257270    case SOL_NO_INIT: 
     271      delay(500000); 
    258272      init_serial3(); 
    259273      resetUart3RxBuf(); /* init */ 
     
    261275 
    262276      TXD_RS485(); 
     277      delay(500000); 
    263278       /* send init 1 */ 
    264279      send_uart3((unsigned char *)init1, sizeof(init1)); 
     
    317332        break; 
    318333      case 6: 
    319         /* we are through with all the channels, send the final init */ 
    320         send_uart3((unsigned char *)init_after_all_chan, sizeof(init_after_all_chan)); 
     334        /* we are through with all the channels, ready to send next init for next query round */ 
    321335        solarState = SOL_FINISHED; 
    322336        break; 
     
    327341     if (solarState != SOL_FINISHED) 
    328342     { 
    329       solarState = SOL_CHAN_WAIT_REPLY; 
     343      solarState = SOL_CHAN_WAIT_REPLY; /* wait for reply if not finished */ 
    330344     } /* if */ 
    331345    break; 
     
    373387        { 
    374388          chanVolt[currentChannel] = rxUART3[11]; 
    375           chanWatt[currentChannel] = (int)rxUART3[7] | (((int)(rxUART3[6])) << 8) /* index 7: LSB, index 6: MSB */; 
     389          chanWatt[currentChannel] = (int)(rxUART3[7]) | (((int)(rxUART3[8])) << 8) /* index 7: LSB, index 8: MSB */; 
    376390        } /* if */ 
    377         /* finally, discard data from buffer */ 
    378         resetUart3RxBuf(); 
    379  
    380         /* switch to next channel */ 
    381         currentChannel++; 
    382         /* now ready to query channel data for next channel */ 
    383         solarState = SOL_CHAN; 
     391 
     392        if (currentChannel != 6) 
     393        { 
     394          /* we received input from channel 0 to 5 */ 
     395 
     396          /* finally, discard data from buffer */ 
     397          resetUart3RxBuf(); 
     398   
     399          /* switch to next channel */ 
     400          currentChannel++; 
     401          /* now ready to query channel data for next channel */ 
     402          solarState = SOL_CHAN; 
     403        } 
     404        else 
     405        { 
     406          /* we received the finishing sequence */ 
     407          solarState = SOL_NO_INIT; /* restart the measurement cycle */ 
     408        } 
     409 
    384410      } 
    385411      else 
     
    495521void delay(unsigned long int count1) 
    496522{ 
    497   while(count1 > 0) {count1--;}                                                         // Loop Decrease Counter         
     523  volatile unsigned long int countVol; 
     524  countVol = count1; 
     525  while(countVol > 0) {countVol--;}                                                             // Loop Decrease Counter         
    498526} 
    499527