need suggestion

This is a discussion on need suggestion within the C Programming forums, part of the General Programming Boards category; hi friends, there is project in front during this semester. as you know there are number of hardware components inside ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    37

    need suggestion

    hi friends,

    there is project in front during this semester. as you know there are number of hardware components inside computer system. is there any project that you can suggest, which do something like controlling the hardware devices or anything that is related to these hardware components.
    Hope you are getting my points, actually i wanna make a tight grip on all hardware components as how they works, how can we lock then to stop working or anything else.
    I can not decide what type of project there may be, that make use of C as programming language.

    waiting for your reply

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That's not as easy to answer as it is to ask. First of all, to control devices in the machin, you need to have access to those devices. Modern OS's such as Linux and Windows only allow (generally speaking) access directly to the hardware via drivers. Writing drivers is not particularly easy, particularly not in OS's such as Linux or Windows. If you haven't done a fair bit of low-level programming and understand how the OS itself works, then you are in for a tough task.

    If you have a small machine which you can run DOS or some embeded (real-time?) OS on, then you have a better chance, since these OS's may not need/use the same strict "must be a driver" philosophy, so you can just write a few bits of code that talk directly to some device.

    The next problem is to understand what hardware you can control, and how to control it. Again, many devices nowadays use for example USB, which makes the device quite difficult to communicate with, since the USB protocol in itself "gets in the way" (so to talk to the device itself, you first need to learn how to talk across the USB link).

    If you describe what hardware and OS you plan on using, maybe one of us can give you some more detailed suggestion.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    well, I am using windows XP
    intel desktop board, pentium P4 3.06 GHz


    well, to program drivers what language i should go for. are you talking about assembly language?
    whatever I will have to do is not a matter of concern. I am ready to do anything cause I have to make a major project. so please suggest me some project that implement on these devices.

    how can i access hardware devices anyway?

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Drivers for Windows are written in C.

    Accessing devices varies from device to device. Of course, most (if not all) devices are normally using a standard windows driver, so you either need to REPLACE the standard driver, or find a device that doesn't currently have a driver on the system.

    Devices that are relatively easy to access would be the serial port and the parallel port. But those have base-drivers that are supplied by windows, so you'd have to remove those first before you can use your device. Writing such a driver would be a matter of a few days (full time) for me, but if you have never touched a Windows driver before, then you are probably looking at more of several weeks until you have something that works.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    Quote Originally Posted by matsp View Post
    Drivers for Windows are written in C.

    Devices that are relatively easy to access would be the serial port and the parallel port. But those have base-drivers that are supplied by windows, so you'd have to remove those first before you can use your device. Writing such a driver would be a matter of a few days (full time) for me, but if you have never touched a Windows driver before, then you are probably looking at more of several weeks until you have something that works.
    --
    Mats
    i think you must be right man to take advice from. ok ......i dont care if it gonna take many weeks. I just want anything that come as a project, please think about this.

    after deciding a project for me......also let me know what prepreparation should i do to complete that

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I still need more information about your knowledge level...

    What is the most complex program that you have written so far?

    What was the hardest part of it?

    How large was it?

    In the meantime, have a look at the MSDN DDK (now apparently called WDK - it's been a couple of years since I worked with Windows drivers).

    You start here:
    http://www.microsoft.com/whdc/devtools/wdk/WDKpkg.mspx

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    well, few months ago I made file splitter, file merger(was working for all files except .flv type), electronic calender using pointers, In fact when I started learning C few yrs before I had made many low level programs , but as so on i started making few high level programs.

    I can use pointers well cause I have good understanding of pointers. and in C i think i have a tight grip.

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ok, so how do you make a pointer to an int, that points to address 0x12345600?

    If you want to set bit 3 in a hardware registers that is pointed to by a char *pHwReg, how would you do that?

    Do you have any understanding of the Win32 API?

    Have you ever used Mutexes or Semaphores in Windows?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    Quote Originally Posted by matsp View Post
    Ok, so how do you make a pointer to an int, that points to address 0x12345600?
    Code:
       long  int intvar=12345600; 
        long int ptr = (long int*)&intvar;
    If you want to set bit 3 in a hardware registers that is pointed to by a char *pHwReg, how would you do that?
    Code:
         short int bitfield : 3;
     int*  pHwReg= new char[bitfield];
    Do you have any understanding of the Win32 API?

    Have you ever used Mutexes or Semaphores in Windows?

    --
    Mats
    sorry.....but i didn't do any of these two

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by san_crazy View Post
    Code:
       long  int intvar=12345600; 
        long int ptr = (long int*)&intvar;
    Almost right - but you are pointing at intvar, not 12345600 (and I said 0x12345600 - which isn't quite the same address).

    Code:
         short int bitfield : 3;
     int*  pHwReg= new char[bitfield];
    Not even close.
    Code:
     *pHwReg |= 1 << 3;
    would be what I was looking for.

    You would really need to understand the Win32 API, and things like Mutex, Semaphore, WaitForSingleObject, WaitForMultipleObject are crucial for drivers.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #11
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    sorry, but it should rather be

    Code:
        long  int intvar=12345600; 
        long int ptr = (long int*)intvar;
    now it will point at that address...
    i think, i am making you tired, but i still haven't got what i am expecting from you.

    please SUGGEST ME ANY PROJECT on this. I have to give the project title by today compulsorily.

  12. #12
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Nope, this still isn't right. You're writing decimal, mats was implying hexdecimal, it was supposed to be int, not long int and finally, it's supposed to be a pointer (You're even casting to a pointer type while you assign to a non-pointer type! That should at the very least be illegal, and the very least prompt a nasty warning in C!).

    int* ptr = (long int*)0x12345600;

    You seem to try hard, but you really lack that little extra bit to reach the ledge.
    But good luck anyway
    Writing drivers in C is not for the faint hearted!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    Quote Originally Posted by Elysia View Post
    Nope, this still isn't right. You're writing decimal, mats was implying hexdecimal, it was supposed to be int, not long int and finally, it's supposed to be a pointer (You're even casting to a pointer type while you assign to a non-pointer type! That should at the very least be illegal, and the very least prompt a nasty warning in C!).
    you should have guessed that if i have the understanding on how can a integer value be made to be and address and further that address assigned to a pointer of that type, then I must also know that the assignment should be between similar types.
    you could have thought that there might have been a unnoticed mistake of not applying * at that place.

    int* ptr = (long int*)0x12345600;

    You seem to try hard, but you really lack that little extra bit to reach the ledge.
    its your misunderstanding dude, cause i didn't try hard for this.
    But good luck anyway
    thanks anyway, but you'd better give some suggestions if you have some

    Writing drivers in C is not for the faint hearted!
    oh!!!....you mean you had learnt all this from your birth

  14. #14
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,548
    Quote Originally Posted by san_crazy View Post
    you should have guessed that if i have the understanding on how can a integer value be made to be and address and further that address assigned to a pointer of that type, then I must also know that the assignment should be between similar types.
    you could have thought that there might have been a unnoticed mistake of not applying * at that place.

    int* ptr = (long int*)0x12345600;
    Then you have understanding but you failed to write the correct code, which in a real-life project might mean disaster.
    As I said, you may have the knowledge, but you are lacking a little bit to reach the ledge!

    its your misunderstanding dude, cause i didn't try hard for this.
    "Try hard" is an expression meaning that you are devoted to a task, not an insult!

    thanks anyway, but you'd better give some suggestions if you have some
    I don't, because I don't write C and I haven't written any drivers.
    That's why suggestions were missing from the reply.

    oh!!!....you mean you had learnt all this from your birth
    Don't be a prick. That will get you nowhere.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Registered User
    Join Date
    Jul 2008
    Posts
    37
    hi matsp
    ok....now i have decided that I'll make device drivers, the topics that you have suggested are adequate to work on?

    I started with Win 32 API. I still need you suggestion on how can i practice on Win32 APIs, are these functions made using some programming language?
    I preferred to MSDN library to take over this, how can I implement these or how can i start making drivers?
    I am ready to do anything, at this point i need your suggestion so that i wouldn't go off the way.

    is there anything else that I should prefer to?
    Last edited by san_crazy; 09-26-2008 at 05:50 AM.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some suggestion to handle serial inputs.
    By g4j31a5 in forum C++ Programming
    Replies: 4
    Last Post: 07-19-2008, 01:51 AM
  2. Suggestion about managing users and password
    By ZaC in forum C Programming
    Replies: 2
    Last Post: 06-23-2008, 05:06 AM
  3. LCD for gaming, any suggestion?
    By alphaoide in forum Tech Board
    Replies: 0
    Last Post: 05-02-2004, 05:09 PM
  4. Replies: 12
    Last Post: 05-14-2003, 01:00 AM
  5. Any suggestion?
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-28-2001, 04:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21