MODULE Flight

 

TITLE 'This involves a Programmable Logic Device for generating prioritised BCD codes for the PC Game Port'

" --------------------------------------------------------------------------------------------------------------------------

"

" This chip will accept up to 15 different joystick buttons inputs including a 4-way (POV) HAT Switch.

" The chip has been developed for a homemade Flight Yoke Control Set with pedals

"

"             (C) KOCH Engineering - 2003

"               Developed  November 1999

"      Henrik J. Koch, DK-3650 Řlstykke, Denmark

"         e-mail:  henrik@koch-engineering.com

"

"  FEATURES:

"     ¤  Designed to be compatible with the ´CH Flight Sim Yoke PC´

"     ¤  using already existing windows driver

"     ¤  Programmable priority between the different keys

"     ¤  7 extra pins for future expansions      

"     ¤  4-way (POV) HAT switch input can be wired to give highest priority over other buttons

"     ¤  using a Lattice GAL20V8Z PLD

"

"                                |----------\_/----------|

"       (not used)    5.priority | 1                  24 |+5V (VCC)

"                     6.priority | 2                  23 |

"                     7.priority | 3                  22 |

"                     8.priority | 4                  21 |

"                     9.priority | 5                  20 |

"                    10.priority | 6                  19 |

"                    11.priority | 7                  18 |

"                    12.priority | 8                  17 |

"                    13.priority | 9                  16 | 4.priority    (hat left )

"                    14.priority | 10                 15 | 3.priority    (hat down )

"                    15.priority | 11                 14 | 2.priority    [hat right)

"                            GND | 12                 13 | 1.priority    (hat up   )

"                                |-----------------------|

"

"Special Constants

             x,c,z    = .X.,.C.,.Z.;

 

"Inputs

             P1,P2,P3,P4,P5,P6,P7,P8,P9,P10,P11,P12,P13,P14,P15    pin 13,7,11,9,14,10,6,4,15,8,5,3,16,2,1;

 

"Outputs

             OUT3,OUT2,OUT1,OUT0     pin 23,22,21,20 istype 'com';

 

"Set Declarations

             buttons = [P15,P14,P13,P12,P11,P10,P9,P8,P7,P6,P5,P4,P3,P2,P1];

             outcode = [OUT3,OUT2,OUT1,OUT0];

 

Equations

 

truth_table

 

 ([P15,P14,P13,P12,P11,P10,P9,P8,P7,P6,P5,P4,P3,P2,P1] ->     [OUT3,OUT2,OUT1,OUT0])

" If the priority of the keys has to be changed, then the text in the PRIORITY COLUMN (underneath) has

" to be moved up or down to set the new priority number which includes both the 4-BCD code and the rem.text.

" NOTE! Also the different key/swithes has to be moved to another PCB-connector as it is the

" PCB-connector which determine the priority of the circuit.

"

" --------------------------------------------------------------------------------------------------------------------------

"  P  P  P  P  P  P  P  P  P  P  P  P  P  P  P      PRIORITY NO.

"  1  1  1  1  1  1  9  8  7  6  5  4  3  2  1

"  5  4  3  2  1  0

" --------------------------------------------------------------------------------------------------------------------------

"  1  2  1  3  5  8  1  4  6  1  1  9  1  7  1      PIN NO. AT IC           

"        6           5        0  4     1     3

" --------------------------------------------------------------------------------------------------------------------------

"                                                                PRIORITY COLUMN!!                           priority

