Newb with probably common USB question

I suspect someone can show me a thread here because I can not find one.

I want to build from the ground up, so to speak, a graphical interface probably coded in C# for windows. I need to build a driver for windows to address and download and retrieve data. I am not particular which adrino to try, I have a Duemilanove, my own design protos based on a ATmega328P, an STK500 dev board and other SW / HW dev tools. I am well versed on the micro side and have the SW tools and industry contacts to build all the HW and SW for that side but I am totally ignorant about the PC side. I know how to write VB and C# code to manage the data and to create a real time display. My Hang up is specifically how to build my own driver (preferably something I can have linked in the registry so it knows when you plug in) so I can send and receive info packets over a standard USB line.

In not so many words someone else has had to have asked about this before...?

Thanks
0xA5A5

Did you check - http://www.arduino.cc/playground/Main/InterfacingWithSoftware - ?

the simplest way of working is to have the Arduino to sample the sensors continuously and sent the data asap to a PC for further processing. The PC can hold many more data than the Arduino can.

Are you aware that the USB port on the Arduino is in fact not USB but a (virtual) serial port ?

When plugged in to the USB port of a PC the Arduino will present it self as a serial (COM) port.

It's very easy to communicate from C# / VB .net with Arduino, but over serial, not USB

Thanks for the feedback and I am aware of both of these issues.

My concern is that I want to build my own interface. I can write my own Atmel firmware in better environments than the Arduino environment. I can do the entire embedded side more easily using my libraries. I understand and I have data sheets on USB to serial converter chips like the one referenced here. I don't really need help on the embedded side.

On the PC however I want to write my own interface, Send commands and Read data. I don't want to use the Arduino interface. I don't want to steal anything. I want to write a Visual C# or VB program that sends and revives data and if, for prototyping purposes, I can write it to use the Arduino Hardware then I can get a prototype with basic functionality sooner than later.

I will eventually need to tweak the design to use the best chip and supporting HW but for prototyping I think I can make a very sensible interface. I basically have to build a black box between a PC and an existing piece of machinery.

Until Now I just Program things over the ISP using Atmels free programming environment. Now I have need to actively monitor and change operating parameters from a PC. I have to be idiot friendly so I have to have a standard USB port. The embedded side I have no problems doing. I just need to now (and it probably is not much code) how to actively access the correct memory locations for sending to and receiving data to and from my system.

Again My system is similar enough to Arduino that for show and tell purposes I can get something basic running faster using this Arduino that was given to me to try then if I modify one of my protos here from a totally different design.

thanks again...And I haven't checked those links yet. I have been too busy but I will later I just wanted to clarify.

The below site and associated book can provide a lot of USB info.

http://www.lvr.com/usb.htm

Okay so I got a basic coms program running on something I know works. I have an old machine I can control on the old school serial port. I connected it with a USB to serial converter cable. I got a C# program that sends commands and my machine ran like it was supposed to. I still don't have the receive working but I am close.

So next I want to load some code onto my Arduino that will do something (say flash an LED) when it decodes certain commands. Basically load this code, turn of the Arduino interface on the PC, turn on my interface SW, send a specific command, and watch the LED flash or something so I know it is receiving the correct command. Anyone no a link to that kind of code?

Thanks!

I am well versed on the micro side and have the SW tools and industry contacts to build all the HW and SW for that side but I am totally ignorant about the PC side. I know how to write VB and C# code to manage the data and to create a real time display.

Honestly, I'm confused. You are saying that you know all this stuff but you don't know how to write a a two-way RS232 command interpreter? Basically, that's all you are missing. You send a ASCII command to the Arduino (It receives and interprets) and then sends stuff back... and VB or C# will need to LISTEN to the Arduino ASCII data and act on it. You have complete freedom to develop the handshaking and data tokening if that's what you need. There are lots of examples of how to send commands in ASCII back and forth.

See, to me... I think you are making this harder than it really is.

Does pointing you to projects like this help? http://www.opencircuits.com/Arduino_Laser_Cannon

Some code posted by others where you can send a number 1-8 to the arduino using the serial monitor and the led will blink that number of times.

