![]() | ![]() | ![]() |
| | |||||||
| General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion? |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| I'm pretty green when it comes to electronics, but I still really enjoy plugging away with it and learning by building circuits and such. So please be gentle! I've been working on building a circuit to interface a PS/2 mouse as a game paddle with my old Commodore64 using a PIC 1688. Basically, I'm fooling the computers A/D convertor by pulling the POT line high for a specific period of time. It all works well, however the key to getting the timing right is sensing the start of a 512us read cycle which starts when the computer pulls the line lo for 256us. The line goes from tri-state to lo, which RB0 on the PIC is unable to detect, so I'm using a saturated BJT as a switch as recommended on another thread on this site. My problem is there seems to be a latency with the switching of the transistor. I'm using an NTE123AP (since it's what I have). It's rated for 6V on the base, and a max Ic of 600ma, so I think it's big enough. hfe is 200, and ft is 300mhz min (I assume this is switching speed, which would be plenty). Changing the values of resistors to the base and collector seem to have quite an effect on how much latency there is. I start timing the cycle when the transistor switches off, and my POT value on the computer is determined by the amount of time that passed before I pull the lines high. Changing the base and collector resistors change this number. So I can only assume that the transistor is not properly switching off. How do I calculate the proper reisistor values for this, and determine if I am using the right transistor for the job? | |
| |
| | (permalink) |
| Bipolar transistors exhibit a phenomenon called storage time. Before they come out of saturation, excess base charge must be removed. There are various ways of speeding this process up, but some transistors are designed as saturated switches, and so the phenomenon is much less pronounced. I would use a transistor like a 2N2369 if you need fast switching. | |
| |
| | (permalink) |
| Put a pullup on RB0 and do away with the transistor | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) |
| Okay, here is a crude schematic of the transistor connections. The A/D line shown is tied between the computer and the PIC16F88. | |
| |
| | (permalink) |
| What's the diode doing there? If the input is push -pull then it will slow it down as will the capacitor; try removing them both.
__________________ I also post at the following sites: http://www.stop-microsoft.org http://www.heated-debates.com Screen name: Aloone_Jonez And http://www.silicontronics.com, same screen name as here. | |
| |
| | (permalink) | ||
| The dude wrote: Quote:
Quote:
Are these the same line? I don't think so, but I still don't understand what you are trying to do. Can you take another cut at explaining? | |||
| |
| | (permalink) | |
| Quote:
The POTX and POTY lines run to the control port on a Commodore 64 that are tied to an A/D convertor in a SID6581. The SID runs off a (roughly) 1mhz clock. It reads the POT lines in 512us cycles through an internal r/c. I'm trying to build a circuit that emulates a proportional mouse that Commodore built in the 80's. According to the device specs, this is how it should work. The SID's read cycle begins by pulling the POT X and Y lines lo, to completely drain the caps, for 256us. The negative edge is used as a SYNC signal for the mouse to start counting cycles. At cycle 320+MouseX the POTX line is set from tri-state to hi, and at cycle 320+MouseY the POTY line is set high. At cycle 480, both lines are tristated, and the mouse waits for the next SYNC signal. I'm having trouble with missed SYNC signals. A missed cycle registers in the A/D convertor as maximum resistance (127 in the computers POT register), so the on screen pointer jitters (from current position to 127, then back to its correct position). | ||
| |
| | (permalink) |
| Maybe some of the other guys here understand what you are trying to do, but I'm still in the dark. You're assuming that we understand what has been left unsaid. Are your mouse pots connected to +5V and GND? If so, how is this different from the original Commodore mouse? What is the role of the PIC in your circuit? | |
| |
| | (permalink) | |
| Quote:
The POT X and Y lines run directly to the Commodore 64's control port, which is tied to the SID chip through a resistor and a capacitor. The convertor operates by temporarily grounding the lines (to drain the caps) then tri-stating the lines until the caps are charged. It measures the time to charge and stores the results in an internal register. The POT lines are intended for game paddles by design (just a variable resistor), but in the late 80's Commodore decided to make a proportional mouse (like serial or PS2 mice on PC's) that could be used on the C64 with special Windows-like software. The method I'm using to emulate it is how the mouse actually works. The key is to detect the start of the whole cycle, which is determined by the POT line going from tristate to lo at the C64 side. As well, I can't use a pull up because it would charge the cap inside the C64. Would a comparator like the LM129 be a better solution than the transistor? | ||
| |
| | (permalink) |
| A comparator would probably be better. I can't see how anything that requires current, e.g., a BJT, can work. So what does the PIC do? And how do the caps get charged? Are they charged from the PIC ports? | |
| |
| | (permalink) |
| The PIC start counting cycles when RB0 is triggered (on interrupt) and sets RB1 and RB2 high at the appropriate times according to the desired POT values. Eventually it will be interfaced with a PS2 mouse and transfer its movements to the POT lines. The BJT does turn on from the low voltage of the POT line when its in a tristate condition, and switched off when the POT line is pulled low. The voltage on the line is very small, though. I believe its whats causing me to miss some cycles, when the transistor randomly fails to switch. | |
| |
| | (permalink) | |
| Quote:
| ||
| |
| | (permalink) | |
| Quote:
Yes, it is the audio chip. The low voltage swing on pin RB0 isnt enough to register on the ST and generate an interupt. Polling on other pins works, but I need it to run on interupts to maintain excact timing. | ||
| |