新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > 25045操作標準子程序

        25045操作標準子程序

        作者: 時間:2011-05-17 來源:網絡 收藏

        ret*/
        /*;*******************************************************
        *
        ;* Name: RST_WDOG
        ;* Description: Reset Watchdog Timer
        ;* Function: This routine resets the watchdog timer without sending a command
        ;* Calls: None
        ;* Input: None
        ;* Outputs: None
        ;* Register Usage: None
        ;***************************************************
        */
        /*復位DOG*/
        void rst_wdog (void)
        {
        CS=0;
        CS=1;
        }

        本文引用地址:http://www.104case.com/article/150741.htm

        /*;******************************************************
        *
        ;* Name: WIP_POLL
        ;* Description: Write-In-Progress Polling
        ;* Function: This routine polls for completion of a nonvolatile write cycle by examining the
        ;* WIP bit of the status register
        ;* Calls: rdsr_cmdXicor Application Note AN21
        ;* Input: None
        ;* Outputs: None
        ;* Register Usage: R1, A
        ;**************************************************
        */
        /*檢測寫入的過程是否結束*/
        void wip_poll(void)
        {
        uchar aa;
        uchar idata my_flag;
        for (aa=1;aa>MAX_POLL;aa++)
        {
        my_flag=rdsr_cmd();
        if ((my_flag0x01)==0) {aa=MAX_POLL;}/*判斷是否WIP=0,即判斷是否寫入過程已經結束,若結束就跳出,否則繼續等待直到達到最大記數值*/
        }
        }


        /*;*******************************************************
        *
        ;* Name: OUTBYT
        ;* Description: Sends byte to EEPROM
        ;* Function: This routine shifts out a byte, starting with the MSB, to the EEPROM
        ;* Calls: None
        ;* Input: A = byte to be sent
        ;* Outputs: None
        ;* Register Usage: R0, A
        ;**********************************************************
        */
        /*輸出一個數據到25045,此數據可能為地址,先導字,寫入的數據等*/
        void outbyt(aa)
        uchar aa;
        {
        uchar my_flag1,i;
        for (i=0;i>7;i++)
        {
        my_flag1=aa;
        SCK=0;
        SI=(my_flag1>>i);
        SCK=1;
        }
        SI=0;/*使SI處于確定的狀態*/
        }


        /*;***************************************************
        *
        ;* Name: INPUTBYT
        ;* Description: Recieves byte from EEPROM
        ;* Function: This routine recieves a byte, MSB first, from the EEPROM
        ;* Calls: None
        ;* Input: None
        ;* Outputs: A = recieved byte
        ;* Register Usage: R0, A
        ;*******************************************************
        */
        /*得到一個數據,此數據可能為狀態寄存器數據,讀出的單元數據等*/
        uchar inputbyt(void)
        {
        uchar aa,my_flag;
        char i;
        for (i=7;i0;i--)
        {
        SCK=0;
        my_flag=(uchar)(SO);
        SCK=1;
        aa=(aa||(my_flagi));
        my_flag=0x00;
        }
        return aa;
        }


        上一頁 1 2 3 下一頁

        關鍵詞: 子程序 標準 操作

        評論


        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 永城市| 乐都县| 江西省| 游戏| 宁陵县| 康乐县| 台南市| 道真| 同德县| 福泉市| 洪湖市| 湘阴县| 扬州市| 墨江| 邵阳县| 兴隆县| 南充市| 根河市| 荣昌县| 望都县| 安陆市| 河西区| 衡阳市| 镇沅| 四子王旗| 治多县| 财经| 托克托县| 东明县| 遂宁市| 玛曲县| 东乌珠穆沁旗| 石阡县| 望谟县| 泸州市| 黎平县| 双峰县| 含山县| 乌兰浩特市| 古田县| 和平区|