Atari LETA on a CPLD

 

Counting with DIR and CLK

Next I looked at changes to the state of CLK or DIR while holding one of the inputs static. 

It's immediately apparent that the leta behaves differently from earlier Atari trackball interfaces implemented in TTL logic.

In this case the CLK signal is not used as a clock input. With  the older design on the rising edge of CLK the state of DIR determines a count up or down.


Test 1 - Change in CLK with DIR ='0'

With the LETA counting can occur at the rising and falling edges of both CLK and DIR. As mentioned before when the input RESOLN ='0' then counts occur only at the change in state of DIR.

This demonstrated something interesting... the state of DIR and CLK before a change directly influenced the action taken at the new state. In other words... it's a State Machine !!!
Test 2 - Change in CLK with DIR ='1'

These tests were carried out with RESOLN = 1 

With resoln=0 only test 3 and 4 would show changes in count.

From this you can see how the previous state and the new state of DIR and CLK affect how the count increments or decrements. 


So looking at Test 1, you can see

Marker 1.
DIR = '0' and CLK = '0'  when CLK goes to '1' count UP

Marker 2:
DIR = '0' and CLK = '1'  when CLK goes to '0' count DOWN

These correspond to the start of a count-up cycle and the end of a count down cycle.

Test 3 - Change in DIR with CLK ='0'
Test 4 - Change in DIR with CLK ='1'

Putting it together

Putting it all together into a single diagram of the normal waveform for DIR and CLK during a count up. You get a series of four possible states for the normal two phases of the CLK & DIR.

Looking at the diagram to the right
Marker 1 mirrors marker 1 on Test 1,
Marker 2 mirrors marker 1 on Test 4,
Marker 3 mirrors marker 3 on Test 2,
Marker 4 mirrors marker 3 on Test 3,

In normal operation only 1 input ever changes at a time, so you won't see '00' going to '11', or '11' going to '00'.
 

 


Counting up, with CLK leading DIR 
 
Old state New state  
DIR CLK DIR CLK Result
0 0 => 0 1 count up *
0 1 => 1 1 count up
1 1 => 1 0 count up*
1 0 => 0 0 count up

* no change if resolution = 0


Counting down works the opposite way, read the diagram right to left 
 
Old state New state  
DIR CLK DIR CLK Result
0 0 => 1 0 count down
1 0 => 1 1 count down*
1 1 => 0 1 count down
0 1 => 0 0 count down*

 


On to Page 4 - Test Input & Summary