1. Engineering
  2. Computer Science
  3. help me write poll function in mpx instructions included hello...

Question: help me write poll function in mpx instructions included hello...

Question details

Help me write poll() function in MPX! (instructions included!)

Hello, I am having great trouble with creating poll() function in c language and dont even know where to start with

Here are the description for the poll:

you will write a special method that will “poll” for characters from the serial port and store them one at a time into the character buffer until a return is received or the buffer is full. Polling works as follows.

For now, polling I/O will be implemented to collect input from the user's keyboard

◦ The Intel 8250 UART contains multiple registers which are used to set options and get information.

◦ Data will be collected on a character-by-character basis and stored in the COM1 BASE register (0x3F8)

◦ When data is available, the 8250 sets the least significant bit in the line status register (COM1+5)

◦ Therefore, your polling code may look something like:

while (1) // Run continuously

if inb(COM1+5)&1 // Is a character available?

char letter = inb(COM1); //Get the character

// STORE & PRINT or HANDLE the character

◦ Note: The inb instruction reads a byte from a particular port

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution