Image Map Image Map
Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: has anyone ever used a digital to analog adapter card for an apple II?

  1. #21

    Default

    Quote Originally Posted by 2icebitn View Post
    A joystick w/o any electronics is analog by nature. As is a mouse, trackball. Internally it can be converted to deliver digital pulses. The conversion can happen internally or on the plug in card. I'm no expert on joysticks mind you. Proceed carefully with that, wouldn't want you blowing up ur Apple.
    Actually, all but the earliest mice are digital. Trackballs too! Essentially the ball moves two rollers that are connected to disks with a number of slits cut into them. On one side of the disk is an infrared LED and on the other side is an IR sensor. As the disk spins the IR beam is interrupted by the slits in the disk. This translates to a digital pulse every time the mouse moves a certain amount.

    Originally this digital pulse was picked up by an interrupt in the computer; later the mice got smarter and performed this function themselves (they would report an X/Y value over the serial interface).

    Joysticks on the other hand *are* analog. They’re essentially a pair of potentiometers. The easiest way to convert this to a digital value is to apply a voltage through each potentiometer to a capacitor and time how long it takes to reach a set voltage. It’s simple and can be done with nothing but a stable film capacitor and comparator.

  2. #22
    Join Date
    Jan 2010
    Location
    Central VA
    Posts
    4,105

    Default

    Quote Originally Posted by timb View Post
    Joysticks on the other hand *are* analog. They’re essentially a pair of potentiometers. The easiest way to convert this to a digital value is to apply a voltage through each potentiometer to a capacitor and time how long it takes to reach a set voltage. It’s simple and can be done with nothing but a stable film capacitor and comparator.
    I believe the trick with that on the Apple II was to use the pot to vary the frequency of a 555 timer, allowing simple digital pulse counting. I'm sure someone else here has more in-depth details about it

  3. #23

    Default

    Quote Originally Posted by glitch View Post
    I believe the trick with that on the Apple II was to use the pot to vary the frequency of a 555 timer, allowing simple digital pulse counting. I'm sure someone else here has more in-depth details about it
    Right, that was the other common method! This is essentially a Voltage to Frequency (V to F) converter. The 555 makes a very practical, inexpensive V to F (what would have taken a dozen or more components, including precision analog parts was reduced to a single IC and a few 10% tolerance passives). This method would produce an output pulse with a stable 50% duty cycle, but a varying frequency.

    For those curious on the details:

    With the Apple method, the system knows it’s internal clock runs at a certain frequency, so all they have to do is count the number of pulses that come from the 555 over a given period of system clock cycles and do some math to determine the frequency. (Say the system clock runs at 1MHz and your counting period is 100 clock cycles; if you count 50 pulse from the 555 you can determine it’s frequency is roughly 0Hz).

    The IBM PC method of using an RC circuit (Resistor/Capacitor) and comparator is essentially a Voltage to Duty Cycle converter; it runs at a set frequency but the width of the pulse (or duty cycle) changes depending on the position of the joystick. In this method, they count the number of system clock cycles between the start of the period and the input pulse going high. (Again, say the system is running at 1MHz and your timing window is 100 system clock cycles; if the input pulse goes high after 75 clock cycles you can calculate a 75% duty cycle).

    In either method, the longer your counting period or timing window the more accurate the results. The PC method uses less system resources because it can take advantage of interrupts (basically it stores in memory the system timer value of when the timing window started, sets an interrupt to look for the pulse and goes back to what it was doing; when the pulse happens the interrupt is triggered and it subtracts the current system timer value from that in memory to determine the pulse length). The Apple method *can* use interrupts too, but it has to service one for each pulse so depending on the frequency that can mean servicing a ton of interrupts! When the Apple was originally built this wasn’t really a problem as software ran pretty much bare metal, so a small ISR to increment a counter on each pulse wouldn’t have impacted performance much, if any.
    Last edited by timb; June 8th, 2018 at 10:20 AM. Reason: Im bad at math!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •