Programming for Comm port or USB  
Author Message
Kevin Tough





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

With an old electronics learning lab I am starting to learn a little about comm ports. In the kit they use VB 3 to control the comm port. With their program they can set Rxd, Txd, etc. individually. Anyone know if this remains possible with VB.Net and where I can find out more info on this. Also since comm ports are going the way of the Albatross suggested readings on programming USB would be greatly appreciated.

I had thought there was a Class or something like MSComm16 or MSComm32 but my searches on MSDN found no hits.

Kevin Tough



Visual Basic12  
 
 
nobugz





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

Use the System.IO.Ports.SerialPort class, available in .NET 2.0. Interfacing with a USB device is a whole different ballgame...




 
 
Slyke





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

Comm is simple (you just gotta know a bit about electronics)

There are 4 wires, 2 of the wires are earth wires.

One of the other one recieves signals.

And the last one transmits them.

Hook a ground wire & the transmitter wire up to a small PC speaker you may have laying around and send somthing like "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" into the Comm port and listen to the funny sounds that it makes through the speaker (Different letters give different sounds), the longer the length you send, the longer the sound will last for..

That's binary that you can hear except extremly fast. I'm not going into why different sounds happen for different letters, but it's got to do with how many "ones" you hear in a second and sound frequencies.

As for USB... i don't know much... it's all digital, commpressed (as far as i know) and alot more complecated.

 
 
Kevin Tough





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

Hello Slyke,

I think I will be able to use the above mentioned class to open and test what I can do with the comm port but I am a little confused with your reply. "There are 4 wires" I believe the USB has 4 wires "Vcc, D-, D+, and ground" but I thought you were speaking of the RS232 which has normally a Sub-D 9 pin connector. With 9 pins and the outside shell we then have 10 wires. Of the ten wires I think pin 5 or so is ground and also the outside shell. That leaves me 8 wires to choose from to hook up a speaker. I believe the signals are all short protected and relatively robust but!!

If you would clarify which wires to connect to that would be an interesting experiment.

Best regards,

Kevin Tough


 
 
Slyke





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

I've never touched USB, but looking into one of my ports, i can see 4 wires.

Yes it's the RS232. It has 9 holes, but i've only ever had 4 wires working from it, never the other 5. The all Ataries and Segas use them too and one day i was trying to use my computer to play it (this was a few years back) and i relised that it didn't work properly. I narrowed it down to only 4 wires actually doing something. Then i started expirementing with speakers and LEDs and stuff to see how it worked.

If you know how to get the rest working please tell me! lol.

 
 
nobugz





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

Serial ports use 3 "important" wires. Pin 2 and 3 for transmit and receive data and pin 5 for ground. The rest are handshake and modem signals. To connect two computers, wire pin 2 to 3, 3 to 2 and 5 to 5 (null modem). Full details here...



 
 
sagarmalik





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

can you suggest some good book on serial port programming

 
 
SJWhiteley





PostPosted: Visual Basic Language, Programming for Comm port or USB Top

Richard Grier is the Serial Port expert:

http://www.amazon.com/gp/product/1890422282/ref=pd_sim_b_2/102-0132802-6022575 %5Fencoding=UTF8&v=glance&n=283155

He has his own web site:

http://www.hardandsoftware.com/

I've posted these links so he doesn't have to advertise himself :)