Standard input- output using motorola and intel devices, C/C++ Programming

Assignment Help:

Talking to IO boards inside a computer or microcontroller depends upon the principles used by the microprocessor to address physical devices. On Motorola systems all devices connected to the processor local bus are memory mapped. Therefore it is fairly easier to address by means of a pointer the IO device, since it is just like RAM. In the case of Intel devices, the IO is not memory mapped, it is IO mapped. This causes a minor problem is accessing such devices, since the processor has to use IN, OUT commands and the address, therefore a simple pointer will not do. A non-ANSI function exists on PC's called 'portoutb' and 'portinb' these are used to input and output a byte of data (char) to an IO address (int). 

The syntax depends upon the compiler used by usually consists of
 
        outportb(address,data);
        data = inportb(address);
 
Care should be taken when porting code from an Intel platform to a Motorola platform since these functions are not standard ANSI and will need to converted for the Motorola Platform.  Below is shown an example for a 8255 IO board configured at a base address 0x2b4
 
 #include stdio.h
 #include dos.h
 
void main()
{
     Date: 26th August 1992 
    Version 1.0 
    Function : Reads port A and display it on the screen and portb,c       
     Modifications:  Non Standard non portable code PC only
    */
 
  int CardAddress = 0x2b0, BaseAddress, Port_a;
  int  Port_b, Port_c, ControlRegister;
  unsigned char ControlWord = 0x90, InputValue;
 
   BaseAddress = CardAddress + 4;
   Port_a = BaseAddress;
   Port_b = BaseAddress + 1;
      Port_c = BaseAddress + 2;
      ControlRegister = BaseAddress + 3;
    
      ControlWord = 0x90;
    
   outportb(ControlRegister, ControlWord);
    
   while (1)
   {
      InputValue = inportb(Port_a);
      outportb(Port_b, InputValue);
      outportb(Port_c, InputValue);
        
        printf("Read from A = %x\n", InputValue);
    }
}    
 
Despite these additions NON-ANSI functions they are only DOS commands and hence using Windows NT you will need to write a windows driver, for this you will need C++ and a few books on Windows.


Related Discussions:- Standard input- output using motorola and intel devices

Explain variables, Variables Information stored in a variable can alter...

Variables Information stored in a variable can alter in the course of the program. The type used in the definition explains the kind of information the symbol can store. Variab

Srand and rand(), Mention clearly about srand and rand().

Mention clearly about srand and rand().

Standard template library , The STL details are described in many places on...

The STL details are described in many places online (see the CS377 webpage for some links), and there's a very quick introduction in Section A.14. Here are just a few additional no

Minimum shelf, At a shop of marbles, packs of marbles are prepared. Packets...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Described access privileges in c++? what is the default , A: In C++ the acc...

A: In C++ the access privileges are public, private and protected. The default access level assigned to members of a class is private. Private members of any class are accessible o

Molecular dynamics and Monte carlo, Molecular dynamics for a Lennard-Jones ...

Molecular dynamics for a Lennard-Jones system (in C++) 1. Write a function which reads in the input variables of a molecular dynamics simulation of a Lennard-Jones system. The inpu

Padovan string, padovan string for natural numbers program in java /...

padovan string for natural numbers program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : package test.padovanstring; public class Padov

I want rss feed from emails, Project Description: I am trading binary op...

Project Description: I am trading binary options and need my signals that are sent to me via email to be sent to my followers via an RSS feed I have no idea how rss feeds imp

Friends of classes, Define the following Window class : - integer  data mem...

Define the following Window class : - integer  data members, width and height - a constructor  that accepts two integer  parameters  (width followed by height) and uses them to ini

.program, Write a c++ program to find the sum of 0.123 ??103 and 0.456 ??10...

Write a c++ program to find the sum of 0.123 ??103 and 0.456 ??102 and write the result in three significant digits

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd