亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? owihighlevelfunctions.c

?? 達拉斯 1-Wire 主機通信 這份資料展示了如何把 1-Wire 主機通信在應用到一個AVR系統中
?? C
字號:
// This file has been prepared for Doxygen automatic documentation generation.
/*! \file ********************************************************************
*
* Atmel Corporation
*
* \li File:               OWIHighLevelFunctions.c
* \li Compiler:           IAR EWAAVR 3.20a
* \li Support mail:       avr@atmel.com
*
* \li Supported devices:  All AVRs.
*
* \li Application Note:   AVR318 - Dallas 1-Wire(R) master.
*                         
*
* \li Description:        High level functions for transmission of full bytes
*                         on the 1-Wire(R) bus and implementations of ROM
*                         commands.
*
*                         $Revision: 1.7 $
*                         $Date: Thursday, August 19, 2004 14:27:18 UTC $
****************************************************************************/

#include <ioavr.h>

#include "OWIHighLevelFunctions.h"
#include "OWIBitFunctions.h"
#include "OWIPolled.h"


/*! \brief  Sends one byte of data on the 1-Wire(R) bus(es).
 *  
 *  This function automates the task of sending a complete byte
 *  of data on the 1-Wire bus(es).
 *
 *  \param  data    The data to send on the bus(es).
 *  
 *  \param  pins    A bitmask of the buses to send the data to.
 */
void OWI_SendByte(unsigned char data, unsigned char pins)
{
    unsigned char temp;
    unsigned char i;
    
    // Do once for each bit
    for (i = 0; i < 8; i++)
    {
        // Determine if lsb is '0' or '1' and transmit corresponding
        // waveform on the bus.
        temp = data & 0x01;
        if (temp)
        {
            OWI_WriteBit1(pins);
        }
        else
        {
            OWI_WriteBit0(pins);
        }
        // Right shift the data to get next bit.
        data >>= 1;
    }
}


/*! \brief  Receives one byte of data from the 1-Wire(R) bus.
 *
 *  This function automates the task of receiving a complete byte 
 *  of data from the 1-Wire bus.
 *
 *  \param  pin     A bitmask of the bus to read from.
 *  
 *  \return     The byte read from the bus.
 */
unsigned char OWI_ReceiveByte(unsigned char pin)
{
    unsigned char data;
    unsigned char i;

    // Clear the temporary input variable.
    data = 0x00;
    
    // Do once for each bit
    for (i = 0; i < 8; i++)
    {
        // Shift temporary input variable right.
        data >>= 1;
        // Set the msb if a '1' value is read from the bus.
        // Leave as it is ('0') else.
        if (OWI_ReadBit(pin))
        {
            // Set msb
            data |= 0x80;
        }
    }
    return data;
}


/*! \brief  Sends the SKIP ROM command to the 1-Wire bus(es).
 *
 *  \param  pins    A bitmask of the buses to send the SKIP ROM command to.
 */
void OWI_SkipRom(unsigned char pins)
{
    // Send the SKIP ROM command on the bus.
    OWI_SendByte(OWI_ROM_SKIP, pins);
}


/*! \brief  Sends the READ ROM command and reads back the ROM id.
 *
 *  \param  romValue    A pointer where the id will be placed.
 *
 *  \param  pin     A bitmask of the bus to read from.
 */
void OWI_ReadRom(unsigned char * romValue, unsigned char pin)
{
    unsigned char bytesLeft = 8;

    // Send the READ ROM command on the bus.
    OWI_SendByte(OWI_ROM_READ, pin);
    
    // Do 8 times.
    while (bytesLeft > 0)
    {
        // Place the received data in memory.
        *romValue++ = OWI_ReceiveByte(pin);
        bytesLeft--;
    }
}


/*! \brief  Sends the MATCH ROM command and the ROM id to match against.
 *
 *  \param  romValue    A pointer to the ID to match against.
 *
 *  \param  pins    A bitmask of the buses to perform the MATCH ROM command on.
 */
void OWI_MatchRom(unsigned char * romValue, unsigned char pins)
{
    unsigned char bytesLeft = 8;   
    
    // Send the MATCH ROM command.
    OWI_SendByte(OWI_ROM_MATCH, pins);

    // Do once for each byte.
    while (bytesLeft > 0)
    {
        // Transmit 1 byte of the ID to match.
        OWI_SendByte(*romValue++, pins);
        bytesLeft--;
    }
}


