61
API / VCOM Commands
Appendix
IND100077-132
Basic Example for setting Half/Full Duplex Mode
Example using Linux, C style.
Note,
ttyS7
has been used as port ID. It may differ depending on your system installation. In any case, simply write
ttyS
x
(where
x
is the number defined by the Operating System automatically) for Virtual COM Port.
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>
#include <unistd.h>
int
main(
void
)
{
int
n;
int
f;
struct
termios options;
//Open COM Port
f = open(“/dev/
ttyS7
”, O_RDWR | O_NOCTTY | O_NDELAY);
if
(f == -
1
)
{
perror(“open_port: Unable to open:”);
return
-
1
;
}
else
{
printf(“COM Port Opened!\n”);
fcntl(f, F_SETFL,
0
);
}
//Configure COM Port
tcgetattr(f, &options);
cfsetispeed(&options, B9600);
cfsetospeed(&options, B9600);
options.c_cflag |= (CLOCAL | CREAD);
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CSIZE;
options.c_cflag |= CS8;
tcsetattr(f, TCSANOW, &options);
//Half Duplex Write
unsigned char
half_duplex_cmd[
9
] = {
0x07,0xFF,0x51,0x44,0x55,0x01,0x0E,0x00,0xFF
};
write(f, half_duplex_cmd,
9
);
printf(“Sent Half Duplex\n”);
//Full Duplex Write
unsigned char
full_duplex_cmd[
9
] = {
0x07,0xFF,0x51,0x44,0x55,0x01,0x0E,0xFF,0x00
};
write(f, full_duplex_cmd,
9
);
printf(“Sent Full Duplex\n”);
//Close COM Port
close(f);
printf(“Finished!\n”);
return
0
;
}
Содержание Hatteland Display HT B22G Series
Страница 6: ...6 This page left intentionally blank...
Страница 7: ...7 General...
Страница 11: ...11 Installation...
Страница 24: ...24 This page left intentionally blank...
Страница 25: ...25 Specifications...
Страница 37: ...37 Technical Drawings...
Страница 39: ...39 Technical Drawings Accessories...
Страница 44: ...44 This page left intentionally blank...
Страница 45: ...45 Appendixes...
Страница 65: ...65 Appendix IND100077 24 User Notes...
Страница 67: ...67 Revision History IND100077 128...
Страница 68: ...www hatteland display com...