1 × 2 decoder with active low outputs, 265–266
1 × 2 decoder with enable input, 266–268
1 × 2 decoder with enable input and active low outputs, 268–269
1 × 2 DMUX with enable input, 244, 246–247
1 × 4 DMUX with enable input, 246, 249–251
1 × 8 DMUX with enable input, 252, 255–257
1-bit (Boolean) variable definitions, 16–19
1-to-n demultiplexers, 243–244
2 × 1 MUX with enable input, 226, 228–229
2 × 4 decoder with active low outputs, 270–273
2 × 4 decoder with enable input, 273–275
2 × 4 decoder with enable input and active low outputs, 273–277
3 × 8 decoder with active low outputs, 280–282
3 × 8 decoder with enable input, 280, 283–285
3 × 8 decoder with enable input and active low outputs, 283, 286–288
4 × 1 MUX with enable input, 228, 231–232
4 × 2 priority encoder, 296–298
4 × 2 priority encoder with enable input, 298–299
4PDT switch, 1
74HC/LS165 registers, 1, 12–13
variable definitions, 17
8 × 1 MUX with enable input, 233, 235, 237–238
8 × 3 priority encoder, 300–303
8 × 3 priority encoder with enable input, 303–306
8-bit down counter (CTD_8
), 130–132
8-bit off-delay timer (TOF_8
), 105–107
8-bit on-delay timer (TON_8
), 98–100, 102–104
8-bit oscillator timer (TOS_8
), 112–115
8-bit pulse timer (TP_8
), 108–111
8-bit up counter (CTU_8
), 126–129
8-bit up/down counter (CTUD_8
), 133–136
A
Arithmetical functions, 163
Arithmetical macros
B
allocation of edge detection variables in, 68
allocation of variables for counter macros in, 123–124
allocation of variables for timers in, 97–99
bI0 register, 14
bI1 register, 15
C
clock_out
, 22
Comparison macros
Contact and relay-based macros
ld
, 38
not
, 40
Contact bouncing, 11
eliminating problem of in PIC16F648A-based PLC, 22–31
Counter macros
definition of status bits of, 125
photograph, 3
schematic diagram of, 2
CPU section, 1
D
D latch with active high enable (latch1), 72–73
D latch with active low enable (latch0), 72, 74
data in
pin, 1
data out
pin, 9
data_out
, 22
DBNCRRED0, 28
Debouncer macros, 13–14, 25–31, 32
Debouncing, 23
DEC, 163
Decimal to BCD priority encoder, 303
Decimal to BCD priority encoder with enable input, 304, 307, 310–312
Decimal to binary coded decimal (BCD) priority encoder, 307–309
Decoder macros, examples for, 289–294
Decrement functions, 163
Demultiplexer macros
examples for, 252, 255, 258–262
Demultiplexers (DMUX), 243–244
Destination registers, shift functions in, 199–200
E
Edge detection variables, 67–68
EEPROM data memory, 4
encod_dec_bcd_p_E
, 304, 307, 310–312
Encoder macros. See Priority encoder macros
Example programs, 12
contact and relay-based macros, 59–65
demultiplexer macros, 252, 255, 258–262
multiplexer macros, 233, 235, 239–241
priority encoder macros, 312–317
shift and rotate macros, 210–224
EXNOR gate, 49
F
Falling edge detector (f_edge
), 70–71
Falling edge triggered D flip-flop (dff_f
), 77–79
Falling edge triggered JK flip-flop (jkff_f
), 86, 88–91
Falling edge triggered T flip-flop (tff_f
), 82–85
Flash program memory, 4
Flip-flop macros
Four-pole double-throw switch. See 4 PDT switch
G
H
I
I0 register, 15
I1 register, 15
ICSP capability, 1
In Circuit Serial Programming capability. See ICSP capability
INC, 163
Increment functions, 163
initialization of counter macros within, 125
initialization of time macros within, 101
Input signals, 243
Internal relays, 18
J
L
latch out
pin, 4
latch_out
, 22
ld
, 38
Least significant bit (LSB), 199
LOGIC variables, 19
Logical functions, 175
Logical macros
M
M0 register, 17
M2 register, 18
M3 register, 19
Macros. See also specific macros
contact and relay-based, 38–59
H165
, 21
Memory, 4. See also SRAM
Memory bits, 18
initial values of in Temp_2 register, 32
control scenarios for, 321–323
solutions for the control scenarios for, 323–336
Most significant bit (MSB), 199
Multiplexer macros
examples for, 233, 235, 239–241
N
Normally closed (NC) contact, 22–23
Normally open (NO) contact, 22–23
not
, 40
Number of rotation, 199
Number of shift, 199
Numerical values, comparison of, 143
O
Off-delay timer (TOF), 102, 104
On-delay timer (TON), 97–98, 101
Oscillator timer (TOS), 111–112
Output lines, 243
Outputs section, 9
P
PIC16F648-based PLC
8-bit down counter for, 129–132
8-bit off-delay timers for, 102–107
8-bit on-delay timers for, 98–102
8-bit up counters for, 126–129
8-bit up/down counters for, 132–136
control scenarios for model gate system, 321–323
oscillator timers for, 111–115
remotely controlled model gate system, 319–322
solutions for the control scenarios for model gate system, 323–336
PLC
scan cycle, 5, 9, 11–13, 19–20
PORTB, 31
Power section, 1
Priority encoder macros
encod_dec_bcd_p_E
, 304, 307, 310–312
Program examples, 12
contact and relay-based macros, 59–65
demultiplexer macros, 252, 255, 258–262
multiplexer macros, 233, 235, 239–241
priority encoder macros, 312–317
shift and rotate macros, 210–224
Programmable logic controllers. See PLC
Programming section, 1
Q
Q1 register, 17
R
RAM data memory, 4
Registers, comparison of, 143
Relay-based macros. See Contact and relay-based macros
Remotely controlled model gate system, 319–322
control scenarios for, 321–323
solutions for the control scenarios for, 323–336
Rising edge detector (r_edge
), 68–70
Rising edge triggered D flip-flop (dff_r
), 74–77
Rising edge triggered JK flip-flop (jkff_r
), 82, 85–88
Rising edge triggered T flip-flop (tff_r
), 80–82
Rotate function, 199
Rotate macros. See Shift and rotate macros
S
Scan oscillator, 19
send_outputs
, 9, 11, 13, 33–34
Shift and rotate macros
shift in bit
, 199
shift out bit
, 199
Single I/O contact debouncer, 24–25
Source registers, shift functions in, 199–200
Special memory bits, initial values of in Temp_2 register, 32
allocation of variables for counter macros in, 123–124
allocation of variables for timers in, 97–99
edge detection variables, 67–68
registers of, 31–32 (See also specific registers)
Static random-access memory. See SRAM
SUB, 163
T
Temp_1, 28
Temp_2 register, 19
initial values of special memory bits in, 32
Temporary registers, 13
Timer macros
definition of status bits of, 100
Timer registers, 20
use of with debouncer macros, 27–29
variable definitions, 17
U
Up/down counter (CTUD), 132–133
V
W
X
3.142.96.146