• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ow_reset函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ow_reset函数的典型用法代码示例。如果您正苦于以下问题:C++ ow_reset函数的具体用法?C++ ow_reset怎么用?C++ ow_reset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ow_reset函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: writeSP

// write to scratchpad of a SINGLE sensor
void writeSP(int brdNo) {
    int i;
    int get[8];

    ow_reset();
    write_byte(0xCC);
    write_byte(0x4E);
    write_byte(brdNo);
    write_byte(0x0);
    write_byte(0x7F);
    while(read_bit() == 0);

    ow_reset();
    write_byte(0xCC);
    write_byte(0x48);
    uDelay(120);

    ow_reset();
    write_byte(0xCC);
    uDelay(120);
    write_byte(0xBE);
    for (i = 0 ; i < 9 ; i++){
        get[i] = read_byte();
    }

    if(get[2] != brdNo || get[3] != 0 || get[4] != 0x7F) {
        UART_printf("BAD CONFIGURATION?\n");
    }
}
开发者ID:sunswift,项目名称:sunswift.bms,代码行数:30,代码来源:onewire.c


示例2: ow_read_temperature

int ow_read_temperature(void)
{
	char get[10];
	char temp_lsb,temp_msb;
	int k;
	char temp_c;
	//char temp_f;
	ow_reset();
	ow_write_byte(0xCC); //Skip ROM
	ow_write_byte(0x44); // Start Conversion
	delay_usec(119); //wait 120us
	ow_reset();
	ow_write_byte(0xCC); // Skip ROM
	ow_write_byte(0xBE); // Read Scratch Pad
	for (k=0; k<9; k++) {
		get[k] = ow_read_byte();
	}
	temp_msb = get[1]; // Sign byte + lsbit
	temp_lsb = get[0]; // Temp data plus lsb
	if (temp_msb <= 0x80){temp_lsb = (temp_lsb/2);} // shift to get whole degree
	temp_msb = temp_msb & 0x80; // mask all but the sign bit
	if (temp_msb >= 0x80) {temp_lsb = (~temp_lsb)+1;} // twos complement
	if (temp_msb >= 0x80) {temp_lsb = (temp_lsb/2);}// shift to get whole degree
	if (temp_msb >= 0x80) {temp_lsb = ((-1)*temp_lsb);} // add sign bit
	temp_c = temp_lsb; // ready for conversion to Fahrenheit
	//temp_f = (((int)temp_c)* 9)/5 + 32;
	return temp_c;
}
开发者ID:whereswaldon,项目名称:ds18b20-acx-driver,代码行数:28,代码来源:ds18b20.c


示例3: DS18X20_get_power_status

/* get power status of DS18x20
   input  : id = rom_code
   returns: DS18X20_POWER_EXTERN or DS18X20_POWER_PARASITE */
uint8_t	DS18X20_get_power_status(uint8_t id[])
{
	uint8_t pstat;
    ow_reset();
    ow_command(DS18X20_READ_POWER_SUPPLY, id);
    pstat=ow_bit_io(1); // pstat 0=is parasite/ !=0 ext. powered
    ow_reset();
	return (pstat) ? DS18X20_POWER_EXTERN:DS18X20_POWER_PARASITE;
}
开发者ID:rungokarol,项目名称:AquariumAVR,代码行数:12,代码来源:ds18x20.c


示例4: ds18x20_get_power_status

unsigned char ds18x20_get_power_status(void) 
{ 
    ow_reset(); 
    send_selected_rom(); 
    ow_put_byte(READ_POWER_SUPPLY); 
    power_status=ow_get_bit(); 
    ow_reset();


return(power_status); 
} 
开发者ID:gxp,项目名称:node,代码行数:11,代码来源:hal_ds18b20.c


示例5: ds18x20_get_scratchpad

void ds18x20_get_scratchpad(unsigned char *mem_array) 
{ 
unsigned char x=0;

    ow_reset(); 
    send_selected_rom(); 
    ow_put_byte(READ_SCRATCHPAD); 
    for(x=0; x<9; x++) {*(mem_array+x)=ow_get_byte(); } 
    ow_reset();

return; 
} 
开发者ID:gxp,项目名称:node,代码行数:12,代码来源:hal_ds18b20.c


示例6: OneWireInit

void OneWireInit(void)
{
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE);
  ow_reset();

  ow_write_byte(0xcc);
  ow_write_byte(0x4e);
  ow_write_byte(0);
  ow_write_byte(0);
  ow_write_byte(0x60); // 12 bit
  ow_reset();
}
开发者ID:flodur1,项目名称:redbull,代码行数:12,代码来源:main.c


示例7: tempSense

