> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/en/hvac-alarm-library/funktionsbausteine/fifo.md).

# FIFO

## `FIFO` (FB)

FUNCTION\_BLOCK FIFO

FIFO is a First-In First-Out memory with x storage locations for INT data. The two outputs xEmpty and xFull indicate when the memory is empty or full. The input xReset clears the entire contents of the memory. The FIFO is written with an INT by setting TRUE on the xWrite input. A read command is executed by setting TRUE on xRead. Reading and writing can be performed simultaneously in one cycle. The block reads or writes in every cycle. The FIFO can be controlled via 3 methods mRead, mWrite, mReset.

InOut:

| Scope  | Name           | Type           | Comment                              |
| ------ | -------------- | -------------- | ------------------------------------ |
| Input  | `iDataIn`      | `INT`          | Data to write into the FIFO          |
| Input  | `xRead`        | `BOOL`         | Read control                         |
| Input  | `xWrite`       | `BOOL`         | Write control                        |
| Input  | `xReset`       | `BOOL`         | Reset control                        |
| Input  | `aiFifoBuffer` | POINTER TO INT | FIFO with x slots                    |
| Output | `iDataOut`     | `INT`          | Data from the FIFO that were read    |
| Output | `xEmpty`       | `BOOL`         | xEmpty = TRUE means: memory is empty |
| Output | `xFull`        | `BOOL`         | xFull = TRUE means: memory is full   |
| Output | `diDataNumber` | `DINT`         | Number of data items in the FIFO     |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://support.powerio.com/hub/codesys-hvac/en/hvac-alarm-library/funktionsbausteine/fifo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
