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

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

?? uwrdio.c

?? TDK 6521 SOC 芯片 DEMO程序
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************************
 * This code and information is provided "as is" without warranty of any   *
 * kind, either expressed or implied, including but not limited to the     *
 * implied warranties of merchantability and/or fitness for a particular   *
 * purpose.                                                                *
 *                                                                         *
 * Copyright (C) 2005 Teridian Semiconductor Corp. All Rights Reserved.    *
 ***************************************************************************/
//**************************************************************************
//    
//  DESCRIPTION: 71M651x POWER METER - Serial EEPROM Routines. 
// 
//  AUTHOR:  RGV
//
//  HISTORY: See end of file
//
//**************************************************************************
//               
// File: UWRDIO.C
// This implements a Microwire/half-duplex SPI bus master using DIO_4 and DIO_5,
// with a third DIO pin as the select (usually DIO_8). By default, it simulates
// the 6520's Microwire EEPROM access hardware in software.
//
// The addressing function, uwr_select(), may have to be modified for your
// project.  If clock polarities change for different devices, this routine
// should select the clock polarities automatically.
//
// This code is provided because the 6520's hardware microwire interface 
// does not address certain issues that could affect some customers.
//
// This implementation can port to a different set of DIOs if DIO_4 or 5 are
// needed for other purposes.
//
// This code provides microwire for the 6511 and 6513 meter chips, 
// which lack a hardware controller.
//
// It provides a compatible API to access devices that require clock 
// polarities other than Microwire standard (set SPI_POLARITIES to 1)
//
// Some clocked serial devices do not place their output in a high impedance 
// state while receiving data.  With this code, one can disassociate the input 
// and output pins by redefining the macros that access them.
//
// At a 4.9MHz MPU clock, this implementation was measured at a 260KHz 
// clock rate, not bad, but substantially slower than the 500KHz rate of 6520
// Microwire hardware.               
//**************************************************************************
// SPI API.
//
#include "options.h"
#if UWR_SW
#include "oscope.h"
#include "uwr.h"

// compilation switches
#define SPI_POLARITIES 0

// application symbols
#define BUSY_WAIT_MODE 128
#define LEADING_OUT 1
static uint8_t mode = 1;
static uint8_t last_cs_index = 1;
#define HALF_SECOND 5000 // assumes a call of delay_clks (3), 3/32768 secs

// change this stuff for new hardware
// SCL, serial clock, is attached to DIO_4 in both M6510 and M6520
#define SCL DIO_4
#define SCL_POWERED DIR0 |= 0x10
#define SCL_UNPOWERED DIR0 &= ~0x10
#define SCL_ONE SCL = 1
#define SCL_ZERO SCL = 0

// SDO, serial data out, is attached to DIO_5
#define SDO DIO_5
#define SDO_POWERED DIR0 |= 0x20
#define SDO_UNPOWERED DIR0 &= ~0x20
#define SDO_ONE SDO = 1
#define SDO_ZERO SDO = 0

// SDI, serial data in, is attached to DIO_5, so
// the software emulates the 652X's half-duplex uwire hardware.
// Half duplex is all that's needed to control most devices.
// For a full duplex SPI, assign this to a different pin,
// and change the bit write macros to read the input on
// the opposite phase.
#define SDI DIO_5
#define SDI_POWERED DIR0 |= 0x20
#define SDI_UNPOWERED DIR0 &= ~0x20
#define SDI_ONE SDI = 1
#define SDI_ZERO SDI = 0

// CS, chip select, is attached to DIO_8 on the Eval PCB; modify this 
// for your PCB
#define CS DIO_8
#define CS_POWERED DIR1 |= 0x01
#define CS_UNPOWERED DIR1 &= ~0x01
#define CS_ONE CS = 1
#define CS_ZERO CS = 0

