beautypg.com

Setting flash option bytes in c – Zilog Z8F0130 User Manual

Page 232

background image

Using the ANSI C-Compiler

UM013037-1212

208

Zilog Developer Studio II – Z8 Encore!
User Manual

void main(void)

{

if (color == RED)

status = FIXED;

else

status = OPEN;

}

Setting Flash Option Bytes in C

The Z8 Encore! CPU provides up to two Flash option bytes to configure the device. These
Flash option bytes can be set in C, using the following syntax:

#include

FLASH_OPTION1 = val;

FLASH_OPTION2 = val;

In the above syntax example:

FLASH_OPTION1 is the Flash option byte at address 0

FLASH_OPTION2 is the Flash option byte at address 1

The following code provides an additional example:

#include

FLASH_OPTION1 = 0xFF;

FLASH_OPTION2 = 0xFF;

void main (void)

{

}

This example sets the Flash option bytes at addresses 0 and 1 as

0xFF

. The Flash option

bytes can be written only once in a program. They are set at load time. When you set these
bytes, you must make sure that the settings match the actual hardware.

Program RAM Support (Z8 Encore! XP 16K Series Only)

The Z8 Encore! XP 16K Series devices have additional RAM that can optionally be used
as Program RAM (PRAM). The Z8 Encore! C-Compiler provides syntax to place code for
a function in PRAM. This feature can be useful for keeping device power consumption
low by arranging that frequently activated code be placed in PRAM so that the main body
of code, which often only must be executed at rare intervals, remains in the more power-
intensive Flash memory.