/*! \brief  Sends the SEARCH ROM command and returns 1 id found on the 
 *          1-Wire(R) bus.
 *
 *  \param  bitPattern      A pointer to an 8 byte char array where the 
 *                          discovered identifier will be placed. When 
 *                          searching for several slaves, a copy of the 
 *                          last found identifier should be supplied in 
 *                          the array, or the search will fail.
 *
 *  \param  lastDeviation   The bit position where the algorithm made a 
 *                          choice the last time it was run. This argument 
 *                          should be 0 when a search is initiated. Supplying 
 *                          the return argument of this function when calling 
 *                          repeatedly will go through the complete slave 
 *                          search.
 *
 *  \param  pin             A bit-mask of the bus to perform a ROM search on.
 *
 *  \return The last bit position where there was a discrepancy between slave addresses the last time this function was run. Returns OWI_ROM_SEARCH_FAILED if an error was detected (e.g. a device was connected to the bus during the search), or OWI_ROM_SEARCH_FINISHED when there are no more devices to be discovered.
 *
 *  \note   See main.c for an example of how to utilize this function.
 */
unsigned char OWI_SearchRom(unsigned char * bitPattern, unsigned char lastDeviation, unsigned char pin)
{
    unsigned char currentBit = 1;
    unsigned char newDeviation = 0;
    unsigned char bitMask = 0x01;
    unsigned char bitA;
    unsigned char bitB;

    // Send SEARCH ROM command on the bus.
    OWI_SendByte(OWI_ROM_SEARCH, pin);
    
    // Walk through all 64 bits.
    while (currentBit <= 64)
    {
        // Read bit from bus twice.
        bitA = OWI_ReadBit(pin);
        bitB = OWI_ReadBit(pin);

        if (bitA && bitB)
        {
            // Both bits 1 (Error).
            newDeviation = OWI_ROM_SEARCH_FAILED;
            return;
        }
        else if (bitA ^ bitB)
        {
            // Bits A and B are different. All devices have the same bit here.
            // Set the bit in bitPattern to this value.
            if (bitA)
            {
                (*bitPattern) |= bitMask;
            }
            else
            {
                (*bitPattern) &= ~bitMask;
            }
        }
        else // Both bits 0
        {
            // If this is where a choice was made the last time,
            // a '1' bit is selected this time.
            if (currentBit == lastDeviation)
            {
                (*bitPattern) |= bitMask;
            }
            // For the rest of the id, '0' bits are selected when
            // discrepancies occur.
            else if (currentBit > lastDeviation)
            {
                (*bitPattern) &= ~bitMask;
                newDeviation = currentBit;
            }
            // If current bit in bit pattern = 0, then this is
            // out new deviation.
            else if ( !(*bitPattern & bitMask)) 
            {
                newDeviation = currentBit;
            }
            // IF the bit is already 1, do nothing.
            else
            {
            
            }
        }
                
        
        // Send the selected bit to the bus.
        if ((*bitPattern) & bitMask)
        {
            OWI_WriteBit1(pin);
        }
        else
        {
            OWI_WriteBit0(pin);
        }

        // Increment current bit.    
        currentBit++;

        // Adjust bitMask and bitPattern pointer.    
        bitMask <<= 1;
        if (!bitMask)
        {
            bitMask = 0x01;
            bitPattern++;
        }
    }
    return newDeviation;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本sm残虐另类| 美女被吸乳得到大胸91| 日韩欧美在线123| 国产酒店精品激情| 亚洲色图第一区| 日韩一区二区精品葵司在线| 99精品久久只有精品| 日本欧洲一区二区| 成人免费小视频| 欧美一区二区黄| 一本一本大道香蕉久在线精品 | 欧美日本在线视频| 国产精品香蕉一区二区三区| 午夜一区二区三区在线观看| 久久午夜电影网| 在线不卡的av| 91亚洲精品久久久蜜桃| 亚洲一级二级在线| 亚洲欧美自拍偷拍| 欧美成人精品1314www| 色素色在线综合| 97se亚洲国产综合在线| 成人av在线播放网站| 国产高清在线精品| 国产精品自拍毛片| 国产高清精品在线| 国产一区二区久久| 国产馆精品极品| 国产黄人亚洲片| 国产成都精品91一区二区三| 国产在线视频不卡二| 亚洲欧洲av一区二区三区久久| 久久精品视频一区二区| 国产欧美一区二区三区沐欲| 久久久久国产精品厨房| 国产欧美日韩不卡| 日本一区免费视频| 国产精品蜜臀av| 亚洲欧美日韩国产手机在线| 亚洲精品视频免费看| 夜色激情一区二区| 亚洲成av人影院在线观看网| 婷婷亚洲久悠悠色悠在线播放| 午夜国产不卡在线观看视频| 亚洲3atv精品一区二区三区| 视频一区二区三区中文字幕| 丝袜美腿亚洲一区| 久久66热re国产| 国产精品 日产精品 欧美精品| 成人理论电影网| 91免费国产在线观看| 欧美日韩一区二区在线观看视频| 欧美精品在欧美一区二区少妇| 欧美一区二区三区在线视频| 欧美成人伊人久久综合网| 精品国产3级a| ...av二区三区久久精品| 亚洲精品国久久99热| 午夜电影一区二区| 激情小说亚洲一区| jlzzjlzz亚洲女人18| 在线精品观看国产| 欧美刺激脚交jootjob| 中文字幕免费不卡在线| 一区二区久久久| 麻豆精品一区二区| 99久久精品免费精品国产| 在线观看一区二区精品视频| 欧美不卡一区二区三区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 久久综合九色综合97婷婷| 欧美国产精品一区| 婷婷中文字幕一区三区| 国产丶欧美丶日本不卡视频| 日本电影亚洲天堂一区| 欧美精品一区二区在线观看| 亚洲精品免费看| 久草中文综合在线| 欧日韩精品视频| 2023国产精品视频| 一区二区三区在线高清| 麻豆精品在线播放| 一本色道综合亚洲| 久久综合九色综合97婷婷女人 | 精品国精品国产| 亚洲精品国产a久久久久久 | 成人精品鲁一区一区二区| 欧美日韩一卡二卡三卡| 中文字幕欧美激情一区| 毛片一区二区三区| 91丨porny丨在线| 久久色在线视频| 天天综合天天综合色| gogo大胆日本视频一区| 日韩三级电影网址| 亚洲午夜免费电影| 高清不卡一二三区| 精品少妇一区二区三区在线播放| 一区二区三区中文字幕电影| 国产精品一二三| 91精品国产色综合久久不卡蜜臀| 中文字幕中文在线不卡住| 国产在线精品视频| 欧美一区二区三区免费观看视频| 亚洲美女视频在线观看| 成人免费视频一区| 久久精品亚洲乱码伦伦中文| 蜜臀av性久久久久蜜臀av麻豆| 欧美中文一区二区三区| 亚洲视频免费观看| 成人黄色网址在线观看| 久久久精品综合| 国内外成人在线| 91精品国产日韩91久久久久久| 亚洲黄色性网站| 色综合天天综合| 国产精品色在线观看| 国产精品一区二区视频| 欧美白人最猛性xxxxx69交| 日韩电影一区二区三区四区| 欧美伊人久久久久久久久影院| 最新日韩在线视频| 成人av网址在线观看| 久久久亚洲精品石原莉奈| 麻豆精品国产传媒mv男同| 日韩欧美中文字幕制服| 美女网站一区二区| 日韩女优制服丝袜电影| 欧美a级一区二区| 欧美一区二区视频观看视频| 日本强好片久久久久久aaa| 日韩一区二区在线观看视频| 日韩精品一级中文字幕精品视频免费观看 | 国产一区二三区好的| 精品88久久久久88久久久| 国产一区二区三区蝌蚪| 国产亚洲午夜高清国产拍精品| 国产一区999| 国产精品你懂的在线| 色综合天天性综合| 亚洲精品免费电影| 欧美色图天堂网| 日韩专区欧美专区| 欧美电视剧在线观看完整版| 国产综合色精品一区二区三区| 国产调教视频一区| 99国产精品视频免费观看| 亚洲欧美另类久久久精品| 在线视频欧美精品| 日韩主播视频在线| 欧美精品一区二区蜜臀亚洲| 国产成人在线视频网址| 国产精品传媒入口麻豆| 欧美色图12p| 精品一区二区在线观看| 中文字幕免费一区| 欧美性大战xxxxx久久久| 狂野欧美性猛交blacked| 国产欧美精品国产国产专区| 91伊人久久大香线蕉| 调教+趴+乳夹+国产+精品| 久久综合色一综合色88| 99久久99久久精品国产片果冻 | 欧美成人a∨高清免费观看| 国产精一品亚洲二区在线视频| 国产精品三级久久久久三级| 欧美日韩一级片在线观看| 九一九一国产精品| 亚洲精品视频在线| 精品人伦一区二区色婷婷| 99精品1区2区| 久久电影网电视剧免费观看| 中文文精品字幕一区二区| 欧美日韩一区小说| 国产成人av网站| 肉肉av福利一精品导航| 中文字幕av不卡| 4438x成人网最大色成网站| 丁香婷婷深情五月亚洲| 午夜视频久久久久久| 国产精品久久久久久久岛一牛影视| 欧美日韩综合在线| 国产91高潮流白浆在线麻豆| 午夜天堂影视香蕉久久| 国产精品欧美综合在线| 欧美一级淫片007| 一本到高清视频免费精品| 国产精一品亚洲二区在线视频| 亚洲国产欧美日韩另类综合| 国产丝袜美腿一区二区三区| 777xxx欧美| caoporn国产精品| 激情小说亚洲一区| 日韩激情av在线| 一区二区三区四区视频精品免费| 久久综合成人精品亚洲另类欧美 | 欧美韩国一区二区| 日韩欧美一二三四区| 五月天久久比比资源色| 国产精品视频一二三|