Code Example for Acceleport Xp for SCO Open Server

Hi, I am a developer:

We are updating us system from digi Acceleport Xe to Acceleport Xp. we are using SCO Open Server.

i need information for remake our codes with this new card.
how to compile?
how to use handshaking?
me code need change?
what include need the new card?
i need some file .so?
do you can send me a code example and for compile?
i can compile a program with out install drivers using only some file like digi.h?

exist information in CD instalation?
exist informacion in files from instalation?

some examples:
#include
int AbrirPuerto()
{
int id = open(“/dev/ttyh1a”, O_WRONLY|O_NOCTTY );
if (id <= 0)
perror(“open”);
return id;
}

we are controling the handshaking, like that:
int Modem;
cout <<"+RTS ";
ioctl(id,TIOCMGET,&Modem);
Modem |= TIOCM_RTS;
ioctl(id,TIOCMSET,&Modem);

Thanks a lot,
Alberto

I’m not sure whether your environment is SCO OS 5.x or 6.x, but for either OS the driver is available from our Support site. Handshaking aka flow control is needed if the hardware you’re plugging into the Digi serial port uses it, and the port settings will have to match how the serial device is setup. Otherwise things should work the same.

You never need to use the digi.h file.

Its only used to control Digi specific things, which in your case, is not needed.

You should take a look at “man termios”

Along with the SCO header at /usr/include/sys/termio.h

Hi Alberto,

I suspect you probably have bought the wrong product for your application.

If you need to toggle RTS on/off in a short time period, like 1-10ms, you probably do NOT want the Accelport Xp.

You should probably get a non-intelligent product, like the Digi Neo product which basically gives you direct access to the UARTS, without having to go thru a firmware layer first.

BTW,
Our products do not support half-duplex mode, which is what it appears you are trying to “emulate” here.

Finally, the code to raise/lower RTS is pretty trivial,
but make SURE you do not have hardware flow control enabled. If you do, you CANNOT control the RTS pin.

Some trivial code I have lying around:

    for (;;) {
            ioctl(fd, TIOCMGET, &amp;msigs);
            msigs &amp;= ~TIOCM_RTS;
            fprintf(stderr, "Dropping RTS...

");
ioctl(fd, TIOCMSET, &msigs);
sleep(1);
ioctl(fd, TIOCMGET, &msigs);
msigs |= TIOCM_RTS;
fprintf(stderr, "Raising RTS…
");
ioctl(fd, TIOCMSET, &msigs);
sleep(1);
}

Thanks michaelt:

We are using SCO OS 5.0.7
All day we are making tests. our problem is the next:

we have one program, open port only write and transmit, this is ok.
Another program open port only read, when begin your read thread, the one program be “freeze”.
We are using the pth library from gnu for threads for make the reads from ports.
We have two cars digi, We test all ports /dev/ttyhxx, with any port exist the problem.

We have a big question: we are using the file digi.h “v1.1.1.1 2003/06/09 16:01:50” from Acceleport Xe drivers, i guest we need the new file .h or library for new card Acceleport Xp, right?
if yes, do you can send us information for new .h file or new library for developments?

Thanks,
Alberto Acosta

I’ve consulted with the engineer that maintains the SCO Xp driver. He said you don’t need the digi.h header file to run the commands in your program.

These are standard ioctl commands that don’t need the Digi-specific stuff which would be found in the headers file.

In short, yes this works by default, and no digi.h file is needed to make it work.

Thanks,

i used the Digi-specific stuff because digi.h have defines for handshaking and work correctly, we need to control pre & post transmisions times, and check state of DCD & CTS lines. With Port /dev/tty1a or any from mother board, we never can to control this lines like ports digi.

do you know how to do this with standard defines from system SCO? and work with port from mother card and digi ports correctly using the same defines?
do you can send some example code?

the file digi.h explain the next:
/************************************************************************

  • This module provides application access to special Digi
  • serial line enhancements which are not standard UNIX™ features.
    ************************************************************************/

and define the nexts lines:
#if !defined(TIOCMODG)

#define TIOCMODG (‘d’<<8) | 250 /* get modem ctrl state /
#define TIOCMODS (‘d’<<8) | 251 /
set modem ctrl state */

#ifndef TIOCM_LE
#define TIOCM_LE 0x01 /* line enable /
#define TIOCM_DTR 0x02 /
data terminal ready /
#define TIOCM_RTS 0x04 /
request to send /
#define TIOCM_ST 0x08 /
secondary transmit /
#define TIOCM_SR 0x10 /
secondary receive /
#define TIOCM_CTS 0x20 /
clear to send /
#define TIOCM_CAR 0x40 /
carrier detect /
#define TIOCM_RNG 0x80 /
ring indicator /
#define TIOCM_DSR 0x100 /
data set ready /
#define TIOCM_RI TIOCM_RNG /
ring (alternate) /
#define TIOCM_CD TIOCM_CAR /
carrier detect (alt) */
#endif

Best Regards,
Alberto Acosta

Thanks Scott :wink:

thanks scottk & michaelt,

i need to control the time and state of rts line:

          ______________________________________

rts line _| pre time Post time |
_____________
tx line _| tx data |

With port of motherboard and using the termio.h not worked.
With port of digi card and using the termio.h not worked
only work with digi port and digi.h.

but if you tell me that must work, maybe i have a error, i try again and will make more tests, but, if you can tell me or send me a example to control the line RTS, i will apreciate munch.

For example:

open port read & write, no modem ctrl, like terminal
down rts
sleep 5 seg.

up rts
sleep 2 seg.
write data
sleep 1 seg

sleep 5 seg
close port

I check this with rsr232 check tester with leds, conected over serial port.
in the example i use seconds for see the movement from lines, but in the practice is more fast, like 50 mseg of pre and 10 mseg of post for radios/9600 bauds.
I need the port open and rts line down for can recive data from another devices.

thanks again,
Alberto