home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / clips_2 / CLIPS / Examples / Circuit2 < prev    next >
Encoding:
Text File  |  1993-06-02  |  1.7 KB  |  65 lines

  1. ;;;======================================================
  2. ;;;   Example Circuit #2
  3. ;;;
  4. ;;;     An example circuit to be loaded for use with
  5. ;;;     the "electronic.clp" example program. This 
  6. ;;;     circuit implements the logical functions
  7. ;;;     (not (and S1 S2)) and (or (not S1) (not S2))
  8. ;;;     which are equivalent and uses them as input
  9. ;;;     to an XOR gate. Thus the output of the
  10. ;;;     XOR gate X1 should always be zero and the
  11. ;;;     LED L1 should also always be zero.
  12. ;;;
  13. ;;; LEGEND
  14. ;;; ------------
  15. ;;; S = Source
  16. ;;; P = Splitter
  17. ;;; N = NOT Gate
  18. ;;; A = AND Gate
  19. ;;; O = OR Gate
  20. ;;; X = XOR Gate
  21. ;;; L = LED
  22. ;;; 
  23. ;;;
  24. ;;;          /--------------\           
  25. ;;; S1>--P1>-|               A1>------N1>----------\
  26. ;;;          |        /-----/                       X1>---L1
  27. ;;;          |        |                    /-------/  
  28. ;;;          \--------)------N2>-----\     |      
  29. ;;;                   |               O1>--/
  30. ;;;          /--------/          /---/
  31. ;;; S2>--P2>-|                   |
  32. ;;;          \---------------N3>-/           
  33. ;;;
  34. ;;;======================================================
  35.  
  36. (definstances circuit
  37.   (S-1 of SOURCE)
  38.   (S-2 of SOURCE)
  39.   (P-1 of SPLITTER)
  40.   (P-2 of SPLITTER)
  41.   (A-1 of AND-GATE)
  42.   (N-1 of NOT-GATE)
  43.   (N-2 of NOT-GATE)
  44.   (N-3 of NOT-GATE)
  45.   (O-1 of OR-GATE)
  46.   (X-1 of XOR-GATE)
  47.   (L-1 of LED))       
  48.  
  49. (deffunction connect-circuit ()
  50.   (connect [S-1] [P-1])
  51.   (connect [S-2] [P-2])
  52.   (connect [P-1] 1 [A-1] 1)
  53.   (connect [P-1] 2 [N-2])
  54.   (connect [P-2] 1 [A-1] 2)
  55.   (connect [P-2] 2 [N-3])
  56.   (connect [A-1] [N-1])
  57.   (connect [N-2] [O-1] 1)
  58.   (connect [N-3] [O-1] 2)
  59.   (connect [N-1] [X-1] 1)
  60.   (connect [O-1] [X-1] 2)
  61.   (connect [X-1] [L-1]))
  62.  
  63.  
  64.  
  65.