Ejemplo n.º 1
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     UInt32[] address;
     if (inputName.Text == "")
     {
         MessageBox.Show("Please type in a code name!");
         return;
     }
     bool okay = WatchList.TryStrToAddressList(inputAddress.Text, out address);
     if (!okay)
     {
         MessageBox.Show("Unable to parse address");
     }
     else
     {
         WAddress = address;
         WName = inputName.Text;
         switch (DType.SelectedIndex)
         {
             case 0:
                 WDataSize = WatchDataSize.Bit8;
                 break;
             case 1:
                 WDataSize = WatchDataSize.Bit16;
                 break;
             case 3:
                 WDataSize = WatchDataSize.SingleFp;
                 break;
             default:
                 WDataSize = WatchDataSize.Bit32;
                 break;
         }
         DialogResult = DialogResult.OK;
     }
 }
Ejemplo n.º 2
0
        public void AddWatch(String name, UInt32[] address, WatchDataSize dataSize)
        {
            String dType;

            switch (dataSize)
            {
            case WatchDataSize.Bit8:
                dType = "8 bit";
                break;

            case WatchDataSize.Bit16:
                dType = "16 bit";
                break;

            case WatchDataSize.Bit32:
                dType = "32 bit";
                break;

            default:
                dType = "Single";
                break;
            }
            watchOut.Rows.Add(1);
            int row = watchOut.Rows.Count - 1;

            watchOut.Rows[row].Cells[0].Value = name;
            watchOut.Rows[row].Cells[1].Value = "????????";
            watchOut.Rows[row].Cells[2].Value = dType;
            watchOut.Rows[row].Cells[3].Value = "????????";

            addressWatchList.Add(new WatchEntry(name, address, dataSize));
        }
Ejemplo n.º 3
0
        private string ParseValue(uint peekValue, WatchDataSize dataSize, uint add, WatchEntry entry)
        {
            string pOutput = string.Empty;
            uint   val;
            float  floatV;

            switch (dataSize)
            {
            case WatchDataSize.Bit8:
                switch (add)
                {
                case 0:
                    val = ((peekValue & 0xFF000000) >> 24);
                    break;

                case 1:
                    val = ((peekValue & 0x00FF0000) >> 16);
                    break;

                case 2:
                    val = ((peekValue & 0x0000FF00) >> 8);
                    break;

                default:
                    val = ((peekValue & 0x000000FF) >> 0);
                    break;
                }
                entry.lastValue = val;
                pOutput         = GlobalFunctions.toHex(val, 2);
                break;

            case WatchDataSize.Bit16:
                switch (add)
                {
                case 0:
                    val = ((peekValue & 0xFFFF0000) >> 16);
                    break;

                default:
                    val = ((peekValue & 0x0000FFFF) >> 0);
                    break;
                }
                entry.lastValue = val;
                pOutput         = GlobalFunctions.toHex(val, 4);
                break;

            case WatchDataSize.Bit32:
                entry.lastValue = peekValue;
                pOutput         = GlobalFunctions.toHex(peekValue);
                break;

            default:
                entry.lastValue = peekValue;
                floatV          = GlobalFunctions.UIntToSingle(peekValue);
                pOutput         = floatV.ToString("G6");
                break;
            }
            return(pOutput);
        }
Ejemplo n.º 4
0
 public WatchEntry(String name, UInt32[] address, WatchDataSize dataSize)
 {
     PName         = name;
     PAddress      = address;
     PDataSize     = dataSize;
     PUPAddress    = 0;
     PAddressAvail = false;
     PLastValue    = 0;
 }
Ejemplo n.º 5
0
 public WatchEntry(String name,UInt32[] address,WatchDataSize dataSize)
 {
     PName = name;
     PAddress = address;
     PDataSize = dataSize;
     PUPAddress = 0;
     PAddressAvail = false;
     PLastValue = 0;
 }
Ejemplo n.º 6
0
 public WatchEntry(string name, uint[] address, WatchDataSize dataSize)
 {
     this.name      = name;
     this.address   = address;
     this.dataSize  = dataSize;
     updatedAddress = 0;
     addressAvail   = false;
     lastValue      = 0;
 }
Ejemplo n.º 7
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            uint[] address;
            if (inputName.Text == string.Empty)
            {
                MessageBox.Show("Please type in a code name!");
                return;
            }
            bool okay = WatchList.TryStrToAddressList(inputAddress.Text, out address);

            if (!okay)
            {
                MessageBox.Show("Unable to parse address");
            }
            else
            {
                WAddress = address;
                WName    = inputName.Text;
                switch (DType.SelectedIndex)
                {
                case 0:
                    WDataSize = WatchDataSize.Bit8;
                    break;

                case 1:
                    WDataSize = WatchDataSize.Bit16;
                    break;

                case 3:
                    WDataSize = WatchDataSize.SingleFp;
                    break;

                default:
                    WDataSize = WatchDataSize.Bit32;
                    break;
                }
                DialogResult = DialogResult.OK;
            }
        }
