public Rs232cController serialController; public class Rs232cController { public byte[] ShortToByte(ushort dum) { byte[] returnData = new byte[2]; returnData[0] = (byte)(dum >> 8); returnData[1] = (byte)(dum); return returnData; } } public class NL9504Controller : Rs232cController { public void WDTSet(int id, byte wdt) { byte[] sendData = new byte[7]; byte[] tmp = new byte[2]; ushort address = 0; address = 0x0E00; tmp = ShortToByte(address); sendData[0] = (byte)'c'; sendData[1] = (byte)0x03; sendData[2] = (byte)id; sendData[3] = (byte)0; sendData[4] = (byte)tmp[0]; sendData[5] = (byte)tmp[1]; sendData[6] = (byte)wdt; Open(); Send(sendData, 7); Close(); sendData[0] = (byte)'c'; sendData[1] = (byte)0x08; sendData[2] = (byte)id; sendData[3] = (byte)0; sendData[4] = (byte)tmp[0]; sendData[5] = (byte)tmp[1]; sendData[6] = (byte)wdt; Open(); Send(sendData, 7); Close(); } } public class TB2448DUTY24 : NL9504Controller { public byte[] CoarseAdjustRead(int id, int bank) { ushort address; byte[] sendData = new byte[6]; byte[] tmp = new byte[2]; byte[] readData1 = new byte[6]; byte[] readData2 = new byte[6]; byte[] returnData = new byte[9]; address = (ushort)(0x0C00 + 0x1000 * (bank)); tmp = ShortToByte(address); sendData[0] = (byte)'c'; sendData[1] = (byte)0x02; sendData[2] = (byte)id; sendData[3] = (byte)5; sendData[4] = tmp[0]; sendData[5] = tmp[1]; Open(); Send(sendData, 6); System.Threading.Thread.Sleep(1); readData1 = Receive(6); Close(); address = (ushort)(0x0C00 + 0x1000 * (bank)); tmp = ShortToByte(address); sendData[0] = (byte)'c'; sendData[1] = (byte)0x07; sendData[2] = (byte)id; sendData[3] = 5; sendData[4] = tmp[0]; sendData[5] = tmp[1]; Open(); Send(sendData, 6); System.Threading.Thread.Sleep(1); readData2 = Receive(6); Close(); returnData[3] = readData1[3]; // Green returnData[4] = readData1[4]; // Green returnData[5] = readData1[5]; // Green returnData[0] = readData2[0]; // Blue returnData[1] = readData2[1]; // Blue returnData[2] = readData2[2]; // Blue returnData[6] = readData2[3]; // Red returnData[7] = readData2[4]; // Red returnData[8] = readData2[5]; // Red return returnData; } }
ウィンドウ起動時に、
serialController = new TB2448DUTY24(communicationData);
を呼び出して、
serialControllerの関数を呼び出そうと思ったのですが、
ShortToByteしか表示されません。
C++では、すべて表示されていたと記憶していたのですが、C#はこんなもんなのですか?
私が何か大きな勘違いをしていますか?
ご教授をお願いいたします。
回答6件
あなたの回答
tips
プレビュー