예제 #1
0
        public bool loadSccbSettings()
        {
            OpenFileDialog SettingOpenDialog = new OpenFileDialog();

            String[]      Elements          = new String[2];
            RegisterValue tempRegistervalue = new RegisterValue();

            if ((SettingOpenDialog.ShowDialog() == DialogResult.OK) && (SettingOpenDialog.FileName != ""))
            {
                String[] Lines = File.ReadAllLines(SettingOpenDialog.FileName);
                for (int i = 0; i < Lines.Length; i++)
                {
                    Elements          = Lines[i].Split(';');
                    tempRegistervalue = new RegisterValue();
                    tempRegistervalue.setDez(Elements[1]);
                    SccbRegisterList[i].Value = tempRegistervalue;
                }
                return(true);
            }
            MessageBox.Show("False!");
            return(false);
        }
예제 #2
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;
        }
예제 #3
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"));
                }
            }
        }
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="address">the address of a Register</param>
 /// <param name="value">the value of a Register</param>
 public RegisterEventArgs(RegisterValue address, RegisterValue value)
 {
     Address = address;
     Value   = value;
 }
예제 #5
0
 public void SetRegisterValue(int RegisterAddress, RegisterValue newRegisterValue)
 {
     SccbRegisterList[RegisterAddress].Value = newRegisterValue;
 }
예제 #6
0
 public SccbRegister(RegisterValue nAddress, RegisterValue nValue)
 {
     MyAddress = nAddress;
     Value     = nValue;
 }
예제 #7
0
 public SccbRegister(byte sAddress, RegisterValue sValue)
 {
     MyAddress = new RegisterValue();
     MyAddress.setByte(sAddress);
     Value = sValue;
 }
예제 #8
0
 public SccbRegister(RegisterValue nAddress)
 {
     MyAddress = nAddress;
     Value     = new RegisterValue();
 }