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

C, A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P...

A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of the c

I need script for auto seating poker, Project Description: Not just like...

Project Description: Not just like that though. I want a similar program that can scan through poker lobbys (pokerstars, full tilt, ongame and ipoker) and seat me to the left of

C++ programming, Write a program to convert English units to metric (e.g., ...

Write a program to convert English units to metric (e.g., miles to kilometers, gallons to liters, etc.). Include a specification and a code design.

Explain pure virtual functions, Pure Virtual Functions An abstract clas...

Pure Virtual Functions An abstract class is one, which is used just for deriving some other classes. No object of this class is declared and used in the program. Likewise, ther

Client server using c, (a) client server or multithreaded client-server, wh...

(a) client server or multithreaded client-server, where server will create pool of worker threads (say 5) to provide services to pool of clients (say 5 ).Server should be behaving

M - algorithm corrections, Of course it is C[i] = A[i] + B[i].It was a typi...

Of course it is C[i] = A[i] + B[i].It was a typing mistake,never mind. You just understand the concept. 27-1 b. for grain-size=1 n=A.length grain-size=1 r=n for

Write short note on classes in c++, Introduction to Classes Object-orie...

Introduction to Classes Object-oriented programming (OOP) is a conceptual approach to design programs. It can be executed in many languages, whether they directly support OOP c

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