7 Replies - 18564 Views - Last Post: 08 January 2011 - 01:53 AM Rate Topic: -----

#1 ads.pande@gmail.com  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 20-January 10

accessing USB using C

Posted 20 January 2010 - 11:59 PM

i am using a USB to parallel port converter in my laptop and for data transfer through that i need to access USB port....
kindly help me out with this
Is This A Good Question/Topic? 0
  • +

Replies To: accessing USB using C

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5388
  • View blog
  • Posts: 27,384
  • Joined: 10-May 07

Re: accessing USB using C

Posted 21 January 2010 - 12:01 AM

Can you define "access"?

are you trying to open files, detect a drive letter, format the device... what are you trying to achieve?
Was This Post Helpful? 0
  • +
  • -

#3 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 291
  • View blog
  • Posts: 1,900
  • Joined: 25-October 06

Re: accessing USB using C

Posted 21 January 2010 - 06:46 AM

View Postads.pande@gmail.com, on 21 Jan, 2010 - 05:59 AM, said:

i am using a USB to parallel port converter in my laptop and for data transfer through that i need to access USB port....
kindly help me out with this

I would assume that the driver that comes with the USB to parallel port device would create a virtual parallel port lpt2: or lpt3: etc that you can access via normal Windows IO calls.
This is what happens with USB to serial port devices.
Was This Post Helpful? 0
  • +
  • -

#4 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: accessing USB using C

Posted 21 January 2010 - 07:49 AM

I don't really know much about USB but I believe that we recently added a tutorial: Introduction to using LibUSB-1.0

The tutorial is in C++ but the library is for C so as long as you can think in terms of printf/scanf rather than cout/cin the tutorial should work for a C programmer.

I am not 100% sure it will help you, but it will at least teach you a little about using the LibUSB library.
Was This Post Helpful? 0
  • +
  • -

#5 Splatocaster  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 51
  • View blog
  • Posts: 182
  • Joined: 22-December 09

Re: accessing USB using C

Posted 21 January 2010 - 07:58 AM

First of all, USB to Parallel Port converters will not work for using the I/O pins. If this is a electronics project, you have to use a direct parallel port. USB to Parallel Port converts work only with printers, they won't work with scanners/fax built into parallel port printers.

That being said, you can only use parallel ports with printers. Any parallel-controlled printer should come with a driver, you do not have to write your own.

If you want to control an electronics project, either use a direct parallel port or a USB Interface Board.
Was This Post Helpful? 0
  • +
  • -

#6 Anarion  Icon User is offline

  • The Persian Coder
  • member icon

Reputation: 308
  • View blog
  • Posts: 1,508
  • Joined: 16-May 09

Re: accessing USB using C

Posted 21 January 2010 - 09:27 AM

View PostNickDMax, on 21 Jan, 2010 - 05:19 PM, said:

I don't really know much about USB but I believe that we recently added a tutorial: Introduction to using LibUSB-1.0

The tutorial is in C++ but the library is for C so as long as you can think in terms of printf/scanf rather than cout/cin the tutorial should work for a C programmer.

I am not 100% sure it will help you, but it will at least teach you a little about using the LibUSB library.

Yes, the API which LibUSB provides is for C, but in that tutorial I used C++ functions for output, refer to the documentation for how to use printf for it.

But as people said, define access... if you mean transferring files to a usb flash memory for example, then you have much struggle with APIs like LibUSB at first because you have to work with the filesystem and all those stuff... but using an OS API (if possible) is much much much easier.

Edit: Look at here

This post has been edited by Anarion: 21 January 2010 - 09:31 AM

Was This Post Helpful? 0
  • +
  • -

#7 Guest_Vairamuthu*


Reputation:

Re: accessing USB using C

Posted 08 January 2011 - 12:17 AM

I have to plan construct on USB Data Logger.
My Project
Program written : C-Language
AT89S51 Microcontroller can be I will Used on My Ciruit.
So please give Tutorial for sending and receiving 8bit data's between USB and Data Logger(OS-Windows7).
Was This Post Helpful? 0

#8 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 291
  • View blog
  • Posts: 1,900
  • Joined: 25-October 06

Re: accessing USB using C

Posted 08 January 2011 - 01:53 AM

View PostVairamuthu, on 08 January 2011 - 06:17 AM, said:

I have to plan construct on USB Data Logger.
My Project
Program written : C-Language
AT89S51 Microcontroller can be I will Used on My Ciruit.
So please give Tutorial for sending and receiving 8bit data's between USB and Data Logger(OS-Windows7).

Looking at the AT89S51 datasheet it does not appear to have a USB interface. In such as case it would be simpler to use a RS232 serial connection for the data logger so long as the data acquisition rate was not too fast.
Otherwise it could be worth looking at somethink like the AT32UC3A0128 32 bit processor which has USB OTG capability.

Have a look at this virtual USB port for Atmel microcontrollers
http://www.obdev.at/...vusb/index.html

I tend to use Microchip PIC24 and PIC32 microcontrollers for USB data loggers, see
http://www.microchip...AGE&nodeId=1486
as they have a number of devices with a USB interface on the chip and prodide a C library to control it and examples of host programs for Windows.

This post has been edited by horace: 08 January 2011 - 02:23 AM

Was This Post Helpful? 1
  • +
  • -

Page 1 of 1