// Clock polarity routines are not public because they can and should
// be set by the addressing logic in uwr_select().
// rising edge of leading clock edge is data to device,
// Used on microwire eeproms, and this is the default
static void uwr_leading_rising (void) small reentrant;
#if SPI_POLARITIES
// falling edge of leading clock edge is data to device,
static void uwr_leading_falling (void) small reentrant;
// rising edge of trailing clock edge is data to device,
static void uwr_trailing_rising (void) small reentrant;
// falling edge of trailing clock edge is data to device,
static void uwr_trailing_falling (void) small reentrant;
#endif

// initialize the microwire system
#pragma save
#pragma NOAREGS
void uwr_init(void) small reentrant
{
    EX_EEPROM  = FALSE;        // Disable EEPROM non-busy interrupt.
    DIO &= ~DIO_EEX;           // DIO_4 and DIO_5 become DIOs

    #if TRACE10 | M6520
    if ((LCDX & LCD_NUM) > 16) // DIO_4 and DIO_5 are not LCD segments
    {
        LCDX = 16 | (LCDX & ~LCD_NUM);
    }
    #elif M6530
    LCD_MAP[ DIO4_11 ] &= ~(SEG24_DIO4 | SEG25_DIO5);
    #else
    #error unknown device
    #endif

    // Change the default polarities and edges for your devices.
    // select nothing
    uwr_select (UWR_NO_DEVICE);

    // power up the interface
    CS_POWERED;
    SCL_POWERED;
    SDI_UNPOWERED;
    SDO_POWERED;
}
#pragma restore

// select a chip; 0 = none
// The clock polarity should be selected before the device is selected.
// Rewrite this to select the polarity and address the devices on your PCB
#pragma save
#pragma NOAREGS
void uwr_select (uint8_t cs_index) small reentrant
{
    uwr_leading_rising (); // set default polarity
    last_cs_index = cs_index;
    CS = cs_index;
}
#pragma restore

// start of portable code

// LR: leading/rising, the default clock polarity and edge for microwire.
// leading edge is output to device, leading edge is rising
// Put a bit out
#define PUT_BIT_LR(_b_,_bit_) \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ONE; \
    SCL_ZERO

// put a bit out, with hi-z
#define PUT_BIT_HIZ_LR(_b_,_bit_) \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ONE; \
    SDI_UNPOWERED; \
    SCL_ZERO

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_LR(_b_) \
    PUT_BIT_LR(_b_,128); \
    PUT_BIT_LR(_b_,64); \
    PUT_BIT_LR(_b_,32); \
    PUT_BIT_LR(_b_,16); \
    PUT_BIT_LR(_b_,8); \
    PUT_BIT_LR(_b_,4); \
    PUT_BIT_LR(_b_,2); \
    PUT_BIT_LR(_b_,1)

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_HIZ_LR(_b_) \
    PUT_BIT_LR(_b_,128); \
    PUT_BIT_LR(_b_,64); \
    PUT_BIT_LR(_b_,32); \
    PUT_BIT_LR(_b_,16); \
    PUT_BIT_LR(_b_,8); \
    PUT_BIT_LR(_b_,4); \
    PUT_BIT_LR(_b_,2); \
    PUT_BIT_HIZ_LR(_b_,1)

#define GET_BIT_LR(_b_,_bit_) \
    SCL_ONE; \
    SCL_ZERO; \
    if (SDI != 0) \
    { \
        _b_ |= _bit_; \
    }

// The loops are unrolled in these macros to get the best possible speed.
#define GET_BYTE_LR(_b_) \
    GET_BIT_LR(_b_,128); \
    GET_BIT_LR(_b_,64); \
    GET_BIT_LR(_b_,32); \
    GET_BIT_LR(_b_,16); \
    GET_BIT_LR(_b_,8); \
    GET_BIT_LR(_b_,4); \
    GET_BIT_LR(_b_,2); \
    GET_BIT_LR(_b_,1)

