Jump to content
IGNORED

Joystick Port interfacing - TI BASIC & CONSOLE ONLY


Meddler

Recommended Posts

Have you ever wanted to control something with your TI99 without getting complicated?

The versatility of the common 555 timer I.C will open up your Joystick Port using only TI BASIC with CONSOLE ONLY!

Inspired by the weather station project, I started looking at the possibility of using the joystick port for sensing and control. Various configurations of the 555 timer I.C will allow voltage (temperature) measurement, Relay or LED drive and motor drive (forward & reverse) upto 200mA and 15 volts.
Come the next rainy Sunday, I will test the possibilities but meanwhile I offer the following in case you would like to try them yourself. By using 5 volt systems you are unlikely to do any damage but if you want to switch Mains Power then you better ask me first!

We have 5 inputs giving us two planes of X and Y or 5(10) linear 'stops'; with the use of a 555 timer we can measure it's pulse width for a rudimentary Analogue to Digital converter.
We have 2 outputs for controlling relays or a small electric motor using the 555 timer I.C as a latch and power output stage.

If necessary, we can 'borrow' the 0 volts from the cassette port and 'steal' +12 volts from the Video connector.

This means that we have the capability of controlling a 5 floor elevator from our TI99 using only the Joystick port and a couple of 555 timer I.Cs. Now, I don't suppose there are many of you out there that have a 4 story house in which you have just been waiting to install a private elevator but it might be a nice School project for the kids. More usefully, it is possible to measure temperature, detect limit switches and switch a relay or drive small motors using a couple of 555 timer I.Cs.

Looking at the Joystick port we can see that there are two outputs and five inputs and the principle of operation is that a key press is indicated when an input line is taken 'low' and the strobed output line (Joystick 1 or 2) determines which specific key.
The Joystick port has an intricate circuit that is mainly to do with protecting the TI99 from the outside world.
The inputs are relatively simple in that they are held at +5 volts and go to the port through a switch de-bounce filter and current limiting resistors. We can interface to the inputs with a switch, transistor, FET or opto-coupler. The use of a transistor is not advised due to the possibility of Emitter-Base reverse breakdown in this configuration and an opto-coupler is a good option if connecting to higher voltages or external sources.

I propose to use the Joystick port strobe outputs to trigger a 555 timer I.C and the Joystick inputs for limit indicators or sampling. I will use the Joystick 'low' strobe to trigger external circuits, in particular, a 555 timer I.C as it has a useful power output stage and latching function.

This is the explanation of the output drive circuit so you can skip this paragraph. The schematic is attached:
The configuration of the Joystick outputs is a transistor whose job is to drive the voltage on the 1K5 resistor to +5 volts or to a logic 'low' to switch the key inputs. Normally the transistor is 'on' and holding the output at +5 volts by driving the 1K5 resistor that is connected to -5 volts. What happens when the transistor is strobed is that the Base is taken to logic 'low' and so the voltage on the 1K5 resistor is reduced to a fraction of a volt below 0 volts which will switch an input when a key is pressed. The 1K5 resistor is biased towards -5 volts whose voltage drop is controlled by the transistor and so it can be deduced that we can 'sink' upto 2.5mA into an input and maintain a logic 'low' input. Similarly we can 'source' several mA without dropping below the logic 'high' level.

  • Like 3
Link to comment
Share on other sites

Have you ever wanted to control something with your TI99 without getting complicated?

The versatility of the common 555 timer I.C will open up your Joystick Port using only TI BASIC with CONSOLE ONLY!

 

Inspired by the weather station project, I started looking at the possibility of using the joystick port for sensing and control. Various configurations of the 555 timer I.C will allow voltage (temperature) measurement, Relay or LED drive and motor drive (forward & reverse) upto 200mA and 15 volts.

Come the next rainy Sunday, I will test the possibilities but meanwhile I offer the following in case you would like to try them yourself. By using 5 volt systems you are unlikely to do any damage but if you want to switch Mains Power then you better ask me first!

 

We have 5 inputs giving us two planes of X and Y or 5(10) linear 'stops'; with the use of a 555 timer we can measure it's pulse width for a rudimentary Analogue to Digital converter.

We have 2 outputs for controlling relays or a small electric motor using the 555 timer I.C as a latch and power output stage.

 

If necessary, we can 'borrow' the 0 volts from the cassette port and 'steal' +12 volts from the Video connector.

 

