VIC 20 as PC keyboard?

Basic and Machine Language

Moderator: Moderators

brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Post by brain »

eslapion wrote: I thought it would be possible using a pair of cascaded 74LS161 or 74LS163 counters and a bit of surrouding electronics such as resistors, capacitors and transistor.
You need to ensure you can count 512 steps (256 charge cycles, 256 discharge cycles), so I think it will take an additional FF. As well, if you want to eliminate jitter, you need to make the CLK configurable so it can sync to the incoming clock.
I thought you might have experimented with that. ...off topic really...
I actually implemented the protocol for PSXJoy, and it works very well (no jitter), but it only works on the 64/128 right now. If I had some time, I could see if the protocol could be tweaked for the VIC-20, but it's not a high priority at present.

Jim
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

What part of "Analog to Digital Conversion" do people not understand here? Anything that converts analog signals to digital is an ADC, regardless of how it accomplishes it.
Except it isn't. If you apply a fixed voltage on the POT pins you will get either $00 or $FF depending on whether that level is above or below the POT pin input threshold. It's the delay between the POT pin drive being turned off and that pin going high that is measured, not an analog level.

That the delay time is defined by a resistor and capacitor does not make this an A/D convertor.

Lee.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

It's digital, Jim, but not as we know it. :lol:
Anders Carlsson

Image Image Image Image Image
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Post by brain »

Leeeeee wrote: Except it isn't. If you apply a fixed voltage on the POT pins you will get either $00 or $FF depending on whether that level is above or below the POT pin input threshold. It's the delay between the POT pin drive being turned off and that pin going high that is measured, not an analog level.

That the delay time is defined by a resistor and capacitor does not make this an A/D convertor.

Lee.
Let us examine the definition of ADC:

"A device that can accept an analog, i.e. continuous, signal whose amplitude lies within a given range, and produce an equivalent digital signal, i.e. an n-bit parallel binary word that represents this analog signal. "

I can guarantee you that the input pins are ADCs. Even though they do not respond to changes in voltage, they do respond to changes in voltage over time. I can create, for example, any reading on the POT line by varying the amount of time that a 5V source is applied to the POT pins. In fact, as Eslapion notes, this is exactly how the 1351 mouse works.

I think you are confusing the general term with the standard ADC types and uses.

Jim
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

"A device that can accept an analog, i.e. continuous, signal whose amplitude lies within a given range, and produce an equivalent digital signal, i.e. an n-bit parallel binary word that represents this analog signal."
A definition which the POT inputs completely fail to meet.

The POT inputs respond to the delay in the change of the POT signal crossing the input threshold, a digital input threshold. Yes they respond to a continuously variable delay in the change but the signals thresholds are all digital.

Lee.
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Post by eslapion »

To Both Leeeeee and Brian:
Each of you is right from a certain point of view.

The VIC's POT input are ADCs in the sense that it translates the analog value of a potentiometer into a digital value. It does so by counting how much time the current flowing through the potentiometer takes to charge a capacitor to a certain threshold voltage and that threshold voltage is not exactly rock stable.

But its not an ADC if you limit your definition of an ADC to something that converts an analog VOLTAGE into a digital value.

Anyways, I think arguing about the specific definition of this input device is not exactly something that will benefit mankind for the millenias to come...
Be normal.
brain
Vic 20 Nerd
Posts: 538
Joined: Sun Jul 04, 2004 10:12 pm

Post by brain »

Leeeeee wrote:
"A device that can accept an analog, i.e. continuous, signal whose amplitude lies within a given range, and produce an equivalent digital signal, i.e. an n-bit parallel binary word that represents this analog signal."
A definition which the POT inputs completely fail to meet.

The POT inputs respond to the delay in the change of the POT signal crossing the input threshold, a digital input threshold. Yes they respond to a continuously variable delay in the change but the signals thresholds are all digital.

Lee.
The delay is caused by a varying "amount" (amplitude) of current charging the capacitor. Thus, With I=E/R, the larger the resistance (R) for a fixed voltage (E), the smaller the current (I) allowed through the wire to the capacitor per unit time. This function varies over time, as V changes as the capacitor charges, since the V in the equation represents Vpotential-Vcapacitor. As the capacitor charges through the cycle, it acquires a voltage level, which further reduces the current inflow.

Yes, eslapion is correct, but it bothers me that people discount current in this model. It is precisely what you are measuring (the amount of current charging the capacitor to a constant voltage over time). In my defense, it seems wrong that I have to defend my use of the term "ADC" just because most ADC discussions target voltage conversions. It is just as valid to use ADCs to measure current.

Jim
bdk6
Vic 20 Amateur
Posts: 47
Joined: Fri Sep 29, 2017 7:40 pm
Website: http://www.smalltimeelectronics.com
Location: TN, USA
Occupation: Embedded engineer

Re: VIC 20 as PC keyboard?

Post by bdk6 »

I realize this is a REALLY old thread, that got way off topic, but ...
Back on topic.
I really like the idea of using the VIC as a keyboard for the PC. The Rube Goldberg audio frequency setup originally outlined is neat. But, why not just write a program on the VIC that makes it look like a PS2 keyboard? A couple pins on the user port, maybe with a few resistors, and some software that handles the key scanning, conversion, and PS2 protocol (which is pretty simple) should be enough. Hook into the PS2 keyboard port directly, or use a PS2 to USB converter if your pc doesn't have PS2 input.
Maybe that would be a good warmup project for my re-entry to VIC programming when I get some time.
Can anyone think of a reason that wouldn't work?
Post Reply