Jump to content
Jagware

Zerosquare

Administrators
  • Content count

    2,138
  • Joined

  • Last visited

  • Days Won

    5

Posts posted by Zerosquare


  1. No, you're right. The idea is to trigger the circuit once per frame, and measure the width of the output pulse, which is proportional to the paddle resistance. So it's based on fixed-frequency PWM. Yes, it does mean that you need to poll the controller port frequently and regularly, but you can use one of Jerry's timer interrupts to do that, and the code needed is pretty short.


  2. This documentation is wrong. Encoders don't have 3 different states, they have 4 different states, They behave like a Gray code counter, incrementing for one direction of rotation, and decrementing for the other (explanation on Wikipedia)

     

    It's also explained in the Jaguar developer docs, in the section about controllers. According to this, the sequences are :

     

    Clockwise rotation is : none, right, left AND right, left.

    Anticlockwise rotation is : none, left, left AND right, right.

     

    Personally, my code is similar to this :

     

    {
        unsigned long dataJoypad;
        unsigned long ph0, ph1, ph0_old, ph1_old; // ph0_old and ph1_old must be initialized, and preserved between calls to the routine
    
        dataJoypad = joypads->j1;    // we only manage jagpad 1 for this demonstration routine
    
        ph0 = !(dataJoypad & JOYPAD_LEFT);
        ph1 = !(dataJoypad & JOYPAD_RIGHT);
    
        if (ph0 ^ ph0_old ^ ph1 ^  ph1_old)
        {
            if (ph0 ^ ph1_old)
            {
                 // do whatever you need to move anticlockwise
            }
            else
            {
                  // do whatever you need to move clockwise
            }
        }
      
        ph0_old = ph0; 
        ph1_old = ph1;
    }

     

    (I've not tested it on the Jaguar, it's possible both directions are swapped)


  3. As I've posted it on AtariAge a few days ago (but it wasn't in the Jaguar forum, so may not have seen it) : Both SCPCD and me are working actively on the project. The hardware is mostly functional, the logic code is being debugged and the firmware is in the making. It's getting closer to release every day :)

×