📄 test.c
字号:
//**********************************************************************
//* PROJECT: Library for 24c01/02/04/08/16 serial EEPROM
//* Copyright (C) 2003, Pedro Ignacio Martos (pi_martos@hotmail.com)
//**********************************************************************
//* FILE: test.c
//**********************************************************************
//* CHANGES:
//* date author description
//* --------------------------------------------------------------------
//* 07/29/03 pmartos (pi_martos@hotmail.com) initial release
//**********************************************************************
//* DESCRIPTION:
//* This file contains a simple test routines for lib24c16 library
//**********************************************************************
// This file is part of lib24c16
//*
//* lib24c16 is free software; you can redistribute it and/or modify
//* it under the terms of the GNU General Public License as published by
//* the Free Software Foundation; either version 2 of the License, or
//* (at your option) any later version.
//*
//* lib24c16 is distributed in the hope that it will be useful,
//* but WITHOUT ANY WARRANTY; without even the implied warranty of
//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//* GNU General Public License for more details.
//*
//* You should have received a copy of the GNU General Public License
//* along with lib24c16; if not, write to the Free Software
//* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
//* USA
//**********************************************************************
//* FUNCTIONS DECLARED:
//* void main (void);
//**********************************************************************
//* NOTES:
//* you need to define the port pins where the memory is connected like
//* this:
//* bit at 0x90 SCK; // P1_0 = EEPROM SCK
//* bit at 0x91 SDA; // P1_1 = EEPROM SDA
//*
//* - For parts other than 24c16, 'page' must be set according to the
//* logical values in pins A0, A1 & A2 (see particular datasheet)
//* - Remember the 10mS busy time in writing cycle
//* - The routines closely resembles the assembler code of the AN
//**********************************************************************
//* COMPILE TIME OPTIONS: dcc.exe test.c lib24c16.rel
//* DEBUG OPTIONS: None
//**********************************************************************
//* TO DO:
//* - create a conditional to select the read or the write
//* routine
//* - add a delay routine to use both read and write
//**********************************************************************
#include <at89s8252.h>
#include "lib24c16.h"
bit at 0x90 SCK; // P1_0 = SCK
bit at 0x91 SDA; // P1_1 = SDA
void main (void)
{
weeprom (0x01,0xF0, 0x50);
// P2 = reeprom (0x01, 0xF0);
do
P3++;
while (1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -