[SunRescue] Using a SS1 to key a radio transmitter via RS232?????

James Lockwood james at foonly.com
Sat Aug 5 21:54:44 CDT 2000


On Fri, 4 Aug 2000, BSD Bob the old greybead BSD freak wrote:

> Timing is everything, so I need some way to time, independent of the OS,
> say from a hardware clock, or something like that.  The OS and program
> need to check the time, occasionally (every 10 ms or so, and toggle
> the line appropriately.
> 
> How might one do this sort of thing on a Sun?

Flip the RTS bit back and forth:

    int x, fd;

    fd = open("/dev/cua/a", O_RDWR);

    /* to turn "off" */
    x = 0x0000;
    ioctl(fd, TIOCMSET, &x);

    /* to turn "on" */
    x = TIOCM_RTS;
    ioctl(fd, TIOCMSET, &x);

This will work just fine with a reed relay, though you'll get better
response times and less inductive feedback with a transistor (power MOSFET
if you need to switch a big load).

You can also flip DTR, but some kernel drivers enforce a minimum delay
time (on the order of a second) when tweaking DTR.  Not sure about SunOS
4.

> Any pointers or suggestions are appreciated.
> 
> Surely someone has done this before?

Works great on everything from my SS1 on up.  Should also work fine on
sun3.

The 10ms granularity is somewhat more difficult.  The system timer can
handle 100Hz resolution but if you need to be accurate to a smaller
interval (1-2ms) then you may have to raise the priority of your process
and do busy-waiting internally.  On newer boxes you can increase the
system timer resolution (paying a penalty in interrupt overhead) but this
is not an option on sun3 and sun4c.

I do know someone who built commercial high-resolution timer boards for
the 3/60 with sub-1ms interrupt resolution, but he hasn't sold any in a
decade. 

-James






More information about the rescue mailing list