An Automatic Temperature Control System Using RZK

Similar documents
Zilog Real-Time Kernel

EEPROM Emulation with the ez80f91 MCU. Discussion

Zilog TCP/IP Software Suite

Character LCD Interface for ez80acclaim! MCUs

ZiLOG Real-Time Kernel Version 1.2.0

Set Up a PLL Loop Filter on the ez80f91 MCU

ez80f91 Modular Development Kit

Flash Loader Utility for the Z8 Encore! XP MCU

Interfacing Z8 Encore! XP MCUs with an I 2 C-Based Character LCD

Using an ez80 Flash Memory File System

ez80190 Development Kit Quick Start Guide

Challenge. Hardware Circuit Details. Solution. Result. Features and Functions. Z8 Encore! MC

ZCRMZNICE01ZEMG Crimzon In-Circuit Emulator

S3 Flash In-System Programmer

Z8 Encore! XP F0822 Series

Ethernet Smart Cable

Z8 Encore! XP/Z8 Encore! Development Kits

High Resolution Digital Weigh-Scale Design Using Z8 Encore! Microcontrollers

Zatara Series ARM ASSP High-Performance 32-bit Solution for Secure Transactions

A Simple Console Application for Z8 Encore! XP MCUs

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680

Boot Loader for the Z51F6412 MCU

Universal Motor Control with Z8 Encore! XP 8-Pin Highly Integrated Microcontroller

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus

ez80 Family of Microprocessors Zilog File System User Manual UM Copyright 2007 by Zilog, Inc. All rights reserved.

Z8 Encore! XP F1680 Series 8-Bit Flash Solution with Extended Peripherals

Z8 Encore! XP Family of Microcontrollers Development Kits

5x7 LED Matrix Display with Z8 Encore! XP

ZLF645 Crimzon Flash Microcontroller with ZBase Database Industry Leading Universal Infrared Remote Control (UIR) Solution

Z8 Encore! XP 4K Series with extended Peripherals

ZMOTION Detection Module Development Kit

High-Performance 8-Bit Microcontrollers. Up to 8 10-Bit ADC Channels. Two 16-Bit Timers/PWM. Internal Precision Oscillator

S3F8S5A Development Kit

Z8 Encore! Z8F642 MCU Evaluation Kit

Using the Z8051 MCU s USI Peripheral as an SPI Interface

Serial Communication Controllers (SCC) MULTIPROTOCOL DATA COMMUNICATION SOLUTIONS

Z8 Encore! XP F0822 Series Development Kit

ez80f92/f93 Product Brief

BOOST YOUR SYSTEM PERFORMANCE USING THE ZILOG ESCC CONTROLLER

ez80f92 Development Kit

Product Update. Errata to Z8 Encore! 8K Series Silicon. Z8 Encore! 8K Series Silicon with Date Codes 0402 and Later

ez80 Webserver Write your own EMAC Driver for Metro IPWorks

Quick Start Guide for TWR-S08MM128-KIT TOWER SYSTEM MC9S08MM128. The industry s most complete solution for portable medical applications

CodeWarrior Development Studio for Freescale 68HC12/HCS12/HCS12X/XGATE Microcontrollers Quick Start SYSTEM REQUIREMENTS Hardware Operating System 200

Nuvoton 1T 8051-based Microcontroller NuTiny-SDK-N76E885 User Manual

ez80f91 Development Kit

EPIC board ensures reliability in the toughest environment

USB / Ethernet Production Ready Module

Stellaris Robotic Evaluation Board and Micriµm µc/os-iii

Kinetis KE1xF512 MCUs

TEVATRON TECHNOLOGIES PVT. LTD Embedded! Robotics! IoT! VLSI Design! Projects! Technical Consultancy! Education! STEM! Software!

A scalable approach to your body, networking and security platforms. Description

Controller Continuum. for Microcontrollers V6.3. Quick Start

Kinetis SDK Freescale Freedom FRDM-KL03Z Platform User s Guide

UnRegistered MB39C602 LED LIGHTING SYSTEM BULB 9W ZIGBEE CONTROL USER MANUAL. Fujitsu Semiconductor Design (Chengdu) Co. Ltd.

AD5669R - Microcontroller No-OS Driver