// LF: leading/falling, a different polarity, often used by Japanese chips
// leading edge is output to device, leading edge is falling 
// The loops are unrolled in these macros to get the best possible speed.
// Put a bit out
#define PUT_BIT_LF(_b_,_bit_) \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ZERO; \
    SCL_ONE;

// put a bit out, with hi-z
#define PUT_BIT_HIZ_LF(_b_,_bit_) \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ZERO; \
    SDI_UNPOWERED; \
    SCL_ONE;

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_LF(_b_) \
    PUT_BIT_LF(_b_,128); \
    PUT_BIT_LF(_b_,64); \
    PUT_BIT_LF(_b_,32); \
    PUT_BIT_LF(_b_,16); \
    PUT_BIT_LF(_b_,8); \
    PUT_BIT_LF(_b_,4); \
    PUT_BIT_LF(_b_,2); \
    PUT_BIT_LF(_b_,1)

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_HIZ_LF(_b_) \
    PUT_BIT_LF(_b_,128); \
    PUT_BIT_LF(_b_,64); \
    PUT_BIT_LF(_b_,32); \
    PUT_BIT_LF(_b_,16); \
    PUT_BIT_LF(_b_,8); \
    PUT_BIT_LF(_b_,4); \
    PUT_BIT_LF(_b_,2); \
    PUT_BIT_HIZ_LF(_b_,1)

#define GET_BIT_LF(_b_,_bit_) \
    SCL_ZERO; \
    if (SDI != 0) \
    { \
        _b_ |= _bit_; \
    } \
    SCL_ONE

// The loops are unrolled in these macros to get the best possible speed.
#define GET_BYTE_LF(_b_) \
    GET_BIT_LF(_b_,128); \
    GET_BIT_LF(_b_,64); \
    GET_BIT_LF(_b_,32); \
    GET_BIT_LF(_b_,16); \
    GET_BIT_LF(_b_,8); \
    GET_BIT_LF(_b_,4); \
    GET_BIT_LF(_b_,2); \
    GET_BIT_LF(_b_,1)

// TR: trailing/rising, a different polarity, used in unusual devices
// trailing edge is output to device, trailing edge is rising 
// The loops are unrolled in these macros to get the best possible speed.
// Put a bit out
#define PUT_BIT_TR(_b_,_bit_) \
    SCL_ZERO; \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ONE;

// put a bit out, with hi-z
#define PUT_BIT_HIZ_TR(_b_,_bit_) \
    SCL_ZERO; \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ONE; \
    SDI_UNPOWERED; \

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_TR(_b_) \
    PUT_BIT_TR(_b_,128); \
    PUT_BIT_TR(_b_,64); \
    PUT_BIT_TR(_b_,32); \
    PUT_BIT_TR(_b_,16); \
    PUT_BIT_TR(_b_,8); \
    PUT_BIT_TR(_b_,4); \
    PUT_BIT_TR(_b_,2); \
    PUT_BIT_TR(_b_,1)

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_HIZ_TR(_b_) \
    PUT_BIT_TR(_b_,128); \
    PUT_BIT_TR(_b_,64); \
    PUT_BIT_TR(_b_,32); \
    PUT_BIT_TR(_b_,16); \
    PUT_BIT_TR(_b_,8); \
    PUT_BIT_TR(_b_,4); \
    PUT_BIT_TR(_b_,2); \
    PUT_BIT_HIZ_TR(_b_,1)

#define GET_BIT_TR(_b_,_bit_) \
    SCL_ZERO; \
    SCL_ONE; \
    if (SDI != 0) \
    { \
        _b_ |= _bit_; \
    }

// The loops are unrolled in these macros to get the best possible speed.
#define GET_BYTE_TR(_b_) \
    GET_BIT_TR(_b_,128); \
    GET_BIT_TR(_b_,64); \
    GET_BIT_TR(_b_,32); \
    GET_BIT_TR(_b_,16); \
    GET_BIT_TR(_b_,8); \
    GET_BIT_TR(_b_,4); \
    GET_BIT_TR(_b_,2); \
    GET_BIT_TR(_b_,1)