This means that we have the capability of controlling a 5 floor elevator from our TI99 using only the Joystick port and a couple of 555 timer I.Cs. Now, I don't suppose there are many of you out there that have a 4 story house in which you have just been waiting to install a private elevator but it might be a nice School project for the kids. More usefully, it is possible to measure temperature, detect limit switches and switch a relay or drive small motors using a couple of 555 timer I.Cs.

 

Looking at the Joystick port we can see that there are two outputs and five inputs and the principle of operation is that a key press is indicated when an input line is taken 'low' and the strobed output line (Joystick 1 or 2) determines which specific key.

The Joystick port has an intricate circuit that is mainly to do with protecting the TI99 from the outside world.

The inputs are relatively simple in that they are held at +5 volts and go to the port through a switch de-bounce filter and current limiting resistors. We can interface to the inputs with a switch, transistor, FET or opto-coupler. The use of a transistor is not advised due to the possibility of Emitter-Base reverse breakdown in this configuration and an opto-coupler is a good option if connecting to higher voltages or external sources.

 

I propose to use the Joystick port strobe outputs to trigger a 555 timer I.C and the Joystick inputs for limit indicators or sampling. I will use the Joystick 'low' strobe to trigger external circuits, in particular, a 555 timer I.C as it has a useful power output stage and latching function.

This is the explanation of the output drive circuit so you can skip this paragraph. The schematic is attached:

The configuration of the Joystick outputs is a transistor whose job is to drive the voltage on the 1K5 resistor to +5 volts or to a logic 'low' to switch the key inputs. Normally the transistor is 'on' and holding the output at +5 volts by driving the 1K5 resistor that is connected to -5 volts. What happens when the transistor is strobed is that the Base is taken to logic 'low' and so the voltage on the 1K5 resistor is reduced to a fraction of a volt below 0 volts which will switch an input when a key is pressed. The 1K5 resistor is biased towards -5 volts whose voltage drop is controlled by the transistor and so it can be deduced that we can 'sink' upto 2.5mA into an input and maintain a logic 'low' input. Similarly we can 'source' several mA without dropping below the logic 'high' level.

 

Using RXB may peek your interest on this as with CALL IO you can control the ports on the Joystick and read them or write to them.

 

 

 

No Assembly Language required so faster development times. Just use XB alone.

Edited by RXB
  • Like 1
Link to comment
Share on other sites

Thank you, I did have trouble up-loading the schematic. ("You are not allowed to use that image extension on this community!?")

Call Joyst is an output command. When Call Joyst(n,x,y) is issued then the line is strobed 'low' irrespective of whether a key is active; I am assuming that it is strobed for a few milli-seconds against switch bounce and that is what I have to check. Those with some electronics experience will appreciate that is sufficient to trigger most devices.

 

Very interesting. You left out the schematic though.

How would one use TI Basic though with this set up since the Call Joyst command only reads the fixed axis values and there is no facility to issue an output command to the joystick port?

 

This is the explanation of the output drive circuit so you can skip this paragraph. The schematic is attached:
The configuration of the Joystick outputs is a transistor whose job is to drive the voltage on the 1K5 resistor to +5 volts or to a logic 'low' to switch the key inputs. Normally the transistor is 'on' and holding the output at +5 volts by driving the 1K5 resistor that is connected to -5 volts. What happens when the transistor is strobed is that the Base is taken to logic 'low' and so the voltage on the 1K5 resistor is reduced to a fraction of a volt below 0 volts which will switch an input when a key is pressed. The 1K5 resistor is biased towards -5 volts whose voltage drop is controlled by the transistor and so it can be deduced that we can 'sink' upto 2.5mA into an input and maintain a logic 'low' input. Similarly we can 'source' several mA without dropping below the logic 'high' level.

Port_schematic2s.bmp

Link to comment
Share on other sites

Got it. Really lots of control options here with no added peripherals except the interface board. Looking forward to some practical demos!

You should cross-post this project in TI interfacing thread http://atariage.com/forums/topic/237526-ti-994a-interfacing/page-1?hl=+ti%20+interfacing as well in the development forum.

Link to comment
Share on other sites

  • 2 weeks later...

The basics i.e TI BASIC - proof of principle.
To look at the Joystick port interfacing options I made a little test rig as attached:

 

( Does anyone know how to embed a photo?)

 

