Programming Serial Port Com3 - Lippert 702-0008-10 Technical Manual

Cool literunner pc/104 cpu board
Table of Contents

Advertisement

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'
The example is meant to be compiled using gcc under Linux.
#include <sys/io.h>
#include <stdio.h>
#define DATA_REG 0x1221
void Com3Transmitter(unsigned char ON)
{
unsigned char regval;
if(ON)
regval = inb(DATA_REG) | 1;
else
regval = inb(DATA_REG) & ~1;
outb(regval, DATA_REG);
printf("regval=%x
}
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
return 0;
}
TME-104-CLR-LX800-R1V3.doc
enables transmitter
//Port addres for fast access to GPIO2x bank
// enable COM3 RS485, Bit 0 of GPIO2x
// disable COM3 RS485, Bit 1 of GPIO2x
inb=%x\n",regval,inb(DATA_REG));
Rev. 1.3
-> OFF\nvalue = 1
-> ON\n");
45(53)

Advertisement

Table of Contents
loading

This manual is also suitable for:

802-0008-10Clr-lx800902-0008-10

Table of Contents