Esempio n. 1
0
        //Constructor
        public Ov7670Device()
        {
            //Programstatus
            Programstatus = -1;
            ErrorCode     = 0;
            //initiate the Register
            RegisterValue defaultValue = new RegisterValue();

            defaultValue.setByte(0x00);                       //initiate value 0 for each register
            for (int i = 0; i < SccbRegisterList.Length; i++) //Create Setting Register with the Addresses from 0 to the Amount of the Registers
            {
                SccbRegisterList[i] = new SccbRegister((byte)i, defaultValue);
            }

            //initialize the COMPort
            _comPort = new SerialPort();
            _comPort.DataReceived += ComPortDataReceived;

            //initiate Variables
            _rowCount = 0;

            _picture         = new ImageFile();
            rowRepeatCounter = 0;

            //Statusregister. This register are relevant for the general adjustment of the sensor. These register addresses will bre read when Camera Status is requested
            StatusRegisterList[0]  = 0x0C;
            StatusRegisterList[1]  = 0x12;
            StatusRegisterList[2]  = 0x1C;
            StatusRegisterList[3]  = 0x1D;
            StatusRegisterList[4]  = 0x3A;
            StatusRegisterList[5]  = 0x3D;
            StatusRegisterList[6]  = 0x3E;
            StatusRegisterList[7]  = 0x40;  //COM15 - RGB444 Mode
            StatusRegisterList[8]  = 0x42;
            StatusRegisterList[9]  = 0x70;
            StatusRegisterList[10] = 0x71;
            StatusRegisterList[11] = 0x0A;
            StatusRegisterList[12] = 0x0B;
        }
Esempio n. 2
0
        /// <summary>
        /// This function read two Bytes from the buffer. 1: Register Address 2:Register value
        /// Because this funciton is used in more than one Programstatus it is outsourced of the switch case statement
        /// </summary>
        private void ReceiveReadRegister()
        {
            RegisterValue tempValue = new RegisterValue();

            if (_receivedData.Count >= 2)
            {
                var Address = new byte();
                Address = _receivedData.Dequeue();
                var readValue = new byte();
                readValue = _receivedData.Dequeue();

                tempValue.setByte(readValue);
                if (Address <= SccbRegisterList.Length - 1)
                {
                    SccbRegisterList[Address].Value = tempValue;
                    OnDataIsProceeded();
                }
                else
                {
                    OnErrorOccured(new ErrorEventArgs(99, "Die empfangene Addresse des Registers existiert nicht"));
                }
            }
        }
Esempio n. 3
0
 public SccbRegister(byte sAddress, RegisterValue sValue)
 {
     MyAddress = new RegisterValue();
     MyAddress.setByte(sAddress);
     Value = sValue;
 }