The Video output gives a 12 volts feed and the Cassette port gives the System Ground. The Purple wire is the 12 volts supply from the Video connector.
The Red LEDs are being driven by J1 & J2 and Cassette System Ground; In the centre you can see a standard 5 volt Regulator; the Green LED is connected to the output of the LM555 and, for good measure, I connected the White LED to the Cassette motor drive and 12 volts. The pushbutton on the left is 'FIRE' button for J1 & J2 using a couple of Diodes to isolate channels.
The LM555 is configured as a set/reset latch with the J1 & J2 output connected to Trigger and Reset.
The J1 & J2 outputs referenced to System Ground are 50 micro-second negative going pulses; between 4.5v down to -0.2v.
Alternately switching J1 & J2 turns ON & OFF the Green LED using a simple CALL JOYST 1 or 2. In a software loop with an ON KEY get-out test returns a 100 milli-second cycle.
The purpose of the LM555 is to provide the latching function and greater drive power.
In conclusion then, it is feasible to switch directly from the Joystick port and control that action using the Joystick inputs with only the 99 console. The limitation is that there are only two pulsed outputs.

The next stage is to connect back-to back 555 I.Cs so that I can drive an electric motor in forward and reverse (or two relays). With some modification to the circuit interfacing I will use the 12 volt supply to give 3 Watts maximum power drive.

Applications? The main limitation of the Joystick port is that there are only two outputs meaning that only one axis of motion is possible with out getting complicated. However, that does mean Forward and Reverse for D.C and Stepper motors with minimal interfacing.
Indexed Turntable control or Solar tracking is possible with a more esoteric application using the capabilities of the 99 could be Resistance welding. I have a Temperature sensor connected through my RS232 so I already have Heating control as a possibility.
Any ideas you want me to think about? Slot car Start Line lights and Lap times!!? :)

 

Got it. Really lots of control options here with no added peripherals except the interface board. Looking forward to some practical demos!

You should cross-post this project in TI interfacing thread http://atariage.com/forums/topic/237526-ti-994a-interfacing/page-1?hl=+ti%20+interfacing as well in the development forum.

 

Whilst this is interfacing, it does not justify the title "development".

 

This could be really cool!!! Looking forward to your progress!

post-45502-0-44441400-1488132561_thumb.jpg

Edited by Meddler
Link to comment
Share on other sites

But of course it is development! You have developed a way to interface the joystick port to the real world using a standalone console. If that does not qualify, I don't know what does...

Besides, we take development as a very loose term around here :) Most of my "development" projects, if not all, are utterly useless contraptions, and yet they do demonstrate a certain hardware or software aspect that might be useful to someone at some point... Never underestimate the power of fun :)

  • Like 2
Link to comment
Share on other sites

Addendum:
since using the Joystick port to switch a 555 I realised that the split keyboard CALL KEY(n,k,v) where n=1 or 2 polls the same CRU outputs which is handy because it means that key press can be monitored in the same routine; the CALL JOYST routine ignores the keys but instead formats the quadrant information.

I will re-check the timing to see if the pulse is longer for CALL KEY though I am pleasantly surprised to find that the action is rock solid!

I studied the Cassette Motor Drive function but it is always ON and only properly controllable after the "OPEN" routine giving it limited use. Fixed length Records give defined timing. It could be used to flash a warning light 'on error' or 'in operation' if driving a conveyor belt or some-such.

Link to comment
Share on other sites

Attached is the circuit for driving an electric motor (or relays) in a 555 H-bridge configuration:

The states are:
J300p3 J300p2 (negative trigger)

High High (normal-resting)Off
Low High Direction +
High Low Direction -
Low Low (Reset)Stop Off

555_Bridge_s.bmp

 

(A larger picture is attached below 'cause that didn't work!).

There are three parts to this of which the two 555s are the substance as S-R latches using Trigger and Reset but each 555 needs to be triggered and there are only two control lines for three functions. I have added the two transistors on the left to provide the Reset function by monitoring the 555 outputs.

The two transistors Q1, Q2 are in a Schmitt Trigger configuration which resets both 555's when both Outputs go 'High'. There are two equal resistors connected to the 555 outputs so if either of the outputs is 'High' and the other is 'Low' then then Schmitt input sees half-rail voltage which is not enough to trigger a Reset. The current un-triggered 555 is triggered to Reset and stop the circuit as both outputs will now be 'High' which is above the Schmitt trigger upper level and the 555 will be rapidly Reset; only when both outputs have gone 'Low' will the Schmitt trigger lower level be passed to release the Reset.

The 555s may be supplied by up to 15 volts so the third part of the circuit uses the transistors Q3 & Q4 to interface the 5 volt level. The 555s may supply up to 200mA to give the potential to drive 3 Watts of power (2.4 watts at 12 volts).