/* tempSense() - returns temperature (in celcius) of device ROM
 * to specify which device is read, pass in the index of the device (ROM)
 * in the foundROM array
 *
 * FINDING THE BOARD NUMBER OF A TEMPERATURE READ
 * The board number is returned as the 16 MSB of tempSense()'s return
 * value
 * i.e. for temperature = tempSense(x) | 0x7F
 * i.e. for board number = tempSense(x) >> 16
 */
int tempSense(int ROM) {
    char get[10];
    char temp_lsb, temp_msb;
    int k, i;
    
    ow_reset();
    write_byte(0x55);
    uDelay(10);

    for(i = 0 ; i < 8 ; i++) {
        write_byte(FoundROM[ROM][i]);
    }
    write_byte(0x44); // Start Conversion
    uDelay(102);
    
    ow_reset();
    write_byte(0x55);
    uDelay(10);
    for(i = 0 ; i < 8 ; i++) {
        write_byte(FoundROM[ROM][i]);
    }

    // Read Scratch Pad
    write_byte(0xBE);
    for (k=0;k<9;k++){
        get[k]=read_byte();
    }

    temp_msb = get[1]; // Sign byte + lsbit
    temp_lsb = get[0]; // Temp data plus lsb

    // shift to get whole degree
    if (temp_msb <= 0x80)
        temp_lsb = (temp_lsb/2);

    // mask all but the sign bit
    temp_msb = temp_msb & 0x80;
    
    // twos complement
    if (temp_msb >= 0x80)
        temp_lsb = (~temp_lsb)+1;

    // shift to get whole degree
    if (temp_msb >= 0x80)    
        temp_lsb = (temp_lsb/2);

    // add sign bit
    if (temp_msb >= 0x80)
        temp_lsb = ((-1)*temp_lsb);

    return (int)temp_lsb | get[2] << 16;
}
开发者ID:sunswift,项目名称:sunswift.bms,代码行数:62,代码来源:onewire.c


示例8: FindDevices

// FIND DEVICES
uint8_t FindDevices(void) {
    unsigned char m;

    // Begins when a presence is detected
    if(!ow_reset()) {
        // Begins when at least one part is found
        if(First()) {
            numROMs=0;

            do {
                numROMs++;
                for(m=0;m<8;m++) {
                    // Identifies ROM number on found device
                    FoundROM[numROMs][m]=ROM[m];
                }
#if OW_DEBUG
                UART_printf("\nSENSOR = %d ROM = %02X %02X %02X %02X %02X %02X %02X %02X\n", 
                    numROMs + 1, FoundROM[numROMs][0],FoundROM[numROMs][1],
                    FoundROM[numROMs][2],FoundROM[numROMs][3], FoundROM[numROMs][4],
                    FoundROM[numROMs][5],FoundROM[numROMs][6],FoundROM[numROMs][7]);
#endif
            } while (Next()&&(numROMs<=NO_ROMS)); //Continues until no additional devices are found
        }
    }
    
    return numROMs;
}
开发者ID:sunswift,项目名称:sunswift.bms,代码行数:28,代码来源:onewire.c


示例9: ds18b20_recall_eeprom

void ds18b20_recall_eeprom()
{
    ow_reset();
    ow_write_byte(0xCC);
    ow_write_byte(0xB8);
    __delay_us(50);
}
开发者ID:dnivanthaka,项目名称:PICMPLABX-Projects,代码行数:7,代码来源:ds18b20.c


示例10: ds18b20_read_rom

void ds18b20_read_rom(struct ds18b20 *dev)
{
    //uint8_t romid[8];

    //ow_init();
    ow_reset();
    ow_write_byte(0x33);
    dev->romcode[0] = ow_read_byte();
    dev->romcode[1] = ow_read_byte();
    dev->romcode[2] = ow_read_byte();
    dev->romcode[3] = ow_read_byte();
    dev->romcode[4] = ow_read_byte();
    dev->romcode[5] = ow_read_byte();
    dev->romcode[6] = ow_read_byte();
    dev->romcode[7] = ow_read_byte();


    //printf("id 1 = %x\r\n", dev->romcode[0]);
    //printf("id 2 = %x\r\n", dev->romcode[1]);
    //printf("id 3 = %x\r\n", dev->romcode[2]);
    //printf("id 4 = %x\r\n", dev->romcode[3]);
    //printf("id 5 = %x\r\n", dev->romcode[4]);
    //printf("id 6 = %x\r\n", dev->romcode[5]);
    //printf("id 7 = %x\r\n", dev->romcode[6]);
    //printf("id 8 = %x\r\n", dev->romcode[7]);

    //*(id)     = romid[1] | romid[0];
    //*(id + 1) = romid[3] | romid[2];
    //dev->address[0] = ((((unsigned long)romid[3] << 8) | (unsigned long)romid[2]) << 16) | (((unsigned long)romid[1] << 8) | romid[0]);
    //dev->address[1] = ((((unsigned long)romid[7] << 8) | (unsigned long)romid[6]) << 16) | (((unsigned long)romid[5] << 8) | romid[4]);

    //printf("Address 1 = %ld\r\n", dev->address[0]);
    //printf("Address 2 = %ld\r\n", dev->address[1]);
}
开发者ID:dnivanthaka,项目名称:PICMPLABX-Projects,代码行数:34,代码来源:ds18b20.c


