Sequential Logic, part 1: Truth Tables
Truth tables come up in computer science classes, electrical engineering classes and, to a lesser extent, in relay logic. However, I think they are a fabulous way to understand what is happening. You draw out a set of inputs and their outputs.
Consider a situation where A and B are true to make C true. Trivial, obviously.
A | B | C |
True | True | True |
True | False | False |
False | True | False |
False | False | False |
This is a pretty quick way to come up with circuits in ladder logic. In this case, you would write XIC(A) & XIC(B). If you write up the circuit for something more complex, you may find something similar. For instance, I found code that had a common failure bit calculated in logic and then reused some (but not all) of the alarms in series with it to execute. In this case, imagine that XIC(A) & XIC(C) had to be true in order for D to be true. What would that table look like?
A | B | C | D |
True | True | True | True |
True | False | False | False |
False | True | False | False |
False | False | False | False |
Are there any circumstances where those extra lines of ladder help? No. Would they hurt? Probably not operationally, but it would complicate troubleshooting.
Truth tables are great, but I think they perform poorly when it comes to time dependent operations. What if you need something to true on just when something else comes true? For example, a reset pushbutton that resets a latched failure? For that, you need a digital timing diagrams (hopefully the post for September)...
If someone uses the terms AND, OR, NAND and NOR, they probably come from the computer science / electrical engineering background. If they use symbols like + (and) or V (or), they probably came from a math background. Coworkers using XIC (examine if closed) and XIO (examine if opened) would probably mean a background as an electrician. There are lots of equivalences.
Other great places to read include Geeks4Geeks, Wikipedia and LibreMath.
Stanford has a truth table generator. Play with it!
Bài viết này ngắn gọn mà dễ hiểu thật, mình đọc liền một lượt là nắm được ý, cảm ơn bạn đã chia sẻ. Mình cũng có thói quen mỗi ngày ghé xem phần soi cầu XSMB, nhưng trước kia hay phải mở vài chỗ khác nhau để so sánh nên mất công lắm. Về sau mình tự ghi lại và gom chung cho tiện, rồi lưu thành một trang trên soicau247.com để lúc cần chỉ mở ra xem nhanh, đỡ phải lục lại từng nơi. Mình chủ yếu theo dõi số liệu cập nhật theo ngày để tiện ghi chú và đối chiếu thôi, chứ không có gì phức tạp. Nếu ai cũng hay theo dõi kiểu vậy thì…