PDA

View Full Version : [Question(s)] Connecting to PC



Remus
02-28-2009, 12:03 AM
Does anyone have experience using a PC to talk to a one-wire UART on a microcontroller? We are trying to use LabView, but may be able to use C or C++ if possible. We’re also playing around with trying to create a circuit that will turn the two-wire serial communication to a one wire UART. Any ideas? We're trying to get our robot's motor controllers working with the computer. Thanks!:rolleyes:

MikeG
02-28-2009, 02:37 AM
This circuit will connect a serial port to a single wire TTL device.

http://www.crustcrawler.com/images/schematics/SerialToTTL.gif


Serial port pins
Rx: 2
Tx: 3
Gd: 5

No0bert
02-28-2009, 05:03 PM
You need a bootloader, compiler, and MCU with rx tx pins first

lnxfergy
02-28-2009, 08:12 PM
Does anyone have experience using a PC to talk to a one-wire UART on a microcontroller? We are trying to use LabView, but may be able to use C or C++ if possible. We’re also playing around with trying to create a circuit that will turn the two-wire serial communication to a one wire UART. Any ideas? We're trying to get our robot's motor controllers working with the computer. Thanks!:rolleyes:

It might help if you tell us which motor controller.

As for duplex->half-duplex, the important part of your code will be to make sure you give sufficient time to read back data before you start writing the port.

-Fergs

lnxfergy
02-28-2009, 08:13 PM
You need a bootloader, compiler, and MCU with rx tx pins first

What? He says he has a motor controller already, and just needs to get half-duplex serial out of a PC, how would that require a bootloader, compliler, and MCU?

-Fergs

Adrenalynn
02-28-2009, 08:23 PM
The schematic posted will take serial, just plain ol', so I concur with Fergs - you don't have substantial requirements. Just a language you can bash bits with. Anything reasonably competant.

Oh - +Rep to MikeG for the schematic!

Remus
03-03-2009, 10:15 AM
This circuit will connect a serial port to a single wire TTL device.

http://www.crustcrawler.com/images/schematics/SerialToTTL.gif


Serial port pins
Rx: 2
Tx: 3
Gd: 5
I tried using this circuit with the Parallax 27971 position controller with limited success. When transmitting from the computer to the device, the circuit works just fine. However, the receive side is not working. I'm using a MAX232 level shifter on the receive side of this circuit to change what should be logic level to RS-232 voltages. Furthermore, in the circuit's current configuration, the reply bytes from the position controller are not at 0-5 Volts, but rather at 3-5 Volts. I determined that the 10k pull-up resistor is unnecssary with my hardware as the device is pulling the one-wire line high anyway. By changing the 1K resistor on the gate of the 2N3906 to a larger value, I can make the receive bytes almost span from 0-5V. However, when I oscilloscope probe the circuit on its output back to the computer, I get no data at all. Any suggestions on what is going on and/or how to fix it?

I also tried using a MOSFET circuit with identical results.

Thanks

MikeG
03-04-2009, 06:36 AM
I double checked the circuit. It looks right... no MAX232.

avayan
06-19-2009, 01:20 AM
Darn! A few years ago I did a pretty big application I called Super Stepper that basically allowed the communications from the PC and to up to 32 microcontroller devices doing stuff such as stepper, DC, Servo motor control, inductive load outputs, digital input and output, etc. It has been quite a while, but all of this material is open source so you are free to use it as you need. You can find some of the information on the www.superstepper.com (http://www.superstepper.com) website, but the code and related material would be on www.avayanelectronics.com (http://www.avayanelectronics.com).

This is not for a single wire com link, though. But I am thinking it can easily be changed to that as the communications were pretty much half duplex anyway. It would require changing the hardware a little bit, as suggested above.

BTW, all the Super Stepper code was done in assembly and for the AVR microcontrollers.

ScuD
06-19-2009, 02:08 AM
I tried using this circuit with the Parallax 27971 position controller with limited success. When transmitting from the computer to the device, the circuit works just fine. However, the receive side is not working. I'm using a MAX232 level shifter on the receive side of this circuit to change what should be logic level to RS-232 voltages. Furthermore, in the circuit's current configuration, the reply bytes from the position controller are not at 0-5 Volts, but rather at 3-5 Volts. I determined that the 10k pull-up resistor is unnecssary with my hardware as the device is pulling the one-wire line high anyway. By changing the 1K resistor on the gate of the 2N3906 to a larger value, I can make the receive bytes almost span from 0-5V. However, when I oscilloscope probe the circuit on its output back to the computer, I get no data at all. Any suggestions on what is going on and/or how to fix it?

I also tried using a MOSFET circuit with identical results.

Thanks

Very untimely reply.. but you may want to try using a pull-down resistor of say 10k from the RX line to ground.
As it is now, a low RX signal - ie. not driving the PNP resistor- would yield a voltage of ~Vbe + Vce, since the only reference to ground is through the NPN resistor, which should be off during RX read.


I'm only theorizing though, if I find a little time at work I'll try it and get back..

MikeG
06-19-2009, 10:00 AM
I must apologize for my original schematic. I guess I should have removed or labeled the 5V wire from the 3906. Shouldn't make a difference though.

Schematic updated 06/19/2009

MikeG
06-19-2009, 10:07 AM
@ScuD: Let me know what you find. I've been using this circuit since college... which was a long time ago.

ScuD
06-19-2009, 12:12 PM
Didn't get a chance to test the circuit at work, bit swamped I'm afraid.
I only have SMT devices at home but I'll try to figure it out and get back to you with some test results.