Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. writing usb driver in visual C#.Net.?

writing usb driver in visual C#.Net.?

Scheduled Pinned Locked Moved C#
csharpquestiondelphivisual-studiohardware
14 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mir_As

    How can i write usb driver software for microcontrollers? i have a poject with microcontroller. When my project connects with usb cable to PC so i want my software connects with microcontroller.i want to send data and get data from microcontroller. i wish i could explain my aim. for example when i click a button in PC side(in visual studio or delphi etc.) so microcontroller and pc can send-get datas with usb cable.

    D Offline
    D Offline
    Dave Kreskowiak
    wrote on last edited by
    #2

    Mir_As wrote:

    How can i write usb driver software for microcontrollers?

    Using C#?? You can't. The microcontroller cannot run the .NET Framework, so any C# code you write will also not run. You can write an app to talk to something on the microcontroller, but whatever you write for the micro will most likely have to be written in C, not C#. How you do the communication depends entirely on the micro and how you expose the data to the outside world. It's entirely up to you.

    A guide to posting questions on CodeProject[^]
    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
         2006, 2007, 2008
    But no longer in 2009...

    M 1 Reply Last reply
    0
    • D Dave Kreskowiak

      Mir_As wrote:

      How can i write usb driver software for microcontrollers?

      Using C#?? You can't. The microcontroller cannot run the .NET Framework, so any C# code you write will also not run. You can write an app to talk to something on the microcontroller, but whatever you write for the micro will most likely have to be written in C, not C#. How you do the communication depends entirely on the micro and how you expose the data to the outside world. It's entirely up to you.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008
      But no longer in 2009...

      M Offline
      M Offline
      Mir_As
      wrote on last edited by
      #3

      i want to write driver for my microcontroller. when i connect to microcontroller project to Pc so i want they connect eachother.and send and get datas. i think it can be.but how? serialports connect to microcontroller i think USB can connect to microcontrollers too.

      L D 2 Replies Last reply
      0
      • M Mir_As

        i want to write driver for my microcontroller. when i connect to microcontroller project to Pc so i want they connect eachother.and send and get datas. i think it can be.but how? serialports connect to microcontroller i think USB can connect to microcontrollers too.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        Mir_As wrote:

        i want to write driver for my microcontroller

        You where just explained that a task like that is geared for C, not .Net.

        Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

        1 Reply Last reply
        0
        • M Mir_As

          i want to write driver for my microcontroller. when i connect to microcontroller project to Pc so i want they connect eachother.and send and get datas. i think it can be.but how? serialports connect to microcontroller i think USB can connect to microcontrollers too.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #5

          What part of "you can NOT run a C# app on a microcontroller" is so difficult to understand?

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          X 1 Reply Last reply
          0
          • M Mir_As

            How can i write usb driver software for microcontrollers? i have a poject with microcontroller. When my project connects with usb cable to PC so i want my software connects with microcontroller.i want to send data and get data from microcontroller. i wish i could explain my aim. for example when i click a button in PC side(in visual studio or delphi etc.) so microcontroller and pc can send-get datas with usb cable.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #6

            The short answer is: NO 1. PC side if your microcontroller is to show up as a special peripheral to your PC, with an entry in the Hardware list, with multi-user capabilities, etc, then you need a device driver; such drivers can not be written in any of the .NET languages, the CLR isn't capable of doing system work. if your microcontroller: 1) would be connected through a serial port (possibly using a USB-to-RS232C cable plugged into one of your PC's USB ports), 2) would not be a multi-user device 3) would not need permanent software support then you could develop an app in any language you choose, including C#. It then couldt use the SerialPort class and go without a special driver. 2. Target side microcontrollers in general don't support .NET, and most people still believe you need .NET to run a C#-based app, so no there will not be any C# code running on the microcontroller. (One could create a cross-compiler for C# and compile it to either native or intermediate language, and come up with a small virtual machine to execute it; there is a sufficient number of small Java examples around to proof it is possible; I have not seen anyone do it for C# though). :)

            Luc Pattyn


            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


            Local announcement (Antwerp region): Lange Wapper? Neen!


            L D 2 Replies Last reply
            0
            • D Dave Kreskowiak

              What part of "you can NOT run a C# app on a microcontroller" is so difficult to understand?

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008
              But no longer in 2009...

              X Offline
              X Offline
              Xmen Real
              wrote on last edited by
              #7

              okay thats right, but what if we merge the .Net Framework with the application ?

              TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

              ----------------------------------------------- 128 bit encrypted signature, crack if you can

              D L 2 Replies Last reply
              0
              • X Xmen Real

                okay thats right, but what if we merge the .Net Framework with the application ?

                TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

                ----------------------------------------------- 128 bit encrypted signature, crack if you can

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #8

                First, you'll have to find a compiler that will generate native code with the app and framework all rolled into one. There are some out there, but they cost a small fortune to buy. Next, that compiler will have to generate native code for the CPU in the microcontroller. That probably doesn't exist. Those compilers will generate code libraries that are significantly larger than the app itself. You'll have to make sure the MC has the storage capacity to hold such a large executable. Lastly, the .NET CLR depends on Windows, which the MC will not run.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                1 Reply Last reply
                0
                • X Xmen Real

                  okay thats right, but what if we merge the .Net Framework with the application ?

                  TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

                  ----------------------------------------------- 128 bit encrypted signature, crack if you can

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  Xmen W.K. wrote:

                  okay thats right, but what if we merge the .Net Framework with the application ?

                  Good luck!

                  X 1 Reply Last reply
                  0
                  • L Lost User

                    Xmen W.K. wrote:

                    okay thats right, but what if we merge the .Net Framework with the application ?

                    Good luck!

                    X Offline
                    X Offline
                    Xmen Real
                    wrote on last edited by
                    #10

                    Like I'm gonna test ? It was just an idea. Thats it...

                    TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

                    ----------------------------------------------- 128 bit encrypted signature, crack if you can

                    1 Reply Last reply
                    0
                    • L Luc Pattyn

                      The short answer is: NO 1. PC side if your microcontroller is to show up as a special peripheral to your PC, with an entry in the Hardware list, with multi-user capabilities, etc, then you need a device driver; such drivers can not be written in any of the .NET languages, the CLR isn't capable of doing system work. if your microcontroller: 1) would be connected through a serial port (possibly using a USB-to-RS232C cable plugged into one of your PC's USB ports), 2) would not be a multi-user device 3) would not need permanent software support then you could develop an app in any language you choose, including C#. It then couldt use the SerialPort class and go without a special driver. 2. Target side microcontrollers in general don't support .NET, and most people still believe you need .NET to run a C#-based app, so no there will not be any C# code running on the microcontroller. (One could create a cross-compiler for C# and compile it to either native or intermediate language, and come up with a small virtual machine to execute it; there is a sufficient number of small Java examples around to proof it is possible; I have not seen anyone do it for C# though). :)

                      Luc Pattyn


                      Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


                      Local announcement (Antwerp region): Lange Wapper? Neen!


                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #11

                      Luc Pattyn wrote:

                      and most people still believe you need .NET to run a C#-based app

                      :wtf: You just blew my mind.

                      Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]

                      1 Reply Last reply
                      0
                      • M Mir_As

                        How can i write usb driver software for microcontrollers? i have a poject with microcontroller. When my project connects with usb cable to PC so i want my software connects with microcontroller.i want to send data and get data from microcontroller. i wish i could explain my aim. for example when i click a button in PC side(in visual studio or delphi etc.) so microcontroller and pc can send-get datas with usb cable.

                        D Offline
                        D Offline
                        DaveyM69
                        wrote on last edited by
                        #12

                        You probably won't need to write your own driver (if you do you will need to delve into the dark world of C/C++). Find the most suitable USB class[^] for your device, implement that in you µC's code and you can use the Windows USB driver for that class. Many µC manufacturer's already have code available for most common scenarios (so you may not even need to code the USB implementation at the µC side) and some even have their own drivers already written for you for when the generic Windows drivers won't do. I experimented briefly with this with a PIC and the USB MIDI spec with sucess after a lot of trial and error - google will be your friend when you know exactly what to search for.

                        Dave
                        Generic BackgroundWorker - My latest article!
                        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                        Why are you using VB6? Do you hate yourself? (Christian Graus)

                        1 Reply Last reply
                        0
                        • L Luc Pattyn

                          The short answer is: NO 1. PC side if your microcontroller is to show up as a special peripheral to your PC, with an entry in the Hardware list, with multi-user capabilities, etc, then you need a device driver; such drivers can not be written in any of the .NET languages, the CLR isn't capable of doing system work. if your microcontroller: 1) would be connected through a serial port (possibly using a USB-to-RS232C cable plugged into one of your PC's USB ports), 2) would not be a multi-user device 3) would not need permanent software support then you could develop an app in any language you choose, including C#. It then couldt use the SerialPort class and go without a special driver. 2. Target side microcontrollers in general don't support .NET, and most people still believe you need .NET to run a C#-based app, so no there will not be any C# code running on the microcontroller. (One could create a cross-compiler for C# and compile it to either native or intermediate language, and come up with a small virtual machine to execute it; there is a sufficient number of small Java examples around to proof it is possible; I have not seen anyone do it for C# though). :)

                          Luc Pattyn


                          Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


                          Local announcement (Antwerp region): Lange Wapper? Neen!


                          D Offline
                          D Offline
                          DaveyM69
                          wrote on last edited by
                          #13

                          Luc Pattyn wrote:

                          I have not seen anyone do it for C# though

                          A new article perhaps? ;) If you do, let me know - it would be VERY interesting!

                          Dave
                          Generic BackgroundWorker - My latest article!
                          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                          Why are you using VB6? Do you hate yourself? (Christian Graus)

                          L 1 Reply Last reply
                          0
                          • D DaveyM69

                            Luc Pattyn wrote:

                            I have not seen anyone do it for C# though

                            A new article perhaps? ;) If you do, let me know - it would be VERY interesting!

                            Dave
                            Generic BackgroundWorker - My latest article!
                            BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
                            Why are you using VB6? Do you hate yourself? (Christian Graus)

                            L Offline
                            L Offline
                            Luc Pattyn
                            wrote on last edited by
                            #14

                            No, I have no such intentions; I am happy with C# (or Java) on a PC, and C and Java everywhere else. :)

                            Luc Pattyn


                            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.


                            Local announcement (Antwerp region): Lange Wapper? Neen!


                            1 Reply Last reply
                            0
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Don't have an account? Register

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups