diff --git a/reference/index.md b/reference/index.md index eac413b..659f668 100644 --- a/reference/index.md +++ b/reference/index.md @@ -22,8 +22,8 @@ nav: start - [Falling Trigger (F_TRIG)](standard-function-blocks/falling-trigger) - [Counter Up (CTU)](standard-function-blocks/counter-up) - [Counter Down (CTD)](standard-function-blocks/counter-down) -- Counter Up-Down (CTUD) -- Timer Pulse (TP) +- [Counter Up-Down (CTUD)](standard-function-blocks/counter-up-down) +- [Timer Pulse (TP)](standard-function-blocks/timer-pulse) - [Timer On (TON)](standard-function-blocks/timer-on) - [Timer Off (TOF)](standard-function-blocks/timer-off) diff --git a/reference/standard-function-blocks/counter-up-down.md b/reference/standard-function-blocks/counter-up-down.md new file mode 100644 index 0000000..977e55e --- /dev/null +++ b/reference/standard-function-blocks/counter-up-down.md @@ -0,0 +1,14 @@ +--- +layout: inset +title: Counter Up-Down +--- + +## Introduction + +The up-down counter can be used to both increment and decrement the same counter variable `CV`. +A pulse on the reset input `R` resets the value of `CV` to 0. +A pulse on the maximum value `PV` will initialize `CV` to `PV`. +Each time the input `CU` is set to `TRUE`, `CV` is incremented by 1, provided that `CV` is less than the maximum value `PV`. +Each time the input `CD` is set to `TRUE`, `CV` is decremented by 1, provided that `CV` is greater than 0. +The output `QU` is set to `TRUE` when `CV` is greater than or equal to `PV`. +The output `QD` is set to `TRUE` when `CV` is is less than or equal to 0. diff --git a/reference/standard-function-blocks/rs-bistable.md b/reference/standard-function-blocks/rs-bistable.md index 67e49a0..ce4c500 100644 --- a/reference/standard-function-blocks/rs-bistable.md +++ b/reference/standard-function-blocks/rs-bistable.md @@ -8,3 +8,48 @@ title: RS Bistable This function block maintains its output in one of two stable states `TRUE` or `FALSE`. The output can be set or reset by applying a `TRUE` signal to the `Set` or `Reset` inputs. If both inputs are `TRUE` the output is `FALSE`. + +![](rs-symbol.png) + +## VAR_INPUT + +``` +VAR_INPUT + S : BOOL; + R1 : BOOL; +END_VAR +``` + +## VAR_OUTPUT + +``` +VAR_OUTPUT + Q1 : BOOL; +END_VAR +``` +Internal implementation: + +``` +Q1 := (NOT R1) AND (S OR Q1); +``` + +## Pinout Description + +| Pin Name | Signal | Data Type | Description | +|------------|--------|-----------|----------------------------------------------------------------| +| `S` | Input | `BOOL` | Set. This input puts the output in `TRUE` state. | +| `R1` | Input | `BOOL` | Reset (dominant). This input puts the output in `FALSE` state. | +| `Q1` | Output | `BOOL` | Q. This is the output. | + +## Truth Table + +| S | R1 | Q1 | Description | +|---|----|----------------|--------------------------------| +| 0 | 0 | Q-1 | Q retains its previous state | +| 0 | 1 | 0 | Q is `FALSE` | +| 1 | 0 | 1 | Q is `TRUE` | +| 1 | 1 | 0 | Q is `FALSE` | + +## Time Diagram + +![](rs-time-diagram.png) diff --git a/reference/standard-function-blocks/rs-symbol.png b/reference/standard-function-blocks/rs-symbol.png new file mode 100644 index 0000000..e2fb04a Binary files /dev/null and b/reference/standard-function-blocks/rs-symbol.png differ diff --git a/reference/standard-function-blocks/rs-time-diagram.png b/reference/standard-function-blocks/rs-time-diagram.png new file mode 100644 index 0000000..3f06405 Binary files /dev/null and b/reference/standard-function-blocks/rs-time-diagram.png differ diff --git a/reference/standard-function-blocks/sr-bistable.md b/reference/standard-function-blocks/sr-bistable.md index 8e220fc..a9bed8d 100644 --- a/reference/standard-function-blocks/sr-bistable.md +++ b/reference/standard-function-blocks/sr-bistable.md @@ -8,3 +8,48 @@ title: SR Bistable This function block maintains its output in one of two stable states `TRUE` or `FALSE`. The output can be set or reset by applying a `TRUE` signal to the `Set` or `Reset` inputs. If both inputs are `TRUE` the output is `TRUE`. + +![](sr-symbol.png) + +## VAR_INPUT + +``` +VAR_INPUT + S1 : BOOL; + R : BOOL; +END_VAR +``` + +## VAR_OUTPUT + +``` +VAR_OUTPUT + Q1 : BOOL; +END_VAR +``` +Internal implementation: + +``` +Q1 := S1 OR ((NOT R) AND Q1); +``` + +## Pinout Description + +| Pin Name | Signal | Data Type | Description | +|----------|--------|-----------|----------------------------------------------------------------| +| `S` | Input | `BOOL` | Set. This input puts the output in `TRUE` state. | +| `R1` | Input | `BOOL` | Reset (dominant). This input puts the output in `FALSE` state. | +| `Q1` | Output | `BOOL` | Q. This is the output. | + +## Truth Table + +| S1 | R | Q1 | Description | +|----|---|----------------|--------------------------------| +| 0 | 0 | Q-1 | Q retains its previous state | +| 0 | 1 | 0 | Q is `FALSE` | +| 1 | 0 | 1 | Q is `TRUE` | +| 1 | 1 | 1 | Q is `TRUE` | + +## Time Diagram + +![](sr-time-diagram.png) diff --git a/reference/standard-function-blocks/sr-symbol.png b/reference/standard-function-blocks/sr-symbol.png new file mode 100644 index 0000000..027226d Binary files /dev/null and b/reference/standard-function-blocks/sr-symbol.png differ diff --git a/reference/standard-function-blocks/sr-time-diagram.png b/reference/standard-function-blocks/sr-time-diagram.png new file mode 100644 index 0000000..1fef4c3 Binary files /dev/null and b/reference/standard-function-blocks/sr-time-diagram.png differ diff --git a/reference/standard-function-blocks/timer-pulse.md b/reference/standard-function-blocks/timer-pulse.md new file mode 100644 index 0000000..41ab81a --- /dev/null +++ b/reference/standard-function-blocks/timer-pulse.md @@ -0,0 +1,10 @@ +--- +layout: inset +title: Timer Pulse +--- + +## Introduction + +The pulse timer can be used to generate pulses with a defined duration. +If the input `IN` is set to `TRUE`, the output `Q` also becomes `TRUE` for the duration of the pulse time `PT`. +`Q` remains `TRUE` until the current time `ET` reaches `PT`, regardless of the state of `IN`.