Now qork quering bus

This commit is contained in:
WarL0ck 2013-11-17 21:26:03 +07:00
parent 1a94919199
commit 7047bc7fa2
3 changed files with 17 additions and 9 deletions

View File

@ -1 +1 @@
<AVRStudio><MANAGEMENT><ProjectName>Rmodule</ProjectName><Created>14-Nov-2013 11:48:57</Created><LastEdit>15-Nov-2013 14:38:09</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>14-Nov-2013 11:48:57</Created><Version>4</Version><Build>4, 19, 0, 730</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\Rmodule.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Hard\Git\Rmodule\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega8.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>uart\uart.c</SOURCEFILE><SOURCEFILE>onewire\onewire.c</SOURCEFILE><SOURCEFILE>uart\uart_addon.c</SOURCEFILE><HEADERFILE>uart\uart.h</HEADERFILE><HEADERFILE>res\strings.h</HEADERFILE><HEADERFILE>onewire\onewire.h</HEADERFILE><HEADERFILE>uart\uart_addon.h</HEADERFILE><OTHERFILE>default\Rmodule.lss</OTHERFILE><OTHERFILE>default\Rmodule.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega8</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Rmodule.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>main.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>res\strings.h</FileName><Status>1</Status></File00001></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> <AVRStudio><MANAGEMENT><ProjectName>Rmodule</ProjectName><Created>14-Nov-2013 11:48:57</Created><LastEdit>17-Nov-2013 15:50:59</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>14-Nov-2013 11:48:57</Created><Version>4</Version><Build>4, 19, 0, 730</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\Rmodule.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>c:\Hard\Rmodule\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega8.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>uart\uart.c</SOURCEFILE><SOURCEFILE>onewire\onewire.c</SOURCEFILE><SOURCEFILE>C:\Hard\Rmodule\uart\uart_addon.c</SOURCEFILE><HEADERFILE>uart\uart.h</HEADERFILE><HEADERFILE>res\strings.h</HEADERFILE><HEADERFILE>onewire\onewire.h</HEADERFILE><HEADERFILE>C:\Hard\Rmodule\uart\uart_addon.h</HEADERFILE><OTHERFILE>default\Rmodule.lss</OTHERFILE><OTHERFILE>default\Rmodule.map</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega8</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Rmodule.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>main.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\Atmel\AVR Tools\AVR Toolchain\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><ProjectFiles><Files><Name>c:\Hard\Rmodule\uart\uart.h</Name><Name>c:\Hard\Rmodule\res\strings.h</Name><Name>c:\Hard\Rmodule\onewire\onewire.h</Name><Name>c:\Hard\Rmodule\main.c</Name><Name>c:\Hard\Rmodule\uart\uart.c</Name><Name>c:\Hard\Rmodule\onewire\onewire.c</Name></Files></ProjectFiles><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>onewire\onewire.h</FileName><Status>1</Status></File00001></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>

View File

@ -23,27 +23,35 @@ void getListDevices(void){
uint8_t i; uint8_t i;
uint8_t id[OW_ROMCODE_SIZE]; uint8_t id[OW_ROMCODE_SIZE];
uint8_t diff, nSensors; uint8_t diff, nSensors;
char buffer[40];
uart_puts_p("\r\nScanning 1-wire bus\r\n"); uart_puts("\r\nScanning 1-wire bus\r\n");
ow_reset(); ow_reset();
nSensors = 0; nSensors = 0;
diff = OW_SEARCH_FIRST; diff = OW_SEARCH_FIRST;
while ( diff != OW_LAST_DEVICE) { while ( diff != OW_LAST_DEVICE) {
diff = ow_rom_search( diff, &id[0] ); diff = ow_rom_search( diff, &id[0] );
if ( diff != OW_PRESENCE_ERR && diff != OW_DATA_ERR && diff != OW_LAST_DEVICE ) { //if ( diff != OW_PRESENCE_ERR && diff != OW_DATA_ERR && diff != OW_LAST_DEVICE ) {
for ( i=0; i < OW_ROMCODE_SIZE; i++ ){ for ( i=0; i < OW_ROMCODE_SIZE; i++ ){
uart_puthex_byte(id[i]); sprintf(buffer,"%02X ",id[i]);
uart_puts_p( " " ); uart_puts(buffer);
} }
uart_puts("\r\n"); uart_puts("\r\n");
} //}
nSensors++; nSensors++;
} }
sprintf(buffer,"Found %d devices",nSensors);
uart_puts(buffer);
} }
int main(void) int main(void){
{
uart_init(UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU)); uart_init(UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU));
#ifndef OW_ONE_BUS
ow_set_bus(&PIND,&PORTD,&DDRD,PD6);
#endif
sei();
char cmd = '0'; char cmd = '0';
while (cmd != 'q'){ while (cmd != 'q'){
uart_puts_p(MainMenuItemTitle); uart_puts_p(MainMenuItemTitle);

View File

@ -1 +1 @@
<AVRWorkspace><IOSettings><CurrentRegisters/></IOSettings><part name="ATMEGA8"/><Files><File00000 Name="C:\Hard\Git\Rmodule\main.c" Position="268 118 1398 608" LineCol="7 0"/><File00001 Name="C:\Hard\Git\Rmodule\res\strings.h" Position="290 140 1434 622" LineCol="10 0"/></Files></AVRWorkspace> <AVRWorkspace><IOSettings><CurrentRegisters><EEPROM><register register="EEAR" group="EEPROM" display="1" locked="0"/></EEPROM><EEPROM><register register="EECR" group="EEPROM" display="1" locked="0"/></EEPROM><EEPROM><register register="EEDR" group="EEPROM" display="1" locked="0"/></EEPROM></CurrentRegisters></IOSettings><part name="ATMEGA8"/><Files><File00000 Name="c:\Hard\Rmodule\main.c" Position="262 96 1079 813" LineCol="33 0" State="Maximized"/><File00001 Name="c:\Hard\Rmodule\onewire\onewire.h" Position="288 145 895 613" LineCol="20 0" State="Maximized"/></Files></AVRWorkspace>