Oracle VirtualBox windows 10 default password is "changeme"
Wednesday, October 25, 2023
Monday, August 28, 2023
simplify C# null check . if(~ !=null) { } is ~? syntax.
if( X != null)
{
X.doSomething();
}
make simple like this
X?.doSomething();
Wednesday, June 14, 2023
ESP32 Clear(disable) esp_deep_sleep_enable_gpio_wakeup
Wednesday, April 26, 2023
Get serial pin event and status(level) c#(ring, cts, dsr, rlsd)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO.Ports;
using System.Reflection;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace SerialEventMonitor
{
class Program
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern Boolean GetCommModemStatus(SafeFileHandle hFile, ref UInt32 Status);
const UInt32 MS_CTS_ON = 0x0010;
const UInt32 MS_DSR_ON = 0x0020;
const UInt32 MS_RING_ON = 0x0040;
const UInt32 MS_RLSD_ON = 0x0080;
static void Main(string[] args)
{
Console.WriteLine( string.Join( ",",SerialPort.GetPortNames()));
string com_port_name = Console.ReadLine();
SerialPort port = new SerialPort(com_port_name.Trim(), 9600, Parity.None, 8, StopBits.One);
port.PinChanged += PinChanged;
port.Open();
DateTime dt_Start = DateTime.MinValue;
while(true)
{
if( port.ReadExisting() == "q")
break;
System.Threading.Thread.Sleep(1000);
}
port.Close();
port.Dispose();
}
private static void PinChanged(object sender, SerialPinChangedEventArgs e)
{
SerialPort port = sender as SerialPort;
Console.WriteLine( e.EventType.ToString());
ShowPinStates(port);
}
static private void ShowPinStates(System.IO.Ports.SerialPort serialPort)
{
UInt32 Status = 0;
Boolean CTS = false;
Boolean DSR = false;
Boolean DCD = false;
Boolean RI = false;
if (serialPort == null) return;
if (serialPort.IsOpen)
{
object baseStream = serialPort.BaseStream;
Type baseStreamType = baseStream.GetType();
// Get the Win32 file handle for the port
SafeFileHandle portFileHandle = (SafeFileHandle)baseStreamType.GetField("_handle", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(baseStream);
if (GetCommModemStatus(portFileHandle, ref Status))
{
CTS = ((Status & MS_CTS_ON) == MS_CTS_ON);
DSR = ((Status & MS_DSR_ON) == MS_DSR_ON);
DCD = ((Status & MS_RLSD_ON) == MS_RLSD_ON);
RI = ((Status & MS_RING_ON) == MS_RING_ON);
Console.WriteLine(RI);
}
}
}
}
}
Friday, June 24, 2022
How to use Mitutoyo Digimatic Indicator Interface cable ( USB-ITN ) by VCP(serial) API
Mitsutoyo supplies VCP driver for using as Serial port(COM port).
1. download VCP driver bellow link.
https://drive.google.com/file/d/1Jqvw-fO2zItXSliuVXSOlYRzt5G7uoM9/view?usp=sharing
Thursday, August 27, 2020
TDA7468이 소리를 내지 않을때. (TDA7468 not works)
register 0x02 에 0x19를 넣어주자.
--------------------------
if TDA7468 not works
write 0x19 into register 0x02 (surround)
ISE Design suite에서 File Open 을 하면 프로그램이 꺼진다면 (Crash on ISE Design Suite File Open Menu)
설치되어있는 디렉토리 밑에
예를 들면
C:\Xilinx\14.4\ISE_DS\ISE\bin\nt64
에 있는
libPortabilityNOSH.dll 을 libPortability.dll 로 대체한다.
즉. 원래있던 libPortability.dll 를 LibPortability_old.dll 식으로 백업해놓고
libPortabilityNOSH.dll 을 libPortability.dll 로 복사해넣으면됨.
1. Backup libPortability.dll
2. Delete libPortability.dll

