Thread: Bitwise operations

  1. #16
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    So, maybe an easy example of how to 'talk' to the hardware or 'addresses' so I can see how it's done, if at all possible?
    A couple of things make this difficult on a PC:*

    - The current versions of Windows do not allow a user mode program to directly access the hardware. When you use the '&' (address-of) operator, you are getting a virtual address, not necessarily the true physical address in RAM. In order to access a physical address, you have to use the DDK (Driver Development Kit) to write a kernel mode driver. (I've never done this.)

    - Most of the hardware information is proprietary to the hardware manufacturer. Your modem might have a particular bit in a particular register that enables the full-duplex mode. Only the modem manufacturer knows the address of the register and the purpose of the data. The modem manufacturer writes the driver so that it interfaces to Windows as specified by Microsoft, so your (user mode) program can use the modem without accessing the hardware or knowing the hardware details.

    I once wrote a program to make sounds from the internal PC speaker. I had to access particular hardware addresses, and I think I had to do some bit manipulation to set-up registers. This program works on Windows 98, but it generates an "access error" with Win2K and above.



    * It's not nearly as hard if you are working on an embedded system with its dedicated compiler... The Pic Microcontrollers are frequently programmed by hardware hobbyists. In this type of system, there is usually not an operating system getting in the way, and the supplied compiler library will include functions for reading/writing hardware addresses. (You might write the program on a Windows system, but it runs on a non-Windows system.)
    Last edited by DougDbug; 09-25-2007 at 04:49 PM.

  2. #17
    Registered Abuser
    Join Date
    Sep 2007
    Location
    USA/NJ/TRENTON
    Posts
    127
    well thank you all, i think i have a better understanding of bitwise operations and their use.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitwise Operations to Read ON/OFF Bits
    By pseudonoma in forum C Programming
    Replies: 4
    Last Post: 02-25-2008, 03:15 PM
  2. bitwise operations with double
    By henry_kay in forum C Programming
    Replies: 2
    Last Post: 10-03-2007, 04:57 AM
  3. bitwise operations
    By black_watch in forum C++ Programming
    Replies: 9
    Last Post: 03-24-2007, 04:48 AM
  4. bitwise operations
    By andrew_tucker in forum C Programming
    Replies: 2
    Last Post: 11-28-2002, 12:46 AM
  5. bitwise operations
    By bukko in forum C Programming
    Replies: 3
    Last Post: 10-06-2001, 06:56 AM