// TF: trailing/falling, a different polarity, used in unusual devices
// trailing edge is output to device, trailing edge is falling
// The loops are unrolled in these macros to get the best possible speed.
// Put a bit out
#define PUT_BIT_TF(_b_,_bit_) \
    SCL_ONE; \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ZERO;

// put a bit out, with hi-z
#define PUT_BIT_HIZ_TF(_b_,_bit_) \
    SCL_ONE; \
    if (0 == (_b_ & _bit_)) \
    { \
        SDO_ZERO; \
    } \
    else \
    { \
        SDO_ONE; \
    } \
    SCL_ZERO; \
    SDI_UNPOWERED; \

// The loops are unrolled in these macros to get the best possible speed.
#define PUT_BYTE_TF(_b_) \
    PUT_BIT_TF(_b_,128); \
    PUT_BIT_TF(_b_,64); \
    PUT_BIT_TF(_b_,32); \

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美va亚洲va| 91福利资源站| 久久精品国产99国产精品| 亚洲亚洲人成综合网络| 亚洲一二三四久久| 日日夜夜精品视频免费| 日韩电影免费在线| 青青草视频一区| 国内外成人在线视频| 国产成人精品综合在线观看| 不卡一区二区中文字幕| 91丨porny丨户外露出| 色94色欧美sute亚洲线路一久| 91首页免费视频| 欧美日韩国产一级片| 日韩一区二区三区视频在线| 久久综合色播五月| 亚洲图片你懂的| 五月激情综合网| 激情成人午夜视频| 97精品久久久久中文字幕| 欧美亚一区二区| 久久亚洲免费视频| 一区二区三区在线观看国产| 日韩高清在线不卡| 99久久综合99久久综合网站| 欧美顶级少妇做爰| 国产性色一区二区| 亚洲一区二区三区四区五区中文 | 亚洲视频一区在线| 亚洲线精品一区二区三区八戒| 日韩电影免费在线看| 国产白丝网站精品污在线入口| 欧洲激情一区二区| 久久久久久久综合日本| 午夜日韩在线观看| 风间由美一区二区av101| 欧美日韩情趣电影| 中文字幕亚洲在| 国产精品一品视频| 日韩一区二区在线免费观看| 亚洲桃色在线一区| 国产麻豆视频一区| 欧美高清视频在线高清观看mv色露露十八 | 成人av网址在线观看| 欧美一区二区三区四区高清| 亚洲欧美视频在线观看视频| 韩国中文字幕2020精品| 欧美日本韩国一区二区三区视频| 国产精品五月天| 激情成人综合网| 欧美一区二区国产| 亚洲国产一区二区视频| 一本一道综合狠狠老| 国产欧美日韩不卡免费| 久久成人久久爱| 欧美美女激情18p| 一区二区三区精品在线观看| 成人免费观看视频| 国产亚洲欧美一区在线观看| 日本sm残虐另类| 欧美精品一卡两卡| 亚洲国产精品人人做人人爽| 色久综合一二码| 伊人色综合久久天天| 9i看片成人免费高清| 中文字幕av一区 二区| 激情图片小说一区| www激情久久| 国产成人午夜精品影院观看视频| 久久视频一区二区| 国产精品羞羞答答xxdd| 欧美精品一区二区三区蜜臀| 激情文学综合丁香| 欧美激情一区二区三区| 粉嫩绯色av一区二区在线观看| 国产欧美日韩三级| 99久久99久久久精品齐齐| 18涩涩午夜精品.www| 色综合网色综合| 亚洲电影一区二区三区| 欧美日韩成人一区| 日本一不卡视频| 久久一区二区视频| 99久免费精品视频在线观看| 亚洲免费观看高清完整版在线| 日本高清无吗v一区| 午夜欧美2019年伦理| 日韩欧美国产午夜精品| 国产一区二区三区美女| 国产精品美女久久久久高潮| 91在线精品一区二区| 亚洲精品日韩一| 欧美日本国产视频| 蜜臀av一区二区三区| 日韩精品一区二区三区老鸭窝| 国产xxx精品视频大全| 国产精品白丝在线| 欧美高清hd18日本| 国产很黄免费观看久久| 亚洲精品国产成人久久av盗摄| 91精品国产综合久久久久久| 极品少妇xxxx偷拍精品少妇| 中文字幕亚洲区| 欧美一区二区私人影院日本| 成人一道本在线| 亚洲图片有声小说| 国产日产精品一区| 欧洲生活片亚洲生活在线观看| 男男视频亚洲欧美| 日韩一区在线看| 日韩视频免费直播| 91网站在线观看视频| 激情文学综合网| 亚洲国产成人高清精品| 国产精品欧美一区喷水| 日韩一区二区在线免费观看| 91免费观看视频| 国产成人在线视频免费播放| 午夜精品久久久久久不卡8050| 国产欧美一区二区三区沐欲| 91精品欧美久久久久久动漫 | 国产精品网曝门| 日韩亚洲国产中文字幕欧美| av电影在线观看一区| 国产乱码精品1区2区3区| 亚洲国产日韩av| 亚洲女厕所小便bbb| 国产欧美精品日韩区二区麻豆天美| 国产成人午夜高潮毛片| 日产精品久久久久久久性色| 尤物av一区二区| 亚洲丝袜美腿综合| 久久久欧美精品sm网站| 日韩午夜电影在线观看| 欧美三级欧美一级| 欧美午夜免费电影| 91精品福利在线| 色综合婷婷久久| 97久久精品人人做人人爽50路| 国产精品99久久久久| 狠狠久久亚洲欧美| 久久99精品久久久久久动态图 | 久久国产福利国产秒拍| 香蕉久久夜色精品国产使用方法 | 久久精品日产第一区二区三区高清版 | 亚洲自拍偷拍av| 亚洲日本成人在线观看| 国产精品嫩草影院com| 国产精品日产欧美久久久久| 国产女人18毛片水真多成人如厕| 久久午夜色播影院免费高清| 久久影院电视剧免费观看| 日韩欧美电影一区| 久久人人爽人人爽| 国产午夜精品久久久久久免费视| 久久久久九九视频| 国产色一区二区| 国产精品视频一区二区三区不卡 | 色综合激情久久| 91成人在线免费观看| 欧美日韩成人一区| 日韩免费一区二区三区在线播放| 欧美不卡激情三级在线观看| 2022国产精品视频| 国产精品免费视频网站| 一区二区免费视频| 美女在线观看视频一区二区| 精品综合免费视频观看| 成人免费高清视频在线观看| 色综合久久天天| 91精品啪在线观看国产60岁| 久久久精品欧美丰满| 亚洲免费成人av| 日本不卡视频在线| 成人黄色在线网站| 在线欧美日韩国产| 日韩免费高清电影| 国产精品蜜臀av| 日韩专区一卡二卡| 粉嫩aⅴ一区二区三区四区五区| 91激情五月电影| 欧美成人免费网站| 亚洲人成电影网站色mp4| 五月天激情综合| av成人动漫在线观看| 欧美一区二区三区不卡| 国产精品久久久久久久第一福利| 亚洲一区二区三区四区五区黄| 国产精选一区二区三区| 欧美无砖砖区免费| 国产日产欧产精品推荐色| 亚洲成年人网站在线观看| 国产高清不卡一区二区| 欧美日韩国产区一| 国产精品久久久久桃色tv| 麻豆精品久久久| 日本久久电影网| 中文字幕第一区综合| 美女免费视频一区二区|