int ledPin = 13;   // select the pin for the LED
int val = 0;       // variable to store the data from the serial port

void setup() {
  pinMode(ledPin,OUTPUT);    // declare the LED's pin as output
  Serial.begin(9600);  // connect to the serial port
  Serial.println("Blink number 1-9"); // so I can keep track
}

void loop () {
  val = Serial.read();      // read the serial port

  // if the stored value is a single-digit number, blink the LED that number
  if (val > '0' && val <= '9' ) {
    val = val - '0';          // convert from character to number
    for(int i=0; i<val; i++) {
      Serial.print("blink! ");
      Serial.println(i);
      digitalWrite(ledPin,HIGH);
      delay(150);
      digitalWrite(ledPin, LOW);
      delay(150);
    }
    //Serial.println();
  }
}

exactly...I said it was simple what I am asking for. That is why I said thanks I got it working from the previous post. And I really don't know what you mean by making it hard...I haven't done anything hard yet? Also that link didn't really help. I am sure if I dug deep enough in the links to other things I could find something that I don't already know. There was no obvious down loadable source code to learn from. It appears to use an arduino specific command interpreter interface which is exactly what I am trying to avoid. I don't need the arduino I just want to use it as a prototyping platform for getting this done faster. I may end up just buying their HW in the short term if need be but for now I am just using it to proto.

I am not a windows programmer. I don't know much about it, but I know it is about the simplest thing to program for. I have seen the stupidest people create great things in visual languages. I have not used a visual language much and only for myself on simple things. There wasn't even an option in college to take them yet so I am learning it on my own. I have written machine code for proprietary semiconductor test equipment for most of my professional programming, well that and tons of embedded (Philips, Intel, Mot, Atmel, PIC), but no windows apps. This is the first time I have needed to write a GUI and to boot it has to communicate off the PC. And like I said I got that part to work on an older design of mine based on a previous post and link. I may just use that for the proto.

Normally people who Come to Arduino are here for the exact opposite. They want an easy to use way of making HW work. I don't need that, I make all kinds of toys. Now for the first time I need an open loop feedback control and a response monitor that runs of a PC,... not self controlled or running off another embedded system via radio link like I have done in the past. I want to build it myself but I also need to have a proto NOW before I can cut a HW design. My HW designs in the past are close enough to Arduino that I can use it for proto and not lose to much time.

I am not trying to say I am some know it all. All I am saying is I am an embedded systems guy not a PC or MAC programmer. I can program the Atmel to do way more than they allow with Arduino interface. I don't need help on that side. I was hoping that by luck someone in this community would have by now written their own interface that they would be willing to share so we could all learn. And it appears from the first responses that yes indeed there are some.

Incidentally I will share my sharable stuff once I have it.

Incidentally I will share my sharable stuff once I have it.

Well, let the meds kick in first.

Thanks for the code snippet ZK. To be clear. That is some Arduino code I can load using their interface, then close that down and use the C# interface I wrote yesterday and send numerical values to cause the LED to blink....correct? To be clear again I don't want to use their interface.

So I have this old H bridge and power supply black box I built for a test stand once. I think I can use this for my proto and get something to them this week. If that code works like I think all I need to do is create a simple routine to increment or decrement a PWM based on 2 of those inputs and I should have the first half done...Then comes the "difficult" part. They want the feedback to generate a cool graphic that real time updates the monitor so you can watch the machine as it progresses through the program. I have nothing for that but I think I should go to a different forum for these questions.

Thanks for you help!!!!

And I may sound Manic but A) I type fast and B) the entire division I worked at got shut down last year (well our jobs were relocated). I have been getting by off working private consulting since. I need this new customer. It is a complex dual layer relationship where I need to keep the middle man happy. I need to get them a proto now.

When I am done I can rip out the proprietary stuff and have an awesome dev tool / enviro...One I have been wanting to build for years. One where I can proto a black box in 2-3 days (parts being the limiting issue). One that I can share with my lack of legal restrictions because I am writing it. Then I can do better than just scrape by.

For example I read through 4 posted source codes yesterday. Not one was professionally written but each had some interesting takes on how to manage the resources. I wrote my own and it is also ugly but is working. That's all I need for now.