コード例 #1
0
 private void btnReadDevID_Click(object sender, EventArgs e)
 {
     txtStatus.Clear();
     string SelectedItem=cmbDevice.SelectedItem.ToString().Trim();
     if(SelectedItem==STR_PIC18F24J50)
     {
     PIC18F2xJxx p=new PIC18F2xJxx(myPIC18Program);
     txtStatus.AppendText("Starting Read Dev ID...\r\n");
     Application.DoEvents();
     ulong ? Result=p.ReadDeviceID();
     if(Result==null)
         txtStatus.AppendText("Error Reading Device ID!");
     else
         {
         if((Result&0xFFE0)==0x4C00)
             {
             string temp=String.Format("Found PIC18F24J50 Device ID: 0x{0:x4} Revision {1}",Result&0xFFE0,Result&0x1F);
             txtStatus.AppendText(temp);
             }
         else
             txtStatus.AppendText("Device Unknown!");
         }
     }
     else
     {
     txtStatus.AppendText("Device Unknown!");
     }
 }