• 大小: 34.76MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-07-24
  • 语言: C/C++
  • 标签: 很全  

资源简介

CY7C68013A新官方资料 很全面 包括所有的pdf开发文档 很C语言驱动程序

资源截图

代码片段和文件信息

//-----------------------------------------------------------------------------
//   File:      eeprom.c
//   Contents:   EEPROM update firmware source.  (Write only)
//
//   indent 3.  NO TABS!
//
//   Copyright (c) 2002 Cypress Semiconductor
//
// $Workfile: eeprom.c $
// $Date: 9/07/05 2:54p $
// $Revision: 1 $
//-----------------------------------------------------------------------------
#include “fx2.h“
#include “fx2regs.h“
#include “eeprom.h“

///////////////////////////////////////////////////////////////////////////////////////

// Write up to one page of data to the EEPROM.
// Returns 0 on success 1 on failure
// Normally called within a while() loop so that errors are retried:
// while (EEPROMWritePage(....))
//    ;
bit EEPROMWritePage(WORD addr BYTE xdata * ptr BYTE len)
{
    BYTE i;
    bit      retval;

    EEPROM_DISABLE_WRITE_PROTECT();

    // Make sure the i2c interface is idle
    EEWaitForStop();
    
    // write the START bit and i2c device address
    EEStartAndAddr();
    
    if(EEWaitForAck())
    {
        retval = 1;
        goto EXIT_WP;
    }

    // write the eeprom offset
    if (DB_Addr)
    {
        I2DAT = MSB(addr);
        if(EEWaitForAck())
        {
            retval = 1;
            goto EXIT_WP;
        }
    }
    I2DAT = LSB(addr);
    if(EEWaitForAck())
    {
        retval = 1;
        goto EXIT_WP;
    }

    // Write the data Page
    for (i = 0; i < len; i++)
    {
        I2DAT = *ptr++;
        if(EEWaitForDone())
        {
            retval = 1;
            goto EXIT_WP;
        }
    }
    I2CS |= bmSTOP;
    WaitForEEPROMWrite();

    retval = 0;

EXIT_WP:            
    EEPROM_ENABLE_WRITE_PROTECT();
    return(retval);
}

void EEStartAndAddr()
{
      I2CS = bmSTART;
      I2DAT = I2C_Addr << 1;
}

// 0x2e in assembly less than 0x20 with compiler optimization!!
void WaitForEEPROMWrite()
{
   EEWaitForStop();
waitForBusy:
EEStartAndAddr();

   EEWaitForDone();
   I2CS |= bmSTOP; // ; Set the STOP bit
   EEWaitForStop();

   if (!(I2CS & bmACK))  // If no ACK try again.
      goto waitForBusy;
}

void EEWaitForStop()
{
   // Data should not be written to I2CS or I2DAT until the STOP bit returns low.
   while (I2CS & bmSTOP)
      ;
}

// Returns 0 on success 1 on failure
bit EEPROMRead(WORD addr BYTE length BYTE xdata *buf)
{
   BYTE i;

   // Make sure the i2c interface is idle
   EEWaitForStop();
   
   // write the START bit and i2c device address
   EEStartAndAddr();

   if(EEWaitForAck())
      return(1);

   // write the eeprom offset
   if (DB_Addr)
      {
      I2DAT = MSB(addr);
      if(EEWaitForAck())
         return(1);
      }
   I2DAT = LSB(addr);
   if(EEWaitForAck())
      return(1);

   I2CS = bmSTART;

   // send the read command
   I2DAT = (I2C_Addr << 1) | 1;
   if(EEWaitForDone())
      return(1);

   // read dummy byte

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      93839  2010-11-30 12:22  CY7C68013A新官方资料\AN55037.pdf

     文件      44830  2010-11-30 12:22  CY7C68013A新官方资料\AN55037.zip

     文件     218418  2010-11-30 12:27  CY7C68013A新官方资料\Bulk_Application.zip

     文件     190735  2010-11-30 12:27  CY7C68013A新官方资料\Bulk_Application1.pdf

     文件     660932  2010-11-30 12:23  CY7C68013A新官方资料\CY3684 EZ - USB FX2LP Development Kit - Cypress Semiconductor.mht

     文件      63501  2010-11-30 12:19  CY7C68013A新官方资料\CY3684_Schematic.pdf

     文件   13494458  2011-01-22 19:41  CY7C68013A新官方资料\CY7C68015A-56LTXC.zip

     文件      90112  2003-08-18 11:29  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\Application\CyStream.exe

     文件       1955  2003-02-11 11:24  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\build.bat

     文件     125877  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream

     文件      24636  2005-07-19 12:05  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.c

     文件      11137  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.hex

     文件       3722  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.iic

     文件         72  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.lnp

     文件      42810  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.LST

     文件      94484  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.M51

     文件      79346  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.OBJ

     文件       1137  2011-02-10 10:58  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.Opt

     文件     206506  2011-02-10 10:58  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.plg

     文件       2205  2011-02-10 10:58  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream.Uv2

    .......      1533  2009-04-07 10:58  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream_Opt.Bak

    .......      2041  2009-03-25 10:12  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\CYStream_Uv2.Bak

     文件      16847  2003-06-24 16:07  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\dscr.a51

     文件      31103  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\dscr.LST

     文件       1173  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\dscr.OBJ

     文件      14005  2005-06-22 07:35  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\fw.c

     文件      20709  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\fw.LST

     文件      56632  2011-02-10 10:44  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\fw.OBJ

     文件         81  2003-06-09 15:19  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\CYStream FW\iic.bat

     文件     163412  2003-10-20 10:08  CY7C68013A新官方资料\CYStream_RefDesign\CYStream_RefDesign\Documentation\CyStreamUserGuide_Rev_1_3_Oct03.pdf

............此处省略40个文件信息

评论

共有 条评论