示例11: search_sensors

static uint8_t search_sensors(void)
{
  uint8_t i;
  uint8_t id[OW_ROMCODE_SIZE];
  uint8_t diff, nSensors;

  ow_reset();

  nSensors = 0;

  diff = OW_SEARCH_FIRST;
  while ( diff != OW_LAST_DEVICE && nSensors < MAXSENSORS ) {
    DS18X20_find_sensor( &diff, &id[0] );

    if( diff == OW_PRESENCE_ERR ) {
      break;
    }

    if( diff == OW_DATA_ERR ) {
      break;
    }

    for ( i=0; i < OW_ROMCODE_SIZE; i++ ) {
      gSensorIDs[nSensors][i] = id[i];
    }

    nSensors++;
  }

  return nSensors;
}
开发者ID:davidmonro,项目名称:radio-remote-temp-sensor,代码行数:31,代码来源:radio-temp-sensor.c


示例12: search_sensors

uint8_t search_sensors(void)
{
    uint8_t i;
    uint8_t id[OW_ROMCODE_SIZE];
    uint8_t diff, nSensors;
    ow_reset();
    nSensors = 0;
    diff = OW_SEARCH_FIRST;
    while (diff != OW_LAST_DEVICE && nSensors < MAXSENSORS) {
        ds18b20_find_sensor(&diff, &id[0]);
        if (diff == OW_PRESENCE_ERR) {

            //printf("no sensors\n");
            break;
        }
        if (diff == OW_DATA_ERR) {

            //printf("bus error\n");
            break;
        }
        for (i = 0; i < OW_ROMCODE_SIZE; i++)
            sensor_ids[nSensors][i] = id[i];
        nSensors++;
    }
    return nSensors;
}
开发者ID:qartis,项目名称:dori,代码行数:26,代码来源:onewire.c


示例13: Read1820

port_width Read1820(port_width error)
{
 uint8_t l, m, pokus=0;
 port_width errormask = (port_width)0x0001;

//???;*'vysledkom je 16 bytov v buffroch: 8x1.byte+8x2.byte...
	do
	{
		owire(0xBE,error);		//read scratch, save it to 1Wbuff, read 9 bytes, switch off power after finish)
		for(l = 0;l<8;l++)
		{
			ow_inp(OWbuff,l,error);	//zacinaj ukladat data vzdy od 1. dallasu byte "l"
		}
		ow_reset(error);
		error = CheckCRC_8(OWbuff,error,8); 	//checkCRC
		pokus++;
	}while(error && (pokus < 5));			//cyklus, kym error !=0 alebo try=3 (tri pokusy o spravne nacitanie)
  	ow_rstprt(error);
  	
  	if(error)		//ak bola chyba v comm, tak data pri chybe = 0xFF
  	{
  		for(l=0;l<D_NUM;l++)
  		{
  			if(error & errormask)
  			{
  				for(m=0;m<8;m++)
  					OWbuff[l].data[m] = 0xFF;
  			}
  			errormask<<=1;	
  		}
  	}
  	return(error);
}
开发者ID:armsvb,项目名称:dhc-bee2hive,代码行数:33,代码来源:ds1820.c


示例14: search_sensors

static uint8_t search_sensors(void)
{
    uint8_t i;
    uint8_t id[OW_ROMCODE_SIZE];
    uint8_t diff, nSensors;

    uart_puts_P( NEWLINESTR "Scanning Bus for DS18X20" NEWLINESTR );

    ow_reset();

    nSensors = 0;

    diff = OW_SEARCH_FIRST;
    while ( diff != OW_LAST_DEVICE && nSensors < MAXSENSORS ) {
        DS18X20_find_sensor( &diff, &id[0] );

        if( diff == OW_PRESENCE_ERR ) {
            uart_puts_P( "No Sensor found" NEWLINESTR );
            break;
        }

        if( diff == OW_DATA_ERR ) {
            uart_puts_P( "Bus Error" NEWLINESTR );
            break;
        }

        for ( i=0; i < OW_ROMCODE_SIZE; i++ )
            gSensorIDs[nSensors][i] = id[i];

        nSensors++;
    }

    return nSensors;
}
开发者ID:Andy1978,项目名称:Brautomat,代码行数:34,代码来源:main.c


