Specifications

TME-104-CLR-LX800-R1V3.doc Rev. 1.3 45(53)
4.3 Programming Serial Port COM3
The transmitter of the RS485 interface must be disabled in receive mode,
and enabled in transmit mode. The receiver has to be enabled in BIOS,
by selecting the RS485 mode.
Therefore, setting GPIO2x of the ITE Super I/O
Bit 0 to ‘0’ Æ disables transmitter, ‘1’ Æ enables transmitter
The example is meant to be compiled using gcc under Linux.
#include <sys/io.h>
#include <stdio.h>
#define DATA_REG 0x1221 //Port addres for fast access to GPIO2x bank
void Com3Transmitter(unsigned char ON)
{
unsigned char regval;
if(ON)
regval = inb(DATA_REG) | 1; // enable COM3 RS485, Bit 0 of GPIO2x
else
regval = inb(DATA_REG) & ~1; // disable COM3 RS485, Bit 1 of GPIO2x
outb(regval, DATA_REG);
printf("regval=%x inb=%x\n",regval,inb(DATA_REG));
}
int main(int argc, char *argv[])
{
unsigned char value;
iopl(3);
if(argc == 2)
{
value = strtol(argv[1], (char**)NULL,10);
if(value == 0 || value == 1)
Com3Transmitter(value);
else
printf("ERROR: wrong value\n");
}
else
printf("USAGE: ./com3 <value>\nvalue = 0 -> OFF\nvalue = 1 -> ON\n");
return 0;
}