//----------------------------------------
// Introduction
printf("\n/---------------------------------------------\n");
- printf(" The following is a test excersize of the\n"
+ printf(" The following is a test excersize of the\n"
" 1-Wire Net public domain library Version 2.00.\n\n"
" This test was run using with 2 DS1920's (DS1820),\n"
" 1 DS1971 (DS2430), and 1 DS1996.\n\n");
owFamilySearchSetup(portnum,0x0C);
- // find the next device
- printf("search result %d\n",owNext(portnum,TRUE, FALSE));
+ // find the first 0x0c device
+ TempSerialNum[0]=0;
+ while (TempSerialNum[0]!=0x0c && owNext(portnum,TRUE,FALSE)) {
+ owSerialNum(portnum,TempSerialNum,TRUE);
+ }
+ printf("search result %d\n",TempSerialNum[0]==0x0c);
// print the Serial Number of the device just found
PrintSerialNum(portnum);
for (j = 0; j < 4; j++)
{
for (i = 0; i < 29; i++)
- tran_buffer[i] = (uchar)i + j;
+ tran_buffer[i] = (uchar)i + j;
printf("Write page %d: %d\n",j,owWritePacketStd(portnum,j,tran_buffer,29,FALSE,FALSE));
for (i = 0; i < 2000; i++)
tran_buffer[i] = i % 255;
printf("Format and write file DEMO.000 %d\n",
- owFormatWriteFile(portnum,filename,2000,tran_buffer));
+ owFormatWriteFile(portnum,filename,2000,tran_buffer));
+
// clear the buffer
for (i = 0; i < 2000; i++)
- tran_buffer[i] = 0;
+ tran_buffer[i] = 0x55;
+ _asm ;johan _endasm;
printf("Read file DEMO.000 %d\n",owReadFile(portnum,filename,tran_buffer));
// print the data result
for (i = 0; i < 2000; i++)
//----------------------------------------
// Turn off overdrive
printf("\n/---------------------------------------------\n");
+ _asm ;johan 7 _endasm;
printf("TEST%d: Turn off overdrive\n",testcnt++);
printf("Set 1-Wire Net speed to normal %d\n",owSpeed(portnum,MODE_NORMAL));
//----------------------------------------
// Verify a device
printf("\n/---------------------------------------------\n");
+ _asm ;johan 8 _endasm;
printf("TEST%d: Verify the current device\n",testcnt++);
printf("owVerify (normal) %d\n",owVerify(portnum,FALSE));
//----------------------------------------
// Skip the first family code found
printf("\n/---------------------------------------------\n");
+ _asm ;johan 9 _endasm;
printf("TEST%d: Skip the first family code found\n",testcnt++);
// find the next device
//----------------------------------------
// Find first family code (DS1920) and read temperature
printf("\n/---------------------------------------------\n");
+ _asm ;johan 10 _endasm;
printf("TEST%d: Find first family code (DS1920) and read temperature\n",testcnt++);
// find the next device
//----------------------------------------
// Verify the current device, could also be alarming
printf("\n/---------------------------------------------\n");
+ _asm ;johan 11 _endasm;
printf("TEST%d: Verify the current device, could also be alarming\n",testcnt++);
printf("owVerify (normal) %d\n",owVerify(portnum,FALSE));
//----------------------------------------
// Test setting the Serial Number with owSerialNum
printf("\n/---------------------------------------------\n");
+ _asm ;johan 12 _endasm;
printf("TEST%d: Test setting the Serial Number with owSerialNum\n",testcnt++);
// set the Serial Num to 0 to 7
//----------------------------------------
// Verify the current device (should fail, no such device)
printf("\n/---------------------------------------------\n");
+ _asm ;johan 13 _endasm;
printf("TEST%d: Verify the current device (should fail, no such device)\n",testcnt++);
printf("owVerify (normal) %d\n",owVerify(portnum,FALSE));