ATAES132A Firmware Development Library. Introduction. Features. Atmel CryptoAuthentication USER GUIDE

The industrial technology is rapidly moving towards ARM based solutions. Keeping this in mind, we are providing a Embedded ARM Training Suite.

SAMA5D2 Quad SPI (QSPI) Performance. Introduction. SMART ARM-based Microprocessor APPLICATION NOTE

BASICS OF THE RENESAS SYNERGY PLATFORM

Nuvoton 4T 8051-based Microcontroller NuTiny-SDK-N78E715 User Manual

CHAPTER 3 WIRELESS MEASUREMENT INSTRUMENT

AT09381: SAM D - Debugging Watchdog Timer Reset. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

XE 900: Fastest EPIC board now available with Windows XPe

STSW-BLUENRG1-DK. BlueNRG-1, BlueNRG-2 DK SW package

SPC584Cx, SPC58ECx. 32-bit Power Architecture microcontroller for automotive ASIL-B applications. Features

FM3. MB9B500 Series 32-BIT MICROCONTROLLER FSS MB9BF506R EV-BOARD USER MANUAL APPLICATION NOTE FUJITSU SEMICONDUCTOR (SHANGHAI) LIMITED

Chapter 4. Enhancing ARM7 architecture by embedding RTOS

AN5181. Building a thermometer using the STM8 Nucleo-64 boards. Application note. Introduction

PC87435 Enhanced IPMI Baseboard Management Controller

AN3996 Application Note

MOD5270-LC Quick Start Guide. NetBurner, Inc

SPC58NE84E7, SPC58NE84C3

AT89C5131 Starter Kit... Software User Guide

2 Principal Architect EDU,QuEST Global, Thiruvananthapuram

USB-to-I2C Basic. Hardware User s Manual.

Description SPC564A-DISP. March 2014 DocID Rev 3 1/5

STM32SnippetsL0. STM32L0xx Snippets firmware package. Features. Description

INTRODUCTION. Mechanical Considerations APPLICATION NOTE Z86E21 THERMAL PRINTER CONTROLLER ZILOG

Intel Dialogic CPi/200B2 and CPi/400B2 Fax Boards

CoiNel Technology Solutions LLP. LPC2148 ARTIST Instruction Manual LPC2148 ARTIST. Instruction manual. Revision 1

BASICS OF THE RENESAS SYNERGY PLATFORM

EVALKITSTKNX. Miniature transceiver STKNX evaluation and development kit. Features

LBAT90USB162 Atmel. LBAT90USB162 Development Board User s Manual

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE

LPC2148 DEV BOARD. User Manual.

STAND-ALONE PROGRAMMER

XE166 Family AP Application Note. Microcontrollers. UConnect XE162N Hardware Description V1.0,

)8-,768'HY.LW 2YHUYLHZ. )XMLWVX0LNURHOHNWURQLN*PE+ Am Siebenstein Dreieich-Buchschlag, Germany

M16C R8C FoUSB/UART Debugger. User Manual REJ10J

USB Debug Adapter. Power USB DEBUG ADAPTER. Silicon Laboratories. Stop. Run. Figure 1. Hardware Setup using a USB Debug Adapter

BIOS Update Release Notes

FOR IOT PRODUCT DEVELOPMENT

Ethernet1 Xplained Pro

embos Real-Time Operating System embos plug-in for IAR C-Spy Debugger Document: UM01025 Software Version: 3.0 Revision: 0 Date: September 18, 2017

This user guide describes how to run the Atmel ATWINC3400 Bluetooth Low Energy (BLE) Provisioning demo from out-of-box conditions.

Mercury System SB310

SPC58EHx,SPC58NHx. A scalable approach for high-end body, networking and security platforms for Automotive. Description. Features

Getting started with STEVAL-IDB007V1 and STEVAL-IDB008V1 evaluation boards

USB I 2 C Interface Board Reference Manual

Transcription:

