ABSTRACT

Most of the PLC functions make use of PLC memory locations to obtain values, store values, and track function status. The memory of the PLC is organized to hold different types of programs and data. Thus the memory in a PLC can be divided into program memory and data memory. The former is necessary to store the sequence of program instructions to perform an application. The latter is needed for dynamic data manipulation and storage while the PLC is running. The following memory-related macros are described in this chapter: “sram_read” (read one byte from SRAM), “eeprom_read” (read one byte from EEPROM to SRAM), “copy_eeprom_to_sram” (copy N bytes from EEPROM to SRAM), “eeprom_write” (write one byte from SRAM to EEPROM), “write_sram_to_eeprom” (write N bytes from SRAM to EEPROM), “prg_mem_read” (read one word from flash program memory), “copy_prgmem_to_sram” (copy N bytes from flash program memory to SRAM), “prg_mem_erase” (erase N rows of flash program memory), “write_B_sram_to_prgmem” (write bytes from SRAM to flash program memory), “write_W_sram_to_prgmem” (write words from SRAM to flash program memory), “fill_sram_N80” (fill up to eighty variables with values in a bank), and “fill_sram_N255” (fill up to 255 variables with values in SRAM). Fourteen examples are considered to show the application of the memory-related macros presented in this chapter.