Ejemplo n.º 8
0
        public void UpdateEntry(String name, UInt32[] address, WatchDataSize dataSize)
        {
            if (watchOut.SelectedRows.Count == 0)
            {
                return;
            }

            int index = watchOut.SelectedRows[0].Index;

            String dType;

            switch (dataSize)
            {
            case WatchDataSize.Bit8:
                dType = "8 bit";
                break;

            case WatchDataSize.Bit16:
                dType = "16 bit";
                break;

            case WatchDataSize.Bit32:
                dType = "32 bit";
                break;

            default:
                dType = "Single";
                break;
            }

            watchOut.Rows[index].Cells[0].Value = name;
            watchOut.Rows[index].Cells[1].Value = "????????";
            watchOut.Rows[index].Cells[2].Value = dType;
            watchOut.Rows[index].Cells[3].Value = "????????";

            addressWatchList[index] = new WatchEntry(name, address, dataSize);
        }
Ejemplo n.º 9
0
        public void UpdateEntry(String name, UInt32[] address, WatchDataSize dataSize)
        {
            if (watchOut.SelectedRows.Count == 0)
                return;

            int index = watchOut.SelectedRows[0].Index;
            
            String dType;
            switch (dataSize)
            {
                case WatchDataSize.Bit8:
                    dType = "8 bit";
                    break;
                case WatchDataSize.Bit16:
                    dType = "16 bit";
                    break;
                case WatchDataSize.Bit32:
                    dType = "32 bit";
                    break;
                default:
                    dType = "Single";
                    break;
            }

            watchOut.Rows[index].Cells[0].Value = name;
            watchOut.Rows[index].Cells[1].Value = "????????";
            watchOut.Rows[index].Cells[2].Value = dType;
            watchOut.Rows[index].Cells[3].Value = "????????";

            addressWatchList[index] = new WatchEntry(name, address, dataSize);
        }
Ejemplo n.º 10
0
        public void AddWatch(String name, UInt32[] address, WatchDataSize dataSize)
        {
            String dType;
            switch (dataSize)
            {
                case WatchDataSize.Bit8:
                    dType = "8 bit";
                    break;
                case WatchDataSize.Bit16:
                    dType = "16 bit";
                    break;
                case WatchDataSize.Bit32:
                    dType = "32 bit";
                    break;
                default:
                    dType = "Single";
                    break;
            }
            watchOut.Rows.Add(1);
            int row = watchOut.Rows.Count - 1;            
            watchOut.Rows[row].Cells[0].Value = name;
            watchOut.Rows[row].Cells[1].Value = "????????";
            watchOut.Rows[row].Cells[2].Value = dType;
            watchOut.Rows[row].Cells[3].Value = "????????";

            addressWatchList.Add(new WatchEntry(name, address, dataSize));
        }
Ejemplo n.º 11
0
 private String ParseValue(UInt32 peekValue,WatchDataSize dataSize, UInt32 add, WatchEntry entry)
 {
     String pOutput="";
     UInt32 val;
     Single floatV;
     switch (dataSize)
     {
         case WatchDataSize.Bit8:
             switch (add)
             {
                  case 0: val = ((UInt32)(peekValue & 0xFF000000) >> 24);
                     break;
                  case 1: val = ((UInt32)(peekValue & 0x00FF0000) >> 16);
                     break;
                  case 2: val = ((UInt32)(peekValue & 0x0000FF00) >> 8);
                     break;
                 default: val = ((UInt32)(peekValue & 0x000000FF) >> 0);
                     break;
             }
             entry.lastValue = val;
             pOutput = GlobalFunctions.toHex(val, 2);
             break;
         case WatchDataSize.Bit16:
             switch (add)
             {
                 case 0: val = ((UInt32)(peekValue & 0xFFFF0000) >> 16);
                     break;
                 default: val = ((UInt32)(peekValue & 0x0000FFFF) >> 0);
                     break;                        
             }
             entry.lastValue = val;
             pOutput = GlobalFunctions.toHex(val, 4);
             break;
         case WatchDataSize.Bit32:
             entry.lastValue = peekValue;
             pOutput = GlobalFunctions.toHex(peekValue);
             break;
         default:
             entry.lastValue = peekValue;
             floatV = GlobalFunctions.UIntToSingle(peekValue);
             pOutput = floatV.ToString("G6");
             break;
     }
     return pOutput;
 }