"                                                          |-----------------------------|

 [ x, x, x ,x ,x ,x ,x ,x ,x ,x ,x ,x ,x ,x ,0] ->            [ 0,0,0,0];  "hat-up                              1. (highest)

 [ x, x, x ,x ,x ,x ,x ,x ,x ,x ,x ,x ,x ,0 ,1] ->            [ 0,0,0,1];  "hat-down                            2.

 [ x, x, x ,x ,x ,x ,x ,x ,x ,x ,x ,x ,0 ,1 ,1] ->            [ 0,0,1,0];  "hat-right                           3.

 [ x, x, x ,x ,x ,x ,x ,x ,x ,x ,x ,0 ,1 ,1 ,1] ->            [ 0,0,1,1];  "hat-left                            4.

 [ x, x, x ,x ,x ,x ,x ,x ,x ,x ,0 ,1 ,1 ,1 ,1] ->            [ 0,1,0,0];  "(button 11) not used                5.

 [ x, x, x ,x ,x ,x ,x ,x ,x ,0 ,1 ,1 ,1 ,1 ,1] ->            [ 0,1,0,1];  "button 5                            6.         

 [ x, x, x ,x ,x ,x ,x ,x ,0 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 0,1,1,0];  "button 6                            7.

 [ x, x, x ,x ,x ,x ,x ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 0,1,1,1];  "button 1                            8.

 [ x, x, x ,x ,x ,x ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,0,0,0];  "button 7                            9.

 [ x, x, x ,x ,x ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,0,0,1];  "button 8                            10.        

 [ x, x, x ,x ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,0,1,0];  "button 10                           11.

 [ x, x, x ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,0,1,1];  "button 2                            12.        

 [ x, x, 0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,1,0,0];  "button 9                            13.

 [ x, 0, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,1,0,1];  "button 3                            14.

 [ 0, 1, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,1,1,0];  "button 4                            15. (lowest)

 [ 1, 1, 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1] ->            [ 1,1,1,1];  "no key pressed

" --------------------------------------------------------------------------------------------------------------------------

" testing equations

"                                                     |----HAT----|

Test_Vectors ([P15,P14,P13,P12,P11,P10,P9,P8,P7,P6,P5,P4,P3,P2,P1 ] -> [OUT3,OUT2,OUT1,OUT0])

 

      [ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,1,1,1 ];                    "no keys

      [ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ] -> [ 0,0,0,0 ];                    "all keys down

      [ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 ] -> [ 0,0,0,0 ];                    "hat-up

      [ 1,1,1,1,1,1,1,1,1,1,1,1,1,0,1 ] -> [ 0,0,0,1 ];                    "hat-down  

      [ 1,1,1,1,1,1,1,1,1,1,1,1,0,1,1 ] -> [ 0,0,1,0 ];                    "hat-right

      [ 1,1,1,1,1,1,1,1,1,1,1,0,1,1,1 ] -> [ 0,0,1,1 ];                    "hat-left

      [ 1,1,1,1,1,1,1,1,1,1,0,1,1,1,1 ] -> [ 0,1,0,0 ];                    "(button 11) not used

      [ 1,1,1,1,1,1,1,1,1,0,1,1,1,1,1 ] -> [ 0,1,0,1 ];                    "button 5

      [ 1,1,1,1,1,1,1,1,0,1,1,1,1,1,1 ] -> [ 0,1,1,0 ];                    "button 6

      [ 1,1,1,1,1,1,1,0,1,1,1,1,1,1,1 ] -> [ 0,1,1,1 ];                    "button 1

      [ 1,1,1,1,1,1,0,1,1,1,1,1,1,1,1 ] -> [ 1,0,0,0 ];                    "button 7

      [ 1,1,1,1,1,0,1,1,1,1,1,1,1,1,1 ] -> [ 1,0,0,1 ];                    "button 8  

      [ 1,1,1,1,0,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,0,1,0 ];                    "button 10

      [ 1,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,0,1,1 ];                    "button 2 

      [ 1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,1,0,0 ];                    "button 9

      [ 1,0,1,1,1,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,1,0,1 ];                    "button 3

      [ 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,1,1,0 ];                    "button 4

 

      [ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ] -> [ 1,1,1,1 ];                    "no keys

      [ 1,1,1,1,1,1,1,1,1,1,1,1,1,0,0 ] -> [ 0,0,0,0 ];                    "test of both hat-up and hat-down

      [ 0,1,1,1,1,1,1,1,1,1,1,1,1,0,1 ] -> [ 0,0,0,1 ];                    "test of both hat-down and button 4

 

END