示例15: ow_reset_demo

void ow_reset_demo(void)
{
    unsigned char c1;

    clear_screen();
    printf("1-Wire-Reset: Test, ob JEMAND am Bus angeschlossen ist\n");
    printf("======================================================\n");
    printf("(Beenden durch Eingabe von 'e')");
    printf("\n\nStart des Tests:  Taste druecken ... ");

    while(1)
    {
        set_cursor(7,2); printf("                                      ");
        set_cursor(7,2);
        c1=getchar();
        if (c1 == 'e') break;        // Rücksprung

        // 1-Wire Reset durchführen
        if (ow_reset()) printf("  Test NEGATIV:  Keiner da !\n");
        else printf("  Test POSITIV:  Mindestens EINER da !\n");

        printf("\n\nWeiter - Taste druecken ... ");
        c1 = getchar();
    }
}
开发者ID:eddyst,项目名称:Arduino,代码行数:25,代码来源:ds2450_demo_1.c


示例16: search_sensors

uint8_t search_sensors(void)
{
    uint8_t i;
    uint8_t id[OW_ROMCODE_SIZE];
    uint8_t diff, nSensors;

    ow_reset();

    nSensors = 0;

    diff = OW_SEARCH_FIRST;
    while ( diff != OW_LAST_DEVICE && nSensors < MAXSENSORS ) {
        DS18X20_find_sensor( &diff, &id[0] );

        if( diff == OW_PRESENCE_ERR ) {
//            CDC_Device_SendString (&VirtualSerial_CDC_InterfaceR, "No Sensor found \n\r");
            break;
        }

        if( diff == OW_DATA_ERR ) {
//            CDC_Device_SendString (&VirtualSerial_CDC_InterfaceR, "Bus Error \n\r");
            break;
        }

        for ( i=0; i < OW_ROMCODE_SIZE; i++ )
            gSensorIDs[nSensors][i] = id[i];

        nSensors++;
    }

    return nSensors;
}
开发者ID:turboaffe,项目名称:watercooling,代码行数:32,代码来源:temp_sensors.c


示例17: owchip_geteui

void owchip_geteui(uint8_t* eui) {          // >= 6000us
   uint8_t  id[8];
   int      retry;
   int      crc;
   uint8_t* byte;
   uint16_t oldTactl;
   
   retry = 5;
   memset(eui,0,8);
   
   // store current value of TACTL
   oldTactl   = TACTL;
   
   // start timer in continuous mode at 1MHz
   TACTL      = TASSEL_2 | ID_2 | MC_2;
   
   owpin_init();
   while (retry-- > 0) {
      crc = 0;
      
      if(ow_reset()) {
         ow_write_byte(0x33); //read rom
         for(byte=id+7; byte>=id; byte--) {
            crc = crc8_byte( crc, *byte=ow_read_byte() );
         }
         if(crc==0) {
            // CRC valid
            memcpy(eui,id,8);
         }
      }
   }
   
   // restore value of TACTL
   TACTL = oldTactl;
}
开发者ID:barriquello,项目名称:iotstack,代码行数:35,代码来源:00std_eui64.c


示例18: ow_set_bus

void ow_set_bus(volatile uint8_t* in, volatile uint8_t* out,volatile uint8_t* ddr,uint8_t pin)
{
	OW_DDR=ddr;
	OW_OUT=out;
	OW_IN=in;
	OW_PIN_MASK=(1<<pin);
	ow_reset();
}
开发者ID:AntmanLFE,项目名称:hetnet_avr-uip,代码行数:8,代码来源:onewire.c


示例19: ds18b20_start

static void ds18b20_start(void)
{
	ow_reset();

	ow_skip_rom();

	ow_write_byte(DS18B20_CMD_CONVERT_T);
}
开发者ID:jmesmon,项目名称:reefdemon,代码行数:8,代码来源:ds18b20.c


示例20: ow_command

void
ow_command(uint8_t cmd, uint8_t pin)
{
  ow_reset(pin);
  /* To all devices */
  ow_write_byte(OW_SKIP_ROM, pin);
  ow_write_byte(cmd, pin);
}
开发者ID:sladeware,项目名称:bbos,代码行数:8,代码来源:onewire_bus.c



注:本文中的ow_reset函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ owner函数代码示例发布时间:2022-05-30
下一篇:
C++ ovs_vport_free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap