|
|
|
uprvalenie DTR linii COM porta
|
|||
|---|---|---|---|
|
#18+
HANDLE hCom = CreateFile( "COM1:", GENERIC_READ | GENERIC_WRITE, 0, // must be opened with exclusive-access NULL, // no security attributes OPEN_EXISTING, // must use OPEN_EXISTING 0, // not overlapped I/O NULL // hTemplate must be NULL for comm devices ); if (hCom == INVALID_HANDLE_VALUE) { ShowMessage("Port is not open !!!"); } else { ShowMessage("Port open"); } DCB PortDCB; PortDCB.DCBlength = sizeof (DCB); // Get the default port setting information. GetCommState (hCom, &PortDCB); PortDCB.BaudRate = 9600; // Current baud PortDCB.fDtrControl = DTR_CONTROL_ENABLE; // DTR flow control type PortDCB.ByteSize = 8; // Number of bits/byte, 4-8 PortDCB.Parity = NOPARITY; // 0-4=no,odd,even,mark,space PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2 if (!SetCommState (hCom, &PortDCB)) { ShowMessage("Unable to configure the serial port"); } COMMTIMEOUTS cto; cto.ReadIntervalTimeout = 0; cto.ReadTotalTimeoutMultiplier = 0; cto.ReadTotalTimeoutConstant = 0; cto.WriteTotalTimeoutMultiplier = 0; cto.WriteTotalTimeoutConstant = 0; SetCommTimeouts (hCom, &cto); //Then im trining to chanege potr state by the EscapeCommFunction EscapeCommFunction(hCom, SETDTR); //To Set DTR EscvapeCommFunction(hCom, CLRDTR); //To reset DTR //i close port by CloseHandle(hCom); ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.08.2005, 10:45 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=33233388&tid=2032867]: |
0ms |
get settings: |
6ms |
get forum list: |
10ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
63ms |
get topic data: |
8ms |
get forum data: |
2ms |
get page messages: |
24ms |
get tp. blocked users: |
1ms |
| others: | 205ms |
| total: | 323ms |

| 0 / 0 |