Application Note An Automatic Temperature Control System Using RZK AN019902-0908 Abstract This application note demonstrates how an application running on Zilog s Real-Time Kernel (RZK) can be used to control various devices to maintain a temperature. This temperature control application reads a value from a temperature sensor and determines when to switch a fan or bulb off or on according to minimum and maximum temperature limit settings. These settings can be changed using upper and lower limit set switches. The limit settings and the current temperature are displayed on an LCD panel. Note: RZK Overview The source code file associated with this application note, AN0199- SC01.zip is available for download at www.zilog.com. The RZK is a real-time, preemptive, multitasking kernel designed for time-critical embedded applications. It can be used with Zilog s ez80acclaim! family of microcontroller unit (MCU) and microprocessors. A real-time multitasking kernel also called a realtime operating system (RTOS) is a software that ensures that time-critical events are processed efficiently. The use of an RTOS generally simplifies the design process of a system by allowing the application to be divided into multiple independent elements called tasks. The RZK functional architecture is configurable, scalable, and modular in design, and provides a rich set of features and easy-to-use APIs. RZK features are tuned to the stringent memory and performance requirements of the 8-bit domain. RZK is compact with minimal footprint and can be accommodated in the Flash area of the target processor. RZK allows rapid context switching between Threads, in addition to offering quick interrupt responses. It features preemptive, priority-based, multitasking scheduler. It also provides timing support for delays, time-outs, and other periodic events. You can take advantage of RZK's time-slicing option with adjustable time slices. In addition to various configuration options, RZK provides priority inheritance facility. RZK Objects RZK objects used for real-time application development are Threads, message queues, event groups, semaphores, Timers, partitions and regions (memory objects), and interrupts. RZK objects use the kernel services for resource management and provide a set of APIs as an interface to the application. Based on its requirements, an application can use the objects optionally. This application note focuses on the use of RZK s Threads. Features of RZK Copyright 2008 by Zilog, Inc. All rights reserved. www.zilog.com

Thread Control APIs Thread APIs are used to create Threads and perform the following operations on a created Thread: Suspend a Thread finitely or infinitely Resume a Thread that suspends infinitely Delete a Thread Change the priority of a Thread Yield control to other Threads Get Thread parameters For more information about RZK, refer to the Zilog Real-Time Kernel Reference Manual (RM0006), available for download at www.zilog.com. It is also available along with RZK software. ez80acclaim! Overview ez80acclaim! on-chip Flash Microcontrollers are an exceptional value for designing high-performance, 8-bit MCU-based systems. Its possible to obtain performance necessary to execute complex applications quickly and efficiently with speed up to 50 MHz and an on-chip Ethernet MAC (ez80f91 MCU only). Combining Flash and SRAM, ez80acclaim! devices provide the memory required to implement communication protocol stacks and achieve flexibility when performing insystem updates of application firmware. ez80acclaim! Flash MCUs can operate in full 24- bit linear mode, addressing 16 MB without a Memory Management Unit (MMU). Additionally, support for the Z80 compatible mode allows you to execute Z80/Z180 devices legacy code within multiple 64 KB memory blocks with minimum modification. With an external bus supporting ez80, Z80, Intel, and Motorola bus modes and a rich set of serial communication peripherals, there are several options when interfacing to external devices. home and building automation, communications, industrial control and facility monitoring, and remote control. Discussion This section provides the hardware and software implementation details for developing the automatic temperature control system using RZK. Hardware Architecture Figure 1 is a block diagram of the hardware architecture featuring the ez80f91 Development Board. It has a temperature sensor for reading temperature, fan for cooling the sensor, bulb for heating the sensor, switches for setting the upper and lower temperature limits, and the Character LCD module for displaying the current temperature, upper, and lower limit. 2 2 I C Temperature Sensor SW1 SW2 SW3 I C Bus ez80f91 MCU Data Bus LCD Display (16x2) Fan Bulb Figure 1. Hardware Block Diagram of an Automatic Temperature Control System Using RZK Some of the applications suitable for ez80acclaim! devices include vending machines, point-of-sale (POS) terminals, security systems, AN019902-0908 Page 2 of 9

Figure 2 displays the connections between the ez80f91 MCU and a thermostat board. The data bus is connected to the Character LCD Module. Port pins PB0, PB1, and PB2 are connected to switches SW1, SW2, and SW3. Pins PB3 and PB7 are connected to the lamp and fan respectively. The MAX6625 temperature sensor is connected to the I 2 C bus. Data Bus Character LCD Module PB2 PB1 ez80f91 MCU PB0 SW1 SW2 SW3 PB7 SDA SCL MAX 6625 Fan Lamp PB3 Evaluation Board Thermostat Board Figure 2. Connection Between the ez80f91 Development Platform and the Thermostat Board AN019902-0908 Page 3 of 9

Software Implementation The software implementation for the automatic temperature control system provides the functionality to maintain a temperature within a specified limit. The main functions provided by this application are listed below: Automatic fan ON/OFF Automatic bulb ON/OFF Set lower and upper limits by pressing a switch Read a temperature from a temperature sensor Display the current temperature and the lower and upper limits on LCD Complete functionality is managed by the following four functions, in order of priority from high (#1) to low (#4): 1. RZKTempReadTask (4) 2. TempControlTask (8) 3. TempDisplayTask (12) 4. RZKKeyControlTask (16) These functions are executed according to their priority. The automatic ON/OFF of the bulb and fan, and the setting of the lower and upper limits is controlled by the TempControlTask. If the temperature read by RZKTempReadTask is greater than the set upper limit, then this task switches off the bulb and switches on the fan. If the read temperature is lower then the set limit, RZKTempRead- Task switches the bulb on and switches off the fan. RZKTempReadTask() This function reads the current temperature from I 2 C temperature sensor. TempControlTask() This function perform the following functions: 1. Set the upper and lower limit. 2. Upload the current temperature, upper, and lower limit to display array. 3. Compare the upper and lower set limit with current temperature and Switch ON/OFF the fan/bulb accordingly. TempDisplayTask() This function reads and updates the temperature on LCD display. It displays the current temperature, lower, and upper limit of temperature. The main operations performed by this function are read display buffer and update the display with current temperature with lower and upper limit RZKKeyControlTask() This function scans the switches for setting the lower and upper limit of temperature. The main operations performed by this function are: 1. Scan the switches. 2. If switch SW1 is pressed, decrease the lower limit (LL). 3. If switch SW2 is pressed, decrease the upper limit (UL). 4. If switch SW1 and SW3 are pressed, increase the lower limit (LL). 5. If switch SW2 and SW3 are pressed, increase the upper limit (UL). RZKApplicationEntry() In addition to the four tasks described above, this fifth RZK function is the main entry point for any application into RZK. The application program entry function performs the following operations: 1. Initializes all peripherals. 2. Creates a function for reading the temperature from the I 2 C temperature sensor, controlling the temperature within a specified limit, and displaying the current temperature and limits on the LCD panel. 3. Resumes all functions. AN019902-0908 Page 4 of 9

Adding an Application Project to a Standard RZK Kernel This section describes adding the automatic temperature control system project to the standard RZK kernel. RZK software is available for download at www.zilog.com and can be downloaded to a PC upon user registration. RZK can be installed in any location as specified from its default location C:\Program Files\Zilog Follow the steps below to add the demo files to the RZK directory: 1. Download RZK. Browse to the location where RZK is downloaded. Open the..\ez80f91\sample Programs folder. 2. Download the AN0199-SC01.zip file and extract its contents to a folder on your PC. Note that there is a folder labelled \ATCS within the extracted folder. 3. Copy this \ATCS folder to the..\ez80f91\sample Programs folder. Note that there are two folders within the \ATCS folder. These folders are: \IntFlash, which contains the ATCS.pro file to be downloaded into the MCU s internal Flash memory. \RAM, which contains the ATCS.pro file to be downloaded into the MCU s RAM memory. 4. Launch ZDS II and open the project file ATCS.pro, which is located in the following filepath:..\ez80f91\sample Programs \ ATCS \IntFlash or RAM Testing This section describes how the automatic temperature control system application can be tested. Test Setup Figure 3 displays the connection between a PC, a LAN/WAN, and the ez80 Development Platform. PC RS232 Ethernet Figure 3. Test Setup for an Automatic Temperature Control System Using RZK Equipment Used ez80f91 Development Kit HyperTerminal Settings Set the HyperTerminal application to reflect the following values: 57.6 kbps 8 N 1 protocols A flow control of none J3 ZPAK II P1 4-Port Hub LAN/WAN Ethernet Ethernet J4 ZDI R ez80 Development Platform P2 Note: Do not modify any of the project settings in any of the project files. AN019902-0908 Page 5 of 9

Test Procedure Follow the steps below to connect the hardware and build your project: 1. Connect the ez80 Development Platform via the ZPAK II unit to the PC and to the Ethernet as displayed in Figure 3 on page 5. 2. To prepare for downloading the program, open HyperTerminal to set the IP address for ZPAK II. 3. Hold down the Z key and press the Reset button on the ez80 Development Platform to launch the menu for setting the IP address. Follow the menu instructions to set the IP address for ZPAK II. 4. Launch ZDS II for ez80 Acclaim! v4.7.0. Open the RTC project located in the either of the following two filepaths: \\RZK 1.0.0\eZ80F91\Sample Programs\ATCS\RAM\ATCS.pro \\RZK 1.0.0\eZ80F91\Sample Programs\ATCS\Flash\ATCS.pro 5. Build the project and download it to the ez80f91 MCU using ZDS II. 6. Run the project. 7. Observe the temperature on the LCD display. Changing the Lower and Upper Limits To change the lower limit, follow these instructions: 1. Press switch SW1 to decrease the lower limit on the ez80 Development Platform. 2. Press switches SW1 and SW3 simultaneously to increase the lower limit. To change the upper limit, follow these instructions: 1. Press switch SW2 to decrease the upper limit on the ez80 Development Platform. 2. Press switches SW2 and SW3 simultaneously to increase the upper limit. Test Results The Automatic Temperature Control System application successfully runs on the ez80f91 MCU, by setting the upper and lower limits functions satisfactorily. Summary This application note highlights the capability of RZK to control devices such as a fan or a bulb and read a temperature through the I 2 C bus on the ez80f91 MCU. There are four functions running in an infinite loop to control the entire operation. This embedded control system can be used to control heavy motors, heaters, and other devices used in control systems. References The documents associated with ez80f91 MCU, ez80acclaim!, ZTP/RZK, and ZDS II IDE available on www.zilog.com are provided below: ez80f91 MCU Product Specification (PS0192) Zilog Developer Studio II ez80acclaim! User Manual (UM0144) RZK Developer s Kit Quick Start Guide (QS0027) Zilog Real-Time Kernel User Manual (UM0075) Zilog Real-Time Kernel Reference Manual (RM0006) ez80 CPU User Manual (UM0077) AN019902-0908 Page 6 of 9

Appendix A Flowchart This appendix lists flowcharts for the application entry and key scan tasks performed in the automatic temperature control system implementation described in this application note. Figure 4 displays the flow for the application entry Thread/function. Start Initialize devices Keypad interface 2 I C temperature sensor LCD interface Create task Key control task Read temperature task Temperature control Temperature display task Resume task End Figure 4. Application Entry Thread Flow AN019902-0908 Page 7 of 9

Figure 5 displays the flow of the key scan tasks. Start Set key flag Is SW1 pressed? Yes Decrease lower limit No Is SW2 pressed? Yes Decrease upper limit No Are SW1 and SW3 pressed? Yes Increase lower limit No Are SW2 and SW3 pressed? Yes Increase upper limit No Reset key flag End Figure 5. Key Scan Task Flow AN019902-0908 Page 8 of 9

Warning: DO NOT USE IN LIFE SUPPORT LIFE SUPPORT POLICY ZILOG'S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROVAL OF THE PRESIDENT AND GENERAL COUNSEL OF ZILOG CORPORATION. As used herein Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b) support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury to the user. A critical component is any component in a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system or to affect its safety or effectiveness. Document Disclaimer 2008 by Zilog, Inc. All rights reserved. Information in this publication concerning the devices, applications, or technology described is intended to suggest possible uses and may be superseded. ZILOG, INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY OF THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT. ZILOG ALSO DOES NOT ASSUME LIABILITY FOR INTELLECTUAL PROPERTY INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this document has been verified according to the general principles of electrical and mechanical engineering. ez80, Z80, and ez80acclaim! are registered trademarks of Zilog, Inc. All other product or service names are the property of their respective owners. AN019902-0908 Page 9 of 9 9