Finally, driving electric motors or relays can be stressing so pairs of diodes have been added to protect the outputs.
Series (opposing sense) diodes will need to be fitted in series with Relays if two (independant) Relays are to be switched.
Resistor values are not critical with the exception of the Schmitt ratios and most small signal transistors will do.

555_Bridge.bmp

Edited by Meddler
  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

555 PCB: Unbelievable!

£1 with no shipping charge for PCB, NE555, CD4017, 10x Red LEDS and all the other components for less than I can buy the parts and more than I need.

LED Module Assembly Of Parts

 

DIP = http://www.ebay.co.uk/itm/152320299752

SMD = http://www.ebay.co.uk/itm/291936911590

 

I have no idea how they manage to do this. The shipping alone to the US should be 5-10x the price of the unit, let alone the price of components themselves...I wonder if they collect the money and never ship anything. Given that it's such a ridiculously low price, most people may not bother following up on it and if they do PayPal will just opt to reimburse them without putting up much of a fight with the seller.

Link to comment
Share on other sites

  • 2 months later...

Whilst waiting for my cheapo Chinese imported MP3 recorder (no tape deck, thankyou, !shudder!) I have continued my pursuit of Joystick port interfacing <strike>dreaming </strike>ideas.

The limitation is that there are only two output lines so you can have two on/off functions or forward/reverse but not both which is very limiting.
It occurred to me that if a motor driven disc was moving a reciprocating arm then two motors could be used and with the cassette motor drive to a solenoid or vacuum line giving X-Y movement and function. So a Plotter/Drill and a Pick & Place is possible!

Realistically, what has been going through my mind is
"What task justifies leaving a TI99 powered up or justifies it's use as a tool?" "What job would be suitable for full "throw" and return action?"

Here goes, Solar panel drive, monitoring and reporting: Not only does the "out & return" action make complete sense but you have the full processing power for monitoring and recording the complete situation of sunlight, voltage and time of year etc.
What a grand project that would be!

And for you Gardeners, Greenhouse/ Propagator management, again, the "out & return" action works for ventilation with a temperature switch and watering by the Cassette motor drive. Though I would not recommend leaving the TI99 in that environment. :)

And we have discussed Weather monitoring.

Any other ideas? I fancy using it to shoot down over-flying Drones, maybe tie that into a game scenario. :)
The objective here is to bring the TI99 into daily life rather than an obsolete curiosity for rainy days.

Edited by Meddler
Link to comment
Share on other sites

Why can we not build a Mouse that runs from the Joystick port? The two sticks would give us X and Y and 2 mouse buttons?

 

Because you would expect that a mouse delivers different speed values? There is more than up/down/left/right. The Mechatronics mouse just did that, using the 7 lines of the joystick port (3 for motion, 2 for mouse buttons, 2 selector lines). Two lines (1, 6) are not connected in the joystick port.

Link to comment
Share on other sites

 

Because you would expect that a mouse delivers different speed values? There is more than up/down/left/right. The Mechatronics mouse just did that, using the 7 lines of the joystick port (3 for motion, 2 for mouse buttons, 2 selector lines). Two lines (1, 6) are not connected in the joystick port.

 

So you'd have what, only eight possible directions, and no variation in speed? It would be "joystick-like" in its movement, as opposed to "mouse-like?" I suppose you could partially compensate by having the pointer move faster the longer you moved the mouse (I seem to recall a joystick driver - for TI Artist? - doing something similar).

  • Like 1
Link to comment
Share on other sites

No, it's a bit more complicated. The three bits for motion deliver values from -4 to +3 (two's complement, 3 bits). There are two counters in the Mechatronics box; the value can be "downloaded" by iterated query, and X and Y axes are polled alternatively.

 

For instance, if a mouse movement sets the counters in the Mechatronics box to X=+20, Y=-10, you get this sequence: 3, -4, 3, -4, 3, -2, 3, 0, 3, 0, 3, 0, 2, 0, 0, 0, ... because 3+3+3+3+3+3+2 = 20, -4-4-2=-10

Link to comment
Share on other sites

Yea you could change a variable to control the scan rate of the Joystick port.

Works very much like a RXB version that does the same thing:

 

100 SPEEDSCAN=9 ! This variable with smaller numbers (0 or 1) scans the joystick port less often and larger numbers (9 or 7) more often

110 FOR T=0 TO SPEEDSCAN

120 CALL JOYST(1,X,Y,2,XX,YY) :: CALL KEY(1,K,S,2,KK,SS) ! RXB can scan both joysticks and both key scans in one line of XB code

130 IF S+SS<>0 THEN 800 ! If status in S+SS not zero then joystick or key was pressed.

130 NEXT T

...

800 ! CURSORSPEED=75 ! This variable is the speed of the sprite, higher numbers is faster sprite movement and lower numbers slower sprite movement

...

Edited by RXB
Link to comment
Share on other sites

Why can we not build a Mouse that runs from the Joystick port? The two sticks would give us X and Y and 2 mouse buttons?

A lot of "mice" derive the movement from two, X-Y, sources to provide a simple square wave signal proportional to speed which is then processed.

I doubt that the JOYST routine can be polled fast enough for meaningful results if that square wave is sampled and would also not be active whilst the keyboard is required. It is the case that Keyboard and Mouse are treated as separate entities on PCs. (It caused a lot of heart-ache when the first PS/2 "mice" were introduced).

 

Given that most "mice" are PS/2 or USB then it seems to me that a plug-in to the side port with it's own DSR would make more sense.

 

Though, on reflection, a routine could be written to interrogate the keyboard 9902 CRU pins....

Edited by Meddler
Link to comment
Share on other sites

A lot of "mice" derive the movement from two, X-Y, sources to provide a simple square wave signal proportional to speed which is then processed.

I doubt that the JOYST routine can be polled fast enough for meaningful results if that square wave is sampled and would also not be active whilst the keyboard is required. It is the case that Keyboard and Mouse are treated as separate entities on PCs. (It caused a lot of heart-ache when the first PS/2 "mice" were introduced).

 

Given that most "mice" are PS/2 or USB then it seems to me that a plug-in to the side port with it's own DSR would make more sense.

 

Though, on reflection, a routine could be written to interrogate the keyboard 9902 CRU pins....

Yet RXB since 2001 also has a routine that uses the GPL ACCESS TO CRU Input/Output command:

 

110 CALL IO(2,16,3,A,B) :: IF A=18 AND B=255 THEN 110

This line scans up to 4 keys being pressed on TI99/4A keyboard at same time and puts those values into A and B, of course the values depend on keys pressed.

For example A=146 is the Function key, B=191 is Control key, B=223 is Shift key, B=251 is Enter key, B=253 is the Space Bar and B=254 is the Plus/Equal key.

You can actually determine from CALL IO which Shift key was press by the alternate value in A too.

So CALL IO also works with the Joysticks too see Smart Programmer issue Volume 2 Issue 4 Sept 1985 for CRU Map.

Using a specific CRU line on Joysticks would probably be much more effective than scanning entire keyboard

RXB has many powerful tools that very few have taken advantage of over the years.

Link to comment
Share on other sites

Yet RXB since 2001 also has a routine that uses the GPL ACCESS TO CRU Input/Output command:

 

...

So CALL IO also works with the Joysticks too see Smart Programmer issue Volume 2 Issue 4 Sept 1985 for CRU Map.

Using a specific CRU line on Joysticks would probably be much more effective than scanning entire keyboard

RXB has many powerful tools that very few have taken advantage of over the years.

That is great! I therefore nominate you to give us a "mouse", after all you have to be the expert here. ;)

Link to comment
Share on other sites

That is great! I therefore nominate you to give us a "mouse", after all you have to be the expert here. ;)

Hmm really I have other major projects currently such as decoding the XB ROMs and making a SAMS version of RXB.

 

I provide the tools in the hope others will take these tools and put them to good use.

 

RXB is free and available for anyone to use to test this concept such as a joystick mouse routine in RXB.using CALL IO

 

Other uses are using CALL IO to access a number of devices:

 

http://atariage.com/forums/topic/163627-rxb-rich-extended-basic/page-28

Link to comment
Share on other sites

...

 

RXB is free and available for anyone to use to test this concept such as a joystick mouse routine in RXB.using CALL IO

 

...

If CALL IO is that versatile then could it be used to decode the PS/2 protocol? So much easier than re-inventing the wheel (mouse) and we get a full keyboard too so no conflict with the internal keyboard.

That said, the reason all peripherals have their own DSR etc. is to avoid using console memory in which case I stand by my suggestion of using the side bus port.

Mean-while let us see who spots that I typed 9902 instead of 9901 and we can nominate them as they obviously know a thing or two. ;)

Edited by Meddler
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...