05-16-2006 03:34 PM
05-17-2006 01:40 AM
05-17-2006 09:08 AM - edited 05-17-2006 09:08 AM
As stated by Malanar, ComSetEscape() can be used to control the DTR or RTS signals. The logic level of a standard PC serial port is pulse and minus 12V not 0-5V, but since you are feeding RX and TX to the PIC you obviously have this covered. Implementing it the way you describe is really just creating you own method of hardware handshaking. It should not be a problem.
You can read the CTS and DSR signals with GetComLineStatus(), but it is probably too difficult to generate the correct logic levels for the signals from the PIC side of things.
Message Edited by mvr on 05-17-2006 09:11 AM
05-20-2006 09:58 AM - edited 05-20-2006 09:58 AM
Message Edited by Malanar on 05-20-2006 10:00 AM
04-17-2009 12:42 PM
Hello to all,
I am new & have simple question, how to see DTR & RTS value on the pin (someone may pull it down) ??
ComSetEscape(4,SETDTR);
ComSetEscape(4,CLRDTR);
This two lines realy change the signal on the DTR pin, but I can read it back ? or have to make DTR image in the variable?
status = GetComLineStatus(4);
Status does not contain DTR signal ! or it does?, where is function to give me the DTR value in return , who will give me the asnwer ?
p.s. better, if exist read modify write function for DTR pin ..
regards Smile_
04-20-2009 09:00 AM
on a serial cable, every signals which goes in one direction has a counter-part which goes in the reverse direction. in this case, the couterpart to DTR is called DSR. you can read the state of the DSR signal by using the GetComLineStatus() function.
(please, create a new thread for posting a new question)
04-21-2009 03:52 AM
Hi to all,
- PC 16550D is common COM serial standard controller on PC computers ...
- MCR modem control register, MSR moden status register, Echo mode
- There deep in 16550 in MCR is bit 4 , when it is set the 16550 is in echo mode
- MCR bit4 = 0 : MSR bit 4 = CTS, bit 5 = DSR ( non Echo mode)
- MCR bit4 = 1 : MSR bit 4 = RTS, bit 5 = DTR ( Echo mode, means the loop back mode output signals are tied back , input signals cts&dsr are cut off)
That means I can read status of RTS & DTR on same controller in echo mode of itself.
Q: The question is how to do this job in CVI with CVI instructions ..
regards Smile_
04-21-2009 12:09 PM
The CVI libraries are, for the most part, layers over the Win32 API (or Linux equivalent). CVI can therefore only do what windows allows it to. Windows provides a set of functions for writing/reading to serial ports, and controlling their handshake lines manually if desired. If you want to access the registers of 16550 directly, you'll have to bypass drivers, etc. Probably not the most graceful or easy solution.....I don't know what you're doing, but I would suspect there is a better way to accomplish it:
As previously mentioned, the serial ports have some output signals, and some input signals. The Windows abstraction layer seems to assume that since you're controlling the serial port, you should already know the state of the output signals (I've never stumbled across a function to read back RTS or DTR signals after you set them). The output signals are, however, set to well defined values when the port is opened, and if you're using manually handshaking, then your software should know the values of the lines and be able to keep track of when you set/clear them. As for the input signals, you can read them with the GetComLineStatus function.
If you want to review the Win32 API functions that are likely used by CVI to perform all of this, check out http://msdn.microsoft.com/en-us/library/aa363194(VS.85).aspx
04-22-2009 07:59 AM
Well, the real world is defferent.
Set DTR, CTS not always means that the DTR,CTS goes high.
Usualy on start stuff not works, what is wrong? expect the software tell
me what, cable, Hw Sw ?
I have idea how to test this lines, maybe make DLL somewhere and use
functions..
regards Smile_
04-22-2009 08:37 AM