os: windows 10 / 64 bits
application name: [login to view URL]
argument: com<port number> (case unsensitive)
Application core (example in attached [login to view URL] & .h c++ source):
The application is a loop based on windows media timer polling the serial port every milliseconds (code example attached, use of timeSetEvent api -> deprecated, to be replaced).
The serial ports are opened and closed with CreateFile and CloseHandle apis.
The port pin status are read with GetCommModemStatus api and set with EscapeCommFunction api. All algorithms and api parameter are used in attached source code.
system time in ms: GetTickCount() api
The application communicates thru standard input/output as follow (still case unsensitive):
- quit, bye, exit: ends loop and close console. Return sttus: 0 (exit(0))
- S(et),<pin number>,<value: 0 means low state, not 0 means high state, range 0x00 to 0xFF>: change pin state
Ex: s,1,1: set serial port pin 1 to high state
- G(et),<pin number>: returns pin state on standard output
Ex: g,8: returns pin 8 status with following syntax
- P(in),<pin number>,<system date/time in ms>,value: 0 or 1>
- when a pin status changes: C(hange),<pin number>,<system date/time in ms>,<value>
Ex: c,7,5248554170,0: pin 7 state changed to 0
In case of error: print on standard output: error,<reason>, then exit(1) console.
- r : reset idle statusIdleStatus is an int used as mask to detect pin changes (see ResetIdle() in attached source code)
serialpiner com5: starts application and starts com5 management.
in case of error: print error:<error reason>
if no error:
s,2,1: set output pin 2 to high
g,2,1: get output pin 2 status
p,2,2565448,1: returns pin status 2 with date/time
c,3,2566954,0: input pin 3 status change detected to low
quit: ends session, exit(0)
Serial port pinout:
[login to view URL]
How to test:
usb/serial adapter + strap between pin 5 and input pin
voltmeter for output pins (1,2,6,8,9)
Hi. I'm professional programmer/electronic hardware developer with experience over 20 years and I know very well RS232 protocol and it's physical layer. I can write this program. Regards, Alex.
12 фрилансеров(-а) в среднем готовы выполнить эту работу за $181
Greeting. I am YinWang. I have rich embedded development experiences. I am very interesting in your project. I really hope to work with you. This project is very appreciated in my skill. regards.