> From: al...@ee470.ee.mcgill.ca (HAMISHEH BAHAR ALI MR)
> Organization: McGill University, Undergraduate EE Lab
> Message-ID: <39pecd$h...@sifon.cc.mcgill.ca>
>
> could any kind person out there help out these humble, totally
> confused, utterly exhausted undergrads!!!
> we are trying to have vxworks talk to its serial ports, and just
> *cannot find out how* it does so!! what we are trying to do is just
> this:
>
> fd = open (some_device_name, WRITE);
>
> In unix, you could just say fd=open(/dev/tty1, WRITE);
> how does vxworks do it?
>
This is exactly the way VxWorks would do it.
-> fd = open("/tyCo/1", 2) (2 = UPDATE)
-> buffer = "this is a test"
-> nbytes = write(fd, buffer, strlen(buffer))
If nbytes is > 0 then the bytes were at least QUEUED to the tyCo Driver.
The tyCo driver (by default) sets up 512 byte input and output buffers
to the physical port (initialized in usrRoot in usrConfig.c). When
using unbuffered "write" calls, the bytes should then be written out the
port. If you're using the buffered I/O calls such as "fwrite", then
you may have to flush the buffers to get the byte out the port. You
can use the ioctl call:
-> ioctl(fd, 2, 1) ( 2 = FIOFLUSH from ioLib.h )
or
-> ioctl(fileno(FILE), 2, 1) (if you used fopen instead of open)
However, what you might be experiencing has nothing to do with the software.
If you're using a board that uses the Zilog Z8530SCC or its equivalent,
then check the serial driver to see if the AUTO_ENABLES bit is being set
(Write Register 3, bit 5 ). If so, then the serial port will not become
active until the carrier detect (CD) RS-232 signal goes high. Simply wire
the CD line (pin 8 on a "typical" DB-25 connector) to some other signal
that's already high such as DTR (pin 20) or RTS (pin 4).
Hope this helps,
===============================================================================
__ Real-Time System Development, Integration, Training and Services
//\\
// \\ Mike Anderson
// /\ \\ Director, Real-Time Systems
// / \ \\ SPARTA, Inc. Voice : (703) 448-0210 ext. 235
// \ \\ 7926 Jones Branch Drive FAX : (703) 734-3323
\\ \ // Suite 900 EMAIL : m...@mclean.sparta.com
\\ \ / // McLean, VA 22102
\\ \/ // "Software development is like making
\\ // a baby... You can't make a baby in one
\\// month by impregnating nine women.
-- "Pride in Performance" Some things just take time."
===============================================================================