Lecture 4 |
L9.4: Basic digital I/O. Write output port pins [P9] truth_table(), write_outputs() |
[3/12] |
3.4.2.2.4. truth_table(), behavioural description (plan B), algorithm
The same algorith and ideas presented in Chapter 1: plan B: behavioural truth table interpretation that now will be translated into C language. Two example circuit truth tables are presented in P9 (Fig. 11) and LAB9. (Fig. 11).
Thus, once again, you see how the same entity can be yet designed using another plan in the list: implementing logic functions using microcontrollers and software programing (strategy number 9).
3.4.2.2.5.write_outputs()
Our goal: How to inferface RAM memory bits to output pins? From internal RAM variables, write to output pins in a single instruction without modifying data available in pins of no interest. We will use bitwise logic operations such AND, OR, NOT, SHIFT.
These are two examples on how to write RAM variables in assigned port pins.
Fig. 1. Example on how to write a single output pin.
|
Fig. 2. Example on how to write a vector variable onto several port pins. Repeat the same proceeding for BCD(2..1) at PORTB. |
Exercise: Explain the bitwise operations and draw the flowchart for writing the variables var_Error and var_Alarm in pins RC3 and RC5 respectively.