コード例 #1
0
ファイル: SL_Bridge_Flash.cs プロジェクト: brandy1/ElecsKlein
        public static void Write(byte addr, UInt16 par)
        {
            int adcnt = 9;
            int wrcnt = 16;
            int x, data, bit;

            data = (addr & 0x3f) | 0x140;          //16 bits
            SL_Bridge_Flash.InterfaceSet(0, 0, 0); // CS = "L", disable
            for (x = (adcnt - 1); x >= 0; x--)
            {
                bit = (data >> x) & 0x01;
                SL_Bridge_Flash.InterfaceSet(1, 0, bit);
                SL_Bridge_Flash.InterfaceSet(1, 1, bit);
            }

            data = par & 0xffff;   //16 bits
            for (x = (wrcnt - 1); x >= 0; x--)
            {
                bit = (data >> x) & 0x01;
                SL_Bridge_Flash.InterfaceSet(1, 0, bit);
                SL_Bridge_Flash.InterfaceSet(1, 1, bit);
            }
            SL_Bridge_Flash.InterfaceSet(0, 0, 0);
            Thread.Sleep(10);
        }
コード例 #2
0
ファイル: SL_Bridge_Flash.cs プロジェクト: brandy1/ElecsKlein
        public static int Read(byte addr)
        {
            int wrcnt = 9;
            int rdcnt = 16;
            int x, data, bit;
            int rddata;

            //         data = (addr&0x7f)|0x300;     //8 bits
            data = (addr & 0x3f) | 0x180;          //16 bits

            SL_Bridge_Flash.InterfaceSet(0, 0, 0); // CS = "L", disable
            for (x = (wrcnt - 1); x >= 0; x--)
            {
                bit = (data >> x) & 0x01;
                SL_Bridge_Flash.InterfaceSet(1, 0, bit);
                SL_Bridge_Flash.InterfaceSet(1, 1, bit);
            }
            SL_Bridge_Flash.InterfaceSet(1, 0, 0);

            rddata = 0;
            for (x = (rdcnt - 1); x >= 0; x--)
            {
                SL_Bridge_Flash.InterfaceSet(1, 1, 0);
                SL_Bridge_Flash.InterfaceSet(1, 0, 0);
                bit    = SL_Bridge_Flash.Dout();
                rddata = (bit << x) + rddata;
            }
            SL_Bridge_Flash.InterfaceSet(0, 0, 0);
            return(rddata);
        }
コード例 #3
0
ファイル: SL_Bridge_Flash.cs プロジェクト: brandy1/ElecsKlein
        public static void WriteDisable()
        {
            int wrcnt = 9;
            int x, data, bit;

            data = 0x100;                          //16 bits
            SL_Bridge_Flash.InterfaceSet(0, 0, 0); // CS = "L", disable
            for (x = (wrcnt - 1); x >= 0; x--)
            {
                bit = (data >> x) & 0x01;
                SL_Bridge_Flash.InterfaceSet(1, 0, bit);
                SL_Bridge_Flash.InterfaceSet(1, 1, bit);
            }
            SL_Bridge_Flash.InterfaceSet(0, 0, 0);
        }
コード例 #4
0
ファイル: SL_Bridge_Flash.cs プロジェクト: brandy1/ElecsKlein
        public static void Erase(byte addr)
        {
            int adcnt = 9;
            int x, data, bit;

            data = (addr & 0x3f) | 0x1c0;          //16 bits
            SL_Bridge_Flash.InterfaceSet(0, 0, 0); // CS = "L", disable
            for (x = (adcnt - 1); x >= 0; x--)
            {
                bit = (data >> x) & 0x01;
                SL_Bridge_Flash.InterfaceSet(1, 0, bit);
                SL_Bridge_Flash.InterfaceSet(1, 1, bit);
            }
            SL_Bridge_Flash.InterfaceSet(0, 0, 0);
            Thread.Sleep(10);
        }