Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Serial to Gameport Conversion

Status
Not open for further replies.

Draqo

New Member
I have only a week to do this, so I'm kinda getting desperate. However, I discussed it with my friend who is also interested in doing this conversion and found a pretty good example on how the app might work.

Plan A: PWM to Analog (Got it working to some degree, thanks guys. :))

Plan B: Serial sending 4 bytes, each byte to be sent to a certain pin based on the order it is recieved. The process being:

The strand of bits are loaded into a bucket 8 bits at a time, the bucket moves along a convayer belt to 4 seperate pipes. When the bucket is filled with 8 bits, it dumps the bits into the pipe and moves to the next pipe. As the bits flow down the pipe, they arive at a station where they are seperated and sent to a resistor tree, where the final analog voltage is sent to the designated pin.
When the final byte is reached, the bucket goes back to the starting position and does it all over again, sending 4 bytes down 4 seperate pipes and 4 seperate analog pins on a common gameport.

a.k.a. Serial to Analog Gameport conversion.

Any ideas? Our last resort is the PWM to Analog converter, using an IFI EduRobot's PWM's to simulate the values, however, if there is some way to directly use the serial port and convert the serial data to multiple analog values it would be much of help.
 
The generation of analogue voltages from a serial port is easy to do using a PIC, the PIC reads the incoming serial data and outputs the values via a digital to analogue converter - which can be simple R2R ladder networks buffered with an opamp.

This gets you a nice easy analogue VOLTAGE output, but joysticks are resistive (not a voltage), and not referenced to ground.

The difficult part is generating the floating variable resistance.

One possibility is using digital potentiometers - these could be fed directly from the PIC, no D2A required.
 
Draqo said:
Any specific PIC that can do this job well?

Depends on how many I/O pins you need?. Which really depends on how you use the output - if using R2R ladder networks to generate an analogue voltage you need one I/O pin for every bit in the network (eight I/O pins for 8 bit). If using digital pots the pin requirement is much less, an 18 pin PIC (like the 16F628) should be fine.
 
Draqo said:
For four seperate analog voltage outputs?

It depends how you generate the analogue voltages, and what resolution you need - for full 8 bit resolution using R2R ladders you would require 32 output lines, plus a serial input line from the PC. The 40 pin 16F877 should cope with that!.
 
Datasheets say that it consists of Analog Inputs, not Analog outputs. And it is a bit value, not a byte value.

I need each of 4 bytes from the serial port to represent a variable voltage ranging from 0 (0 volts) to 255 (+5 volts).

Or is MicroChip documentation leaving something out?
 
Draqo said:
Datasheets say that it consists of Analog Inputs, not Analog outputs. And it is a bit value, not a byte value.

I don't quite understand what you mean by 'bit value'?, but PIC's generally DON'T have digital to analogue converters - which is why I suggested the 16F877 with R2R ladder networks (D2A built with a few resistors).

I need each of 4 bytes from the serial port to represent a variable voltage ranging from 0 (0 volts) to 255 (+5 volts).

Or is MicroChip documentation leaving something out?

No, with a 16F877 and four R2R ladder networks you could receive four bytes from the serial port and output one byte to each R2R ladder - giving your four analogue outputs of 0-5V. Or you could use chip based D2A?, the pin requirements would vary depending on the particular chips you choose.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top