Notes
Notes - notes.io |
#include <stdio.h>
#include <conio.h>
#define PORT1 0x3F8
/* Defines Serial Ports Base Address */
/* COM1 0x3F8 this I/O base address for serial port 1 */
/* COM2 0x2F8 */
/* COM3 0x3E8 */
/* COM4 0x2E8 */
void main(void)
{
int c; /* content of a register – a byte*/
int ch; /* date byte */
outportb(PORT1 + 1 , 0); /* Turn off interrupts - Port1 (modifying IER)*/
/* PORT 1 - Communication Settings */
outportb(PORT1 + 3 , 0x80); /* LCR access - SET DLAB ON */
outportb(PORT1 + 0 , 0x03); /* Set Baud rate-Divisor Latch Low Byte */
/* Default 0x03 = 38,400 BPS */
/* 0x01 = 115,200 BPS */
/* 0x02 = 57,600 BPS */
/* 0x06 = 19,200 BPS */
/* 0x0C = 9,600 BPS */
/* 0x18 = 4,800 BPS */
/* 0x30 = 2,400 BPS */
outportb(PORT1 + 1 , 0x00); /* Set Baud rate - Divisor Latch High Byte */
outportb(PORT1 + 3 , 0x03); /*LCR access:8 Bits, No Parity, 1 Stop Bit */
outportb(PORT1 + 2 , 0xC7); /*FCR access:FIFO Control Register */
outportb(PORT1 + 4 , 0x0B); /*MCR access:Turn on DTR,RTS,and OUT2 */
printf("nSample Comm's Program. Press ESC to quit n");
do { c = inportb(PORT1 + 5); /* Check to see if char has been */
/* received. Accessing LSR register */
if (c & 1) { /* data is ready */
ch = inportb(PORT1 + 0); /* access RBR- get Char */
printf("%c",ch);} /* Print Char to Screen */
if (kbhit()){ ch = getch(); /* If key pressed, get Char */
outportb(PORT1 + 0, ch);} /* access THR - Send Char to Serial Port */
} while (ch !=27); /* Quit when ESC (ASC 27) is pressed */
}
/* end of polling based I/O example for
serial ports */
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team