| 
void StartReadRom() {
    owbuf[0] = CMD_ROM;
    nwrite = 1;
    nread = 8;
    ow_start();
}
 | 
| #define OW_OUTPUT (LPC_GPIO0->DIR |= (1 << OW_PIN)) #define OW_INPUT (LPC_GPIO0->DIR &= ~(1 << OW_PIN)) #define OW_LOW (LPC_GPIO0->CLR = 1 << OW_PIN) #define OW_HIGH (LPC_GPIO0->SET = (1 << OW_PIN)) #define OW_SENSE (LPC_GPIO0->PIN & (1 << OW_PIN)) | 
| 
__task void pdoTask (void)  // on of the RTOS tasks
{
...
     for(;;)
     {
              os_dly_wait (delay);
              ow_read_temp(&temperature, NULL);
         ...
     }
...
}
...
int main (void)
{
...
    LPC_IOCON->R_PIO0_11 = (1<<0);
    ow_init();
    ow_find_devices();
...
os_sys_init(init); // RTOS call
}
 | 
| 
#define SENSORS 3
 
RomType t_sensor[SENSORS];
unsigned short t_val;     //temperature value
short temperature[SENSORS];    //temperature *10 (to avoid float)
unsigned char result=0;     //result
volatile unsigned int msTicks;   //ms counter
unsigned char sensor_counter;   //counter for sensor loop
 
void SysTick_Handler(void)     //Interrupt handler
{
 msTicks++;
}
 
int main(void)
{
...
 SysTick_Config(SystemCoreClock / 1000);//SysTick Timer 1 msec interrupts
 UARTInit(115200);      //uart init 115k
 printf("LPC11_DS18S20 Init..."__DATE__" "__TIME__"\n");
 ow_init();        //init ow
 ow_find_devices();      //find devices and show 64-Bit Serial Code 
 printf("...done\n");
 t_sensor[0].l = 0xe900080225bd2a10ull; //64-Bit Serial Code sensor #1
 t_sensor[1].l = 0x8c00080225dbb910ull; //64-Bit Serial Code sensor #2
 t_sensor[2].l = 0x9200080225f7ff10ull; //64-Bit Serial Code sensor #3
 ...
 while(1)
 {          //loop
...
//read sensors
  for(sensor_counter=0;sensor_counter<SENSORS;sensor_counter++)
  {
   if(ow_read_temp(&t_val,&t_sensor[sensor_counter]))
   {
    printf("Error Sensor %d\n",(sensor_counter+1));
   }
   else
   {
    temperature[sensor_counter] = (t_val *5);  //read uint to int
    printf("Temperature #%d: %d\n",sensor_counter+1,temperature[sensor_counter]);
   }
  }          //end sensor loop
 ... 
 }          //end loop
 return 0 ;
}
 | 
