J
J_expoler2
Guest
/ * Navn: Prøve Kommiss's Program - adspurgte Version - termpoll.c * /
/ * Skrevet af: Craig PEACOCK <cpeacock(at)senet.com.au> * /
/ * Dato: lørdag 22 februar 1997 * /
/ * Copyright 1997 CRAIG PEACOCK <cpeacock(at)senet.com.au> * /
/ * Se http://www.senet.com.au/ ~ cpeacock/serial1.htm * /
/ * For More Information * /
#
include <dos.h>
#
include <stdio.h>
#
include <conio.h>
# define PORT1 0x3F8
/ * Definerer Serial Ports Base Adresse * /
/ * COM1 0x3F8 * /
/ * COM2 0x2F8 * /
/ * COM3 0x3E8 * /
/ * COM4 0x2E8 * /
void Main (void)
(
int c;
int ch;
outportb (PORT1 1, 0); / * Sluk afbryder - Port1 * /
/ * PORT 1 - Meddelelse Indstillinger * /
outportb (PORT1 3, 0x80); / * SET DLAB PÅ * /
outportb (PORT1 0, 0x03); / * Set baudhastighed - divisor låsen Lav Byte * /
/ * Standard 0x03 =
38400 BPS * /
/ * 0x01 = 115.200 BPS * /
/ * 0x02 =
57600 BPS * /
/ * 0x06 =
19200 BPS * /
/ * 0x0C =
9600 BPS * /
/ * 0x18 =
4800 BPS * /
/ * 0x30 =
2400 BPS * /
outportb (PORT1 1, 0x00); / * Set baudhastighed - divisor låsen High Byte * /
outportb (PORT1 3, 0x03); / * 8 bits, ingen paritet, 1 Stop Bit * /
outportb (PORT1 2, 0xC7); / * FIFO Control Register * /
outportb (PORT1 4, 0x0B); / * Tænd DTR, RTS og OUT2 * /
printf ( "\ nSample Kommiss's Program". Tryk på ESC for at afslutte, \ n ");
do (c = inportb (PORT1 5); / * Check for at se, om CHAR har været * /
/ * Modtaget.* /
if (c & 1) (ch = inportb (PORT1); / * Hvis ja, så får Char * /
printf ( "% c", ch)
/ * Print Alfanum til Screen * /
if (kbhit ()) (ch = getch (); / * Hvis tasten nede, få Alfanum * /
outportb (PORT1, ch)
/ * Send Alfanum til Serial Port * /
) While (ch! = 27); / * Afslut når ESC (ASC 27) er trykket * /
)denne første serielle port ture??nogen kan hjælpe mig pls
takker
/ * Skrevet af: Craig PEACOCK <cpeacock(at)senet.com.au> * /
/ * Dato: lørdag 22 februar 1997 * /
/ * Copyright 1997 CRAIG PEACOCK <cpeacock(at)senet.com.au> * /
/ * Se http://www.senet.com.au/ ~ cpeacock/serial1.htm * /
/ * For More Information * /
#
include <dos.h>
#
include <stdio.h>
#
include <conio.h>
# define PORT1 0x3F8
/ * Definerer Serial Ports Base Adresse * /
/ * COM1 0x3F8 * /
/ * COM2 0x2F8 * /
/ * COM3 0x3E8 * /
/ * COM4 0x2E8 * /
void Main (void)
(
int c;
int ch;
outportb (PORT1 1, 0); / * Sluk afbryder - Port1 * /
/ * PORT 1 - Meddelelse Indstillinger * /
outportb (PORT1 3, 0x80); / * SET DLAB PÅ * /
outportb (PORT1 0, 0x03); / * Set baudhastighed - divisor låsen Lav Byte * /
/ * Standard 0x03 =
38400 BPS * /
/ * 0x01 = 115.200 BPS * /
/ * 0x02 =
57600 BPS * /
/ * 0x06 =
19200 BPS * /
/ * 0x0C =
9600 BPS * /
/ * 0x18 =
4800 BPS * /
/ * 0x30 =
2400 BPS * /
outportb (PORT1 1, 0x00); / * Set baudhastighed - divisor låsen High Byte * /
outportb (PORT1 3, 0x03); / * 8 bits, ingen paritet, 1 Stop Bit * /
outportb (PORT1 2, 0xC7); / * FIFO Control Register * /
outportb (PORT1 4, 0x0B); / * Tænd DTR, RTS og OUT2 * /
printf ( "\ nSample Kommiss's Program". Tryk på ESC for at afslutte, \ n ");
do (c = inportb (PORT1 5); / * Check for at se, om CHAR har været * /
/ * Modtaget.* /
if (c & 1) (ch = inportb (PORT1); / * Hvis ja, så får Char * /
printf ( "% c", ch)
if (kbhit ()) (ch = getch (); / * Hvis tasten nede, få Alfanum * /
outportb (PORT1, ch)
) While (ch! = 27); / * Afslut når ESC (ASC 27) er trykket * /
)denne første serielle port ture??nogen kan hjælpe mig pls
takker