Memory Regions¶
PiPLC uses word-based (32-bit) memory organized into seven regions, following traditional PLC conventions.
Region Summary¶
| Region | Address Format | Data Type | Size | Description |
|---|---|---|---|---|
| Input | I:word/bit | BOOL | 8 words × 32 bits | Physical inputs |
| Output | O:word/bit | BOOL | 8 words × 32 bits | Physical outputs |
| Internal | B:word/bit | BOOL | 64 words × 32 bits | Internal relays |
| Integer | N:word | INT32 | 256 words | Integer storage |
| Timer | T:word | TimerData | 64 timers | Timer accumulators and status |
| Counter | C:word | CounterData | 64 counters | Counter accumulators and status |
| Interval | V:word | IntervalData | Dynamic | Interval timer persistent state |
Address Formats¶
Bit Addresses (I:, O:, B:)¶
Format: REGION:word/bit
I:0/0— Input word 0, bit 0O:1/3— Output word 1, bit 3B:5/15— Internal bit word 5, bit 15
Word and bit numbers are zero-indexed. Bit range is 0–31.
Integer Addresses (N:)¶
Format: N:word
N:0— Integer word 0N:255— Integer word 255
Values are 32-bit signed integers (range: −2,147,483,648 to 2,147,483,647).
Timer Addresses (T:)¶
Format: T:word or T:word.subelement
| Address | Description |
|---|---|
T:0 | Timer 0 (full structure) |
T:0.PRE | Preset value |
T:0.ACC | Accumulated value |
T:0.DN | Done bit |
T:0.TT | Timer Timing bit |
T:0.EN | Enable bit |
Counter Addresses (C:)¶
Format: C:word or C:word.subelement
| Address | Description |
|---|---|
C:0 | Counter 0 (full structure) |
C:0.PRE | Preset value |
C:0.ACC | Accumulated value |
C:0.DN | Done bit |
C:0.OV | Overflow bit |
C:0.UN | Underflow bit |
C:0.CU | Count Up enable bit |
C:0.CD | Count Down enable bit |
Interval Addresses (V:)¶
Format: V:word
V:0— Interval 0V:1— Interval 1
Used by the INTERVAL instruction for persistent timing state. Tracks when the interval started, when it last triggered, and the configured period (days/hours/minutes). State survives PLC restarts.