Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
Thread Tools Display Modes
Old 8th March 2005, 05:29 AM   (permalink)
Default Serial to Gameport Conversion

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.
Draqo is offline   Reply With Quote
Old 8th March 2005, 08:00 AM   (permalink)
Default

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 8th March 2005, 08:13 AM   (permalink)
Default

Any specific PIC that can do this job well?
Draqo is offline   Reply With Quote
Old 8th March 2005, 08:24 AM   (permalink)
Default

Quote:
Originally Posted by Draqo
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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 8th March 2005, 03:08 PM   (permalink)
Default

For four seperate analog voltage outputs?
Draqo is offline   Reply With Quote
Old 8th March 2005, 03:37 PM   (permalink)
Default

Quote:
Originally Posted by Draqo
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!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 8th March 2005, 07:39 PM   (permalink)
Default

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 is offline   Reply With Quote
Old 9th March 2005, 08:21 AM   (permalink)
Default

Quote:
Originally Posted by Draqo
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).

Quote:

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 9th March 2005, 08:44 AM   (permalink)
Default

Use PWM and a filter, 1 pin per output.
FRIED is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes




All times are GMT. The time now is 06:19 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.