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

  1. ;;;======================================================
  2. ;;;   Example Circuit #1
  3. ;;;
  4. ;;;     An example circuit to be loaded for use with
  5. ;;;     the "electronic.clp" example program. Note
  6. ;;;     that OR gate #1 receives both inputs from the
  7. ;;;     same source with one of the inputs negated.
  8. ;;;     Therefore, the output of this OR gate should
  9. ;;;     always be 1 and the value of source #1 is
  10. ;;;     has no effect on the value of the LEDs.
  11. ;;;
  12. ;;; LEGEND
  13. ;;; ------------
  14. ;;; S = Source
  15. ;;; P = Splitter
  16. ;;; N = NOT Gate
  17. ;;; O = OR Gate
  18. ;;; X = XOR Gate
  19. ;;; L = LED
  20. ;;;
  21. ;;; 
  22. ;;;          /---N1>--\           /---------L1
  23. ;;; S1>--P1>-|         O1>---P2>--|
  24. ;;;          \--------/           |
  25. ;;;                               |
  26. ;;;                               |
  27. ;;;                               \---\
  28. ;;;                                    X2>--L2
  29. ;;; S2>-------------------------------/
  30. ;;;
  31. ;;;======================================================
  32.  
  33. (definstances circuit
  34.   (S-1 of SOURCE)
  35.   (S-2 of SOURCE)
  36.   (P-1 of SPLITTER)
  37.   (P-2 of SPLITTER)
  38.   (N-1 of NOT-GATE)
  39.   (O-1 of OR-GATE)
  40.   (X-1 of XOR-GATE)
  41.   (L-1 of LED)
  42.   (L-2 of LED))
  43.  
  44. (deffunction connect-circuit ()
  45.   (connect [S-1] [P-1])
  46.   (connect [S-2] [X-1] 2)
  47.   (connect [P-1] 1 [N-1])
  48.   (connect [P-1] 2 [O-1] 2)
  49.   (connect [N-1] [O-1] 1)
  50.   (connect [O-1] [P-2])
  51.   (connect [P-2] 1 [L-1])
  52.   (connect [P-2] 2 [X-1] 1)
  53.   (connect [X-1] [L-2]))
  54.  
  55.