示例#1
0
 public static void DisableEraseWrite(this Eeprom93C46B eeprom)
 {
     // Opcode for EWDS is 0000XXXX
     for (int i = 0; i < 8; i++)
     {
         eeprom.Pulse(false);
     }
 }
示例#2
0
 public static void EnableEraseWrite(this Eeprom93C46B eeprom)
 {
     // Opcode for EWEN is 0011XXXX
     eeprom.Pulse(false);
     eeprom.Pulse(false);
     eeprom.Pulse(true);
     eeprom.Pulse(true);
     eeprom.Pulse(false);
     eeprom.Pulse(false);
     eeprom.Pulse(false);
     eeprom.Pulse(false);
 }
示例#3
0
        public static void Write(this Eeprom93C46B eeprom, ushort address, ushort data)
        {
            eeprom.Pulse(false);
            eeprom.Pulse(true);
            address &= 0x3F;
            for (int i = 0; i < 6; i++)
            {
                eeprom.Pulse(((address >> (5 - i) & 0x01) != 0x00));
            }

            for (int i = 0; i < 16; i++)
            {
                bool value = ((data >> (15 - i)) & 0x01) == 1;
                eeprom.Pulse(value);
            }
        }
示例#4
0
        public static void WriteAll(this Eeprom93C46B eeprom, ushort data)
        {
            eeprom.Pulse(false);
            eeprom.Pulse(false);
            eeprom.Pulse(false);
            eeprom.Pulse(true);
            eeprom.Pulse(true);
            eeprom.Pulse(true);
            eeprom.Pulse(true);
            eeprom.Pulse(true);

            for (int i = 0; i < 16; i++)
            {
                bool value = ((data >> (15 - i)) & 0x01) == 1;
                eeprom.Pulse(value);
            }
        }
示例#5
0
        public static ushort Read(this Eeprom93C46B eeprom, ushort address)
        {
            eeprom.Pulse(true);
            eeprom.Pulse(false);
            address &= 0x3F;
            for (int i = 0; i < 6; i++)
            {
                eeprom.Pulse(((address >> (5 - i) & 0x01) != 0x00));
            }

            ushort value = 0;

            for (int i = 0; i < 16; i++)
            {
                eeprom.Pulse(false);
                value |= (ushort)((eeprom.DO ? 1 : 0) << (15 - i));
            }
            return(value);
        }
示例#6
0
 public static void Pulse(this Eeprom93C46B eeprom, bool dataIn)
 {
     eeprom.DI = dataIn;
     eeprom.Update(true, false);           //, dataIn);
     eeprom.Update(true, true);            //, dataIn);
 }
示例#7
0
 public static void Start(this Eeprom93C46B eeprom)
 {
     eeprom.DI = true;
     eeprom.Update(true, false);           //, true);
     eeprom.Update(true, true);            //, true);
 }
示例#8
0
 public void TestInitialize()
 {
     eeprom = new Eeprom93C46B();
 }