The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

Ref: DOC-ST-REALIZER-II LIFE SUPPORT DEVICES SYSTEMS MUST EXPRESS


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



ST-Realizer
Ref: DOC-ST-REALIZER-II
LIFE SUPPORT DEVICES SYSTEMS MUST EXPRESSLY AUTHORIZED. STMicroelectronics PRODUCTS AUTHORIZED CRITICAL COMPONENTS LIFE SUPPORT DEVICES SYSTEMS WITHOUT EXPRESS WRITTEN APPROVAL STMicroelectronics. used herein: Life support devices systems those which intended surgical implant into body, support sustain life, whose failure perform, when properly used accordance with instructions provided with product, reasonably expected result significant injury user. critical component component life support device system whose failure perform reasonably expected cause failure life support device system, affect safety effectiveness.
TABLE CONTENTS
INSTALLING ST-REALIZER What Need Install ST-Realizer Installation Procedure Folders Sub-folders
INTRODUCTION CONCEPTS ST-Realizer Application Structures Programming using Symbols Inside ST-Realizer Applications Symbols 2.4.1 State Machine Symbols Schemes 2.5.2 Root Scheme 2.5.3 Subschemes Events 2.6.4 Execution Conditions 2.6.5 Event Symbols ST-Realizer Keeps Track Time Connecting your Application Target Device Application Development Steps
TUTORIAL Setting Your Project 3.1.1 Creating Project File 3.1.2 Choosing Target Microcontroller 3.1.3 Opening Main Scheme 3.1.4 Worksheet Toolbar Designing Drawing Schemes 3.2.5 State Machine Diagram Completing Heating Control Application 3.3.6 What differentiates main scheme from subscheme? 3.3.7 External Input Conditions 3.3.8 Internal Input Conditions 3.3.9 External Actions
Table Contents
3.3.10 3.3.11 3.3.12 3.3.13
Creation Subscheme Internal Event-Driven Action Connecting Hardware Ports Peripherals Event Control Summary
Analysing Generating Program Code 3.4.14 Setting Compile Options 3.4.15 Executing Analysis Compile 3.4.16 Viewing Analyse Compile Report Simulating Fine-Tuning Your Application 3.5.17 Creating Simulation Environment File (.sef) 3.5.18 Connecting Probes Adjusters 3.5.19 Running Simulator it's You! CREATING, OPENING SAVING PROJECTS Project Files Creating Project Opening Existing Project Opening Earlier Realizer Version Projects Closing Project Saving Projects SPECIFYING TARGET HARDWARE DEVICE Devices Choosing Target Microcontroller 5.2.1 Selecting Target Microcontroller Project 5.2.2 Changing Target Microcontroller Hardware Configuration 5.3.3 Accessing Hardware Settings Dialog Boxes 5.3.4 General Hardware Configuration 5.3.5 Memory Configuration 5.3.6 Enabling Peripherals CREATING, OPENING, SAVING SCHEMES Schemes Creating Scheme 6.2.1 Opening Root Scheme 6.2.2 Creating Subschemes other Schemes Opening Scheme Saving Schemes
Table Contents
BUILDING SCHEMES Schemes their Components Symbols 7.2.1 Placing Controlling Symbols 7.2.2 Wiring Symbols Together Connecting Application Inputs/Outputs Working Schemes Subschemes, Execution Conditions Events 7.4.3 Description ST-Realizer Events 7.4.4 Execution Conditions 7.4.5 Event Symbols 7.4.6 Compatibilities Between Types Events Certain Symbols 7.4.7 Subscheme Operations Table Symbols
MAIN SYMBOL LIBRARY Input Output Symbols Sequential Symbols Logic Symbols Time Related Symbols Mathematical Symbols Counter Symbols Conversion Symbols Table Symbols Power Management 8.10 Constant Symbols 8.11 State Machine Symbols 8.12 Hierarchical Sheet Symbols 8.13 Title Symbols
ANALYSING GENERATING YOUR APPLICATION Overview Changing Compile Options Executing Analysis Compile What there Errors Found during Analyse Viewing Tracing Generated Messages 9.5.1 Viewing Analyse Compile Report
Table Contents
Printing Reports SIMULATING YOUR APPLICATION 10.1 Working with Simulation Environment Files 10.1.1 Creating .sef File 10.1.2 Opening Existing .sef File 10.1.3 Saving .SEF File 10.2 Setting, Adjusting Viewing Input Values 10.2.4 Setting Fixed Input Values 10.2.5 Setting Variable Input Values 10.2.6 Setting Sinusoidal Input Signals 10.2.7 Setting Square Wave Input Signals 10.3 Monitoring Signals with Probes 10.3.8 Viewing Signal Values Numerically 10.3.9 Viewing Signal Values Graphically 10.3.10 Viewing State Machine States 10.4 Selecting Adjusters Probes 10.5 Running Simulator 10.5.11 Starting/Stopping Simulation 10.5.12 Setting Options 10.6 Recording Reusing Adjuster Probe Values 10.6.13 Recording Adjuster Probe Values 10.6.14 Reusing Adjuster Values CREATING YOUR SYMBOL 11.1 Overview 11.2 Running Symbol Editor 11.3 Defining Subscheme Symbol 11.3.1 Adding Your Subscheme Symbol Library 11.4 Defining User-Defined Symbol 11.4.1 Defining Symbol 11.4.2 Editing Symbol 11.4.3 Adding Pins Your Symbol 11.4.4 Assigning Attributes Your Symbol 11.4.5 Modifying Existing Attributes 11.4.6 Creating Macro Header 11.4.7 Creating User-Defined Symbol Macro 11.4.8 Writing Assembly Macro 11.4.9 Adding User-Defined Symbols Library
Table Contents
CUSTOMIZING ST-REALIZER 12.1 Automatically Saving Your Work Setting Screen Preference. 12.2 Attribute Display Preferences 12.3 Worksheet Layout Preferences 12.4 Printing Options 12.5 Symbol Layout Preferences 12.6 Customizing Toolbars 12.6.1 Adding Deleting Toolbar Buttons 12.6.2 Placing Separators Between Toolbar Buttons 12.6.3 Changing Order Toolbar Buttons 12.6.4 Restoring Default Toolbar 12.7 Wire Drawing Options Appendix A:Variables Attributes Variable Types Rules A1.1 Type Inheritance A1.2 Type Overruling Attribute Types A2.1 Attributes. A2.2 Symbol Attributes
Appendix B:Sample Applications Coded B1.1 B1.2 B1.3 B1.4 B1.5 Lock Application Application Overview Functional Description Sequencing Control Secret Code Storage EEPROM Access Code Entry Recognition
Analog Multiple Decoder B2.1 Application Overview B2.2 Keyboard B2.3 Software Generation B2.4 Possible Improvements. Clock Design B3.1 Application Overview B3.2 Current Time Counting B3.3 Current Time Setup. B3.4 Alarm Time Setup B3.5 Alarm triggering. B3.6 Timebase
Table Contents
B3.7 B3.8 B3.9
Current Time Counting Current Time Setup. Alarm Time Setup
Fast Counter Application B4.1 Application B4.2 Fast Counter Report File. B4.3 Generated Code
INDEX
viii
Chapter
What Need Install ST-Realizer
INSTALLING ST-REALIZER
What Need Install ST-Realizer must install ST-Realizer that meets following requirements: Table Hardware Requirements
Minimum requirements Processor: Intel®80486 RAM: Disk memory: Monitor: Grey scale Mouse Optimum Performance Processor: Intel® Pentium-100 RAM: Disk memory: Monitor: Super-VGA, Mouse
ST-Realizer runs under Microsoft® Windows® NT®. Installation Procedure Boot your under Windows. ST-Realizer CD-ROM your CD-ROM drive. CD-ROM's autorun function will open Setup program automatically. Follow instructions that appear pop-up windows. Installation program will specify folder into which wish install STRealizer. folder choose will root folder. Either accept default enter installation folder. Installation complete.
launch ST-Realizer, click Start Programs ST-Realizer Realizer.
1/248
Folders Sub-folders
Chapter
Folders Sub-folders installation process creates following folders sub-folders: <root_folder> which contains system executable files DLLs. (The root folder Program Files/ST-Realizer/ default.) <root_folder>\Examples which contains examples ST-Realizer projects. <root_folder>\Help, which contains help files, readme file documents about ST-Realizer. <root_folder>\Lib, which contains main symbol library number other libraries. <root_folder>\TargetHW, which contains definition files microcontrollers supported ST-Realizer
2/248
Chapter
INTRODUCTION CONCEPTS
founding idea behind ST-Realizer create accessible user-friendly software package, allowing people various levels programming expertise efficiently design embedded applications microcontrollers. ST-Realizer application programming package that allows create applications ready loaded into microcontrollers without having knowledge assembler code. this, symbols that represent programming functions create flow diagrams that perform your application functions. While user assumed have good understanding microcontroller which wishes create application, care been taken create sufficiently broad spectrum symbols cover your application design needs. should require symbol included ST-Realizer's main library, design your using Symbol Editor function. ST-Realizer applications destined family microcontrollers. scope application necessarily limited resources available target device-the microcontroller which application been designed. therefore imperative that fully understand specifications target microcontroller before begin design your application. Datasheets those microcontrollers supported ST-Realizer supplied ST-Realizer CD-ROM. addition, datasheets microcontrollers easily obtained from STMicroelectronics microcontroller site: http://st7.st.com remainder this chapter will describe basic concepts behind using ST-Realizer, help generate your embedded application programs.
ST-Realizer developed ACTUM Solutions expressly STMicroelectronics, developing embedded applications microcontrollers. addition ST-Realizer, ACTUM Solutions provides variety other software products, some which used complement ST-Realizer further refine your application. more information, please refer ACTUM Solutions site.
http://www.actum.com/
3/248
ST-Realizer Application Structures
Chapter
ST-Realizer Application Structures Perhaps best place start describing ST-Realizer final product-the generated assembler application that STRealizer will produce you. important understand final generated code structured before start designing your application, that aware best optimize available resources, such memory.
Reset entry point Chip Initialization
Initialization Peripheral Initialization Data memory Initialization Keep track elapsed time Read inputs Calculate data Write outputs Updating Copies State Machines
Peripheral IRQs
There main parts each STRealizer assembler application. first part series initialization macros that embedding automatically that make Realizer Operating System (ROS). sequentially initializes microcontroller, it's I/O's, peripherals memory, much same that your PC's BIOS initializes hardware soon switch Application create power second part code part that create using STRealizer-the application program. figure right shows flow chart overall structure generated assembler code that ST-Realizer produces. Programming using Symbols
Main Loop
Interrupt Subroutines
With ST-Realizer, create applications placing connecting symbols scheme Each symbol fact, graphical representation assembler macro, usually including attributes which modify your specific needs. symbols included ST-Realizer main library represent variety coded entities such mathematical, logical, conversion power management functions, constants, tables, subschemes/hierarchical sheets, states, input devices, output devices sequential, counted time-related events.
4/248
Chapter
Inside ST-Realizer Applications
symbols made such that need never write single line assembler code produce your application-all attribute modifications need perform accessible through dialog boxes. Inside ST-Realizer Applications application built around microcontroller unit (MCU). input signal(s) enter application from more) microcontroller's pins, ports peripherals. application treats input signal(s) require, result output microcontroller's pins ports. figure below shows generalized view application. input signal(s) enter application MCU's pins, ports peripherals, taken root main) scheme. root scheme core application-the main, sequential loop. application requires interrupts, must create subscheme. (Interrupts cannot occur root scheme.) simply wish section very complex part application aesthetic reasons, also create subschemes contain parts main loop. Subschemes represented root scheme subscheme symbols, which more will said little later.
Application
Root Scheme
Subscheme Symbol
Table Symbol
Input signal
(from pin, port peripheral)
Output signal
port)
Additional inputs from pins, ports peripherals possible.
Subscheme
5/248
Symbols
Chapter
Symbols Using ST-Realizer, design your application placing symbols wiring them together schemes. Each symbol represent: operation, such converting physical analog value binary value, piece information related behavior application, such state transition, system state, condition, action reflecting change system state caused event such occurrence timer interrupt. Each symbol associated with assembler code macro. wires represent flow data, linked variables constants. modify certain attributes symbols wires, allowing customize them your specific application. example, attaching attribute type UINT (unsigned integer) wire, define value capacity that unsigned integer 65536). more details attributes Appendix "Variables Attributes" page 203. 2.4.1 State Machine Symbols Within your root scheme, create state machine, which logically guides program between different functional states your application. Say, example, application which performs following functions: Turning motor Setting motor speed. Turning motor off.
state machine, would define state, using state symbol, each functional step application above and, addition, state which defines starting point application-the initial state. sequence state symbols would therefore look like: Motor (Initial State). Motor Setting Speed. Motor OFF.
transitions between each these states controlled conditions. Condition symbols switches. When condition met, condition symbol triggered, program progress next state. tutorial included this manual (see Chapter "Tutorial" page provides very good example state machine state symbols used creating application.
6/248
Chapter
Schemes
Schemes When using ST-Realizer, design your application schemes. scheme like plan which place symbols draw wires. Each application consists schemes, including root scheme number subschemes. Section page explains build modify schemes. 2.5.2 Root Scheme root scheme starting point your application program, corresponds reset vector program. root scheme where create main loop your application. large scale, sequential functions should kept here. However, there particularly complicated cumbersome actions your main loop, wish them into subscheme save space root scheme make application easier follow visually. 2.5.3 Subschemes Applications include number subschemes which contain further symbols wires displayed root scheme single symbol. There three reasons create subscheme: include complex portions main loop, thus saving space root scheme making easier reuse processes. this case, subscheme executed were part main loop (root scheme). include parts application that event-driven. (Events never placed root scheme.) Subschemes assigned either single execution condition, which will apply entire subscheme, alternatively, include number event symbols. More will said about execution conditions events shortly. save functional parts your application (analogous subroutines) that wish reuse other applications. Subschemes saved their files (.sch files) easily copied other ST-Realizer projects reused. also save customized subschemes symbols library, accessible projects. (Subscheme symbols described below).
Designing subscheme different than designing ordinary scheme, with exception: subscheme connections root scheme subscheme symbol. subscheme symbols named sssp_q, where indicates number inputs need your symbol number outputs. example, sss2_1 subscheme with inputs output.
7/248
Events
Chapter
When want subscheme, must therefore first think about connections: what inputs does subscheme need deliver output? Once know this, choose correct subscheme symbol from main library. However, subschemes, like root scheme, modified time. Section page describes create modify subschemes. Events Events conditional triggers, similar If.Else statements, that applied either entire subscheme, simply sequence code. Like If.Else statement, events always triggered input some sort. input interrupt, such timed hardware interrupt. input value change.
When event applied entire subscheme, called execution condition- because defines conditions which subscheme will executed. However, events also made apply just sequence symbols within subscheme, using event symbols. These symbols switches-if condition that they represent met, code that follows them performed. There many types events, some hardware independent, others that hardware dependent. full range events available detailed Section page 2.6.4 Execution Conditions execution condition applied subscheme, such that subscheme only executed when that execution condition met-such timed interrupt, upon subscheme input change. Only execution condition applied given subscheme when this execution condition fulfilled, code within subscheme executed. Subschemes with execution conditions chiefly used contain reasonably complex subroutine functions that conditionally performed addition code main programming loop. diagram right shows schematic example subscheme with execution conditions used application.
Reset entry point
Initialization Normal Code Execution Execution Condition met? Subscheme Code Normal Code Execution
8/248
Chapter
Events
2.6.5 Event Symbols Event symbols included subschemes determine when, which portions code executed. Event symbols always placed subschemes, because events interrupts, interrupts never placed root scheme. certain manner, event symbols switches control when (i.e. under which conditions) subsequent code executed. Event symbols most usefully used when wish include several events that control similar portions code. However, certain rules apply when placing more than event symbol single subscheme (refer Section 7.4.5 page 89). diagram below shows schematic example event symbols used control subscheme executed.
Reset entry point
Initialization Normal Code Execution
Subscheme Code symbol sequence Event
event symbols
out1
Event Subscheme Symbol
out2 symbol sequence
symbol sequence
Normal Code Execution
above example, subscheme code will executed follows: Event triggered event's condition being fulfilled): Symbol sequence will performed with out1 Symbol sequence will performed with out2 Symbol sequence will performed unconditionally-there event symbols connected this code sequence. Event triggered: Symbol sequence will performed with out1
9/248
ST-Realizer Keeps Track Time
Chapter
Symbol sequence will performed with out2 Symbol sequence will performed unconditionally. neither Event Event triggered, part subscheme code will performed.
Even though symbol sequence directly connected event symbol, virtue being subscheme with that contains events, will performed unless events triggered. golden rule that cannot events with root scheme symbols (meaning those symbols that performed part main loop normal code). When place symbols subscheme which contains more events (either form event symbols execution condition), those symbols cannot considered part root scheme.
Note:
ST-Realizer Keeps Track Time ST-Realizer differs from predecessors because final code that produces will only contain timer initialization code there time-related symbols events application. However, your application includes either time-related symbols events, ST-Realizer will generate something called base clock timer tick following manner: Every microcontroller timer, called Timer (ST6) Timer (ST7), which there either time-related symbols events application) used base clock measure units time called "timer ticks". choose value timer tick-this described page 131. time-related symbols events based timer ticks. This means that timer tick smallest increment time that distinguished. Timer ticks used control processing time main loop cycle. time required perform main loop cycle called Processing Cycle Time. default, processing cycle time variable. However, choose processing cycle specific number timer ticks-how this described page 131.
example, default base clock timer tick 0.01 milliseconds). This means that every milliseconds hardware timer (Timer Timer sends interrupt program which increments tick variable. Time-related symbols events this tick variable (either directly indirectly(1)) evaluate whether their conditions have been satisfied, whether their actions should executed not.
different types time-related events value tick evaluate their conditions detailed Section 7.4.3 page Time-related symbols described detail Section page 116.
10/248
Chapter
Connecting your Application Target Device
concept base clock timer tick important one, because appears every time require time-related symbol event. tutorial example, demonstrate both time-related symbols timed events. strongly urge take time complete tutorial-it very efficient speed ST-Realizer time spend doing tutorial will saved later having increased your productivity! Connecting your Application Target Device signal inputs application supplied more microcontroller's input pins, ports peripheral control registers. Similarly, application's final output must also sent output port. general, each microcontroller variety digital analog input/output pins, well ports serial parallel data. number pins ports, course, depends microcontroller question. However, peripheral support vary largely, depending microcontroller used. application design, must obviously bear mind resources available microcontroller. link inputs outputs between application microcontroller, must connect pins, ports peripheral control registers input output symbols application's schemes. Note that peripherals must enabled before they used application. Once enabled, each peripheral used must usually configured meet hardware requirements your application-hardware setting dialog boxes designed this purpose. These hardware settings used initialize microcontroller properly. Application Development Steps Once have designed your application using ST-Realizer, analyse compile using ST-Analyser. ST-Analyser performs following tasks: Analyses your scheme creating netlist, creating cross references, analysing generating final code. Providing fatal errors encountered, ST-Analyser generates non-compiled macro-assembler language (.asm) file from scheme. Generates compiled binary executable file. Depending whether included (see Section page Section 5.3.4 page 63), file with extension *.hex *.obj respectively generated ST6, with extension *.s19 *.obj ST7. *.hex *.s19) file directly loaded into while must link *.obj file with another program.
When analysing process been successfully completed, report file generated. This report file gives information about designation pins, list variables used type memory space required application.
11/248
Application Development Steps
Chapter
Once have compiled your application, ST-Simulator simulate behavior, generate view input signals, monitor signals that generated your application, fine-tune necessary. design simulation environments same design schemes, except that design held what called simulation environment files. provide with greater flexibility, create edit your symbols using STSymbol Editor. create symbol drawing shape, placing pins that represent variables that input output from process defining, then linking macro represents. files definitions that pertain application stored project files. following diagram shows ST-Realizer application development process.
Application Idea
Project FIle
ST-Realizer
Draw schem
ST-Analyser
pile code generate report
ST-Sim ulator
Test debug code
Load code into icrocontroller
12/248
Chapter
Tutorial
TUTORIAL
following tutorial designed help fully understand both principles behind creating applications using ST-Realizer create applications using ST-Realizer. this tutorial, you'll learn create microcontroller application. application will create manages heating control system. ambient temperature periodically measured, filtered compared with preset value. When measured temperature lower than control value, heating system started while pump speed adjusted proportionally temperature differential. pilot lights show that heating When measured temperature exceeds control value, heating system stopped. This tutorial application runs stand-alone mode using ST72212G2 microcontroller. However, note that same application could applied equally microcontroller, such ST6265, with little modification. goal this tutorial demonstrate, general manner, ST-Realizer, rather than supply sample applications given microcontroller. Setting Your Project this part tutorial will: Create project file heating control application. Define microcontroller onto which application will loaded. Learn open scheme which you'll draw application.
3.1.1 Creating Project File Each application design stored project. When create project, first step specify folder which wish place recommended that create separate folder each project. ST-Realizer will creates project.rpf file, that contains project-specific path settings, project's scheme names, target hardware information compiler settings. Once you've defined your project, you'll able open scheme start designing your application.
13/248
Tutorial
Chapter
Click Project cascading menu. Create File dialog opens:
Click here create folder. Click here move folder level. Type name your project here.
Create folder your tutorial project called "Heating" clicking folder icon shown above. Once have created your project folder, type name project ("heating") File name field. ST-Realizer will .rpf extension automatically. Click Save. have just created heating.rpf file which main settings related your project will recorded ST-Realizer session. They will used next time open project. 3.1.2 Choosing Target Microcontroller next step choose microcontroller which application will loaded. After create project, window will open prompting select target hardware. This application going loaded ST72212G2:
14/248
Chapter
Tutorial
Click Target Hardware folder Select Target Hardware window. browsable list target hardware devices will appear window shown below.
Find desired microcontroller (ST72212G2) clicking device icons list until name chosen device displayed. Select microcontroller ST72212G2 clicking once Click confirm. also double-click line showing device.
Once have selected your target hardware, Project window will open, shown below:
This window will list components your project-schemes, libraries target hardware. Notice that ST-Realizer already created application scheme file called heating.sch default. Next, we'll learn design application scheme.
15/248
Tutorial
Chapter
3.1.3 Opening Main Scheme that have created your project specified target microcontroller, must draw main "root") scheme. This sheet which design main part your application. main scheme file already been created ST-Realizer, called heating.sch default. open main scheme: Project window (shown page 15), double-click heating.sch, located under Schematics folder. blank worksheet opens where draw main (root) scheme application:
3.1.4 Worksheet Toolbar scheme worksheet, will toolbar with number icons. these icons will described work through tutorial, quick summary their names uses given here.
16/248
Chapter
Tutorial
Note:
Designing Drawing Schemes heating control application, microcontroller will require following inputs outputs: analog inputs: actual temperature control temperature digital output pilot indicate heating system status, digital output control speed pump.
this part tutorial, going learn create above application drawing graphical schemes. particular, will learn: place symbols. edit symbols. What principal symbols when them. connect pins. handle events.
schemes associated with application include symbols that describe: State Machine diagram.
Clip rtie
step-by-step instructions this tutorial describe operate STRealizer using default toolbar setup shown above. while doing this tutorial, cannot find button that shown instruction, refer "Customizing Toolbars" page 199, find which menu commands correspond that button.
Conditions, that conditions that transmitted application from external sources such temperature records, that internally determined, example when
17/248
Tutorial
Chapter
system switches specific state.
Actions, that actions that output from application, such putting pilot LED, actions that internally determined, example those resulting from timer interrupt.
following section will explain draw heating application using symbols fulfilling above roles. 3.2.5 State Machine Diagram Each time condition changes, result signals received from microcontroller input pins, state machine selects appropriate state. state defines signals that sent microcontroller output pins. overall management heating control system carried simple state machine with four states: Init, HeatingOFF, HeatingON, Pump Enabled.
SetupTime, Start, SetPump Stop conditions trigger state transitions.
specific action associated with each state. following table summarizes relationship between events(1) inputs), conditions actions.
Event(1) Input Signal Internal Setup Time elapsed Measured Temp. lower than Control Temp. Measured Temp. exceeds Control Temp. System switches HeatingON state Event Timer Interrupt External State Transition Condition SetupTime Start State HeatingOFF HeatingON Pilot Pilot Action
Stop
HeatingOFF
Pilot
SetPump
PumpEnabled
Pump speed control active Input acquisition active
state transition
more information about Events, please refer Section page
18/248
Chapter
Tutorial
When define state machine, first symbol must place initial state. heating control application, initial state Init. This holding state that allows time application measure filter actual temperature, before deciding whether turn heat pump. 3.2.5.1 Placing Initial State
place initial state, Init:
Click
main library dialog will open, shown right: symbol names categorized function. complete listing symbols (organized functional category name) found Chapter page 103. initial state symbol called "stateinit", located under "State machine" category. Find "stateinit" select clicking once and, without moving cursor from library dialog box, right-click mouse select Place. double-clicking
square will appear next cursor, indicating size position "stateinit" symbol. Move cursor where want place symbol, then click once. recommended that place symbol towards left your scheme.
wish move symbol after having placed just click once next symbol that rectangle appears around entire symbol, indicating that been selected. Then simply drag drop where wish.
Note:
dialog will open, prompting edit value state. doing effectively naming initial state variable. Type "Init" field, then click
With ST-Realizer, object naming (such when assigned name "Init" initial state symbol above) case-sensitive. addition, spaces interpreted characters. Ensure that object names used consistently, otherwise, errors will result when compile application.
CAUTION:
19/248
Tutorial
Chapter
You've just placed your first symbol-the initial state, Init. should look like this:
doesn't, select symbol clicking next then delete pressing Delete button your keyboard, redo steps above.
find that symbol small, want zoom click then select area around your symbol. make mistake, longer your symbol, click whole scheme, then reuse zoom your symbol.
ready place first condition-the SetupTime condition-that activated first time when start button pressed. Active conditions signalled sending value signal value equal indicates that condition active. 3.2.5.2 Placing Condition
place Start condition: main library dialog box, under category "State machine", scroll down list until find "condition", then double-click Move cursor where want place symbol (i.e. right stateinit symbol shown diagram below), then click. Edit value dialog opens. Type "SetupTime" field, then click
Your scheme should look like this:
doesn't, select incorrect symbol clicking next then delete pressing Delete button your keyboard, redo steps above.
20/248
Chapter
Tutorial
going wire initial state SetupTime condition together. This forms logical link between symbols. symbols have pins which connect wires. 3.2.5.3 Wiring Symbols
wire stateinit condition symbols together: Select wiring mode clicking that wiring mode. cursor changes crosshair, indicating
Place cursor next right arrow right stateinit symbol. This output pin. crosshair snaps onto when comes into snapping distance. indicates point which crosshair snapped, shown following diagram:
Click when crosshair snapped pin. ST-Realizer will draw wire that follows cursor. Move cursor line left SetupTime condition symbol. This input pin. Click when crosshair snapped onto condition symbol's pin.
Right-click mouse press click symbols connected wire.
finish wiring.
Your scheme should look like this:
doesn't: Select wire clicking Delete wire pressing Delete button your keyboard, redo steps above.
21/248
Tutorial
Chapter
3.2.5.4
Placing Next State
place state, HeatingOFF: main library dialog box, under "State machine" category, scroll down list until reach state, then double-click Move cursor where want place symbol, then click. Place symbol right state symbol, shown diagram below. Edit value dialog opens. Type HeatingOFF field, then click Now, wire SetupTime condition state symbol explained above.
Your scheme should look like this
design rest state machine diagram, that appears shown Figure following paragraphs contain hints explanations help you. Figure final state machine diagram.
22/248
Chapter
Tutorial
3.2.5.5
Designing Complete State Machine Diagram-Hints Explanations
Reminder: application manages heating control system. ambient temperature periodically measured, filtered compared with preset value. When measured temperature lower than control value heating system (re)started while pump speed adjusted proportionally temperature differential. pilot lights show that heating When measured temperature exceeds control value, heating system stopped. When application started, initial state, Init, triggers counter that allows enough time system measure filter actual temperature value. Once this time elapsed, SetupTime condition met, triggers HeatingOFF state, while simultaneously evaluating temperature inputs. temperature differential between actual temperature setpoint temperature larger than preset constant, condition called Start signal equal sent. This signal triggers transition between HeatingOFF state HeatingON state, meaning that heating system powered pilot switched create HeatingON state must place state symbol, which assign name value HeatingON, then wire Start condition, shown Figure Now, pump should operate such that speed proportional differential observed between actual temperature value preset temperature value. order this, pump must enabled prior operation. system must change PumpEnabled state. condition symbol, SetPump, needed, that will trigger transition between HeatingON state PumpEnabled state. Similarly, another condition, Stop, will ensure transition between PumpEnabled state HeatingOFF state. that same symbol ("condition") used four times (the "state" symbol itself used three times). When symbol already exists scheme, copy rather than selecting from library. Since going place Start condition symbol, copy from SetupTime condition symbol: Click just next SetupTime condition symbol select
Click
Click where want place copy (beside HeatingOFF state symbol, shown Figure
23/248
Tutorial
Chapter
Double-click name symbol. Edit value dialog opens. Type Start, name condition, then click HeatingON state symbol, select copy HeatingOFF state symbol using Place beside Start condition symbol. Double-click name symbol enter value HeatingON, shown diagram.
Create SetPump condition same manner that created Start condition. Note that State Machine diagram, SetPump condition symbol opposite direction Start condition symbol. change direction using mirror function, clicking position clicking twice. rotating required
PumpEnabled state symbol, select copy HeatingON state symbol using Place bottom State Machine diagram. Double-click name symbol enter value PumpEnabled, shown diagram.
Stop condition symbol, select select SetPump condition symbol, click copy place symbol left PumpEnabled state symbol, then enter value Stop.
next step wire HeatingON state symbol, three condition symbols PumpEnabled state symbol. Look state machine diagram these wired together. your scheme, make sure wiring mode selected clicking wire symbols.
Note:
Auto wiring Auto reroute options available Option Environment Wiring menu path. These options create corners reroute wires across shortest path automatically. prefer connect wires another way, deactivate them: Options menu, select Environment. Environment Options dialog click Wiring tab. Click Auto wiring Auto reroute check boxes. When these empty, Auto wiring Auto reroute deselected.
24/248
Chapter
Tutorial
place heading diagram: Click anywhere diagram area with right mouse button. popup menu displays. Select New/Attribute options Create Attribute dialog opens. Specify following options: TXT, Value "State Machine Diagram" (enter text) Visibility checkbox left unchecked Place heading where want, dragging Click
You've just drawn state machine, which part main scheme heating control application. next section will explain draw rest heating control application. Since should used placing, editing wiring symbols, descriptions that follow will explain what symbols will place, with what values symbols there. They will include details place, edit wire symbols that there. Table shows summary editing functions that create remaining diagrams. Table Summary Editing Functions
this: Select symbol this: Choose select mode clicking toolbar.
Keeping left mouse button pressed, drag around symbol, click near symbol with left mouse button. Move symbol Select symbol then drag-and-drop where want place Select symbol. Click toolbar.
Copy symbol
Click where want place copy. Change name symbol Double-click name that currently displayed with symbol. Edit Value dialog opens. Type name. Click
25/248
Tutorial
Chapter
this: Delete symbol
this: Select object. Press Delete your keyboard. Select wiring mode clicking
Wire symbols together
Place cursor next output first symbol. crosshair snaps onto when comes into snapping distance. Move cursor appropriate other symbol. This input pin. Click when crosshair snapped onto symbol's pin. places where clicked connected wire. Click right mouse button press finish wiring.
Completing Heating Control Application State Machine Diagram explained relationship between state heating control system certain conditions. next step link each state with action, define rules which each condition not, met. this, need draw other parts main scheme subschemes that, together, make heating control application-specifically:
External Input conditions, that transmitted application from external sources, such measured (actual) temperature. This function will part Main Scheme. Internal input conditions that control Setup Timer enable pump. These functions will part Main Scheme. External actions, that output from application, such putting pilot LED, controlling speed pump. This function will part Main Scheme.
internal event-driven action such periodic activation temperature acquisition filtering process. This function will part subscheme called filter.sch, which will learn create Section 3.3.10 page
26/248
Chapter
Tutorial
3.3.6 What differentiates main scheme from subscheme? Each diagram (meaning collection symbols wired together) scheme analogous sub-routine program. main scheme will, conceptual core your application. pays keep things simple main scheme, only include diagrams that represent large-scale, sequential running application. highly detailed acquisition, filtering comparison programs better into subschemes that application will easier de-bug update later. There good guidelines keep mind when deciding when something into subscheme, rather than main scheme: Size complexity diagram larger more complex diagram, more reason into subscheme itself, function that diagram performs runs parallel other functions (for example, sampling program that periodically reads external inputs continuously), must subscheme.
entire main scheme heating control application shown below. Only subscheme-for internal event-driven action described above-will created after finish main scheme.
have already completed State Machine Diagram (top left). remainder main scheme diagrams described following paragraphs.
27/248
Tutorial
Chapter
3.3.7 External Input Conditions external input conditions proceed from inputs: control temperature ("Setpoint" diagram shown below). measured temperature ("Temperature" diagram shown below).
above external input conditions indicated input pins microcontroller. Each time input signal changes, processed, appropriate condition (Start Stop) resulting from comparison signalled state machine changing condition value processing designed follows: Diagram cont'd Section 3.3.9.2 page
Draw above diagram your heater main scheme, with help following tables that describe symbols you'll place, what they values entered with them. Don't forget wire your diagram appropriately.
28/248
Chapter
Tutorial
3.3.7.1
Symbols
Symbol Functional Category Input output Name Symbol: Values There occurrences this symbol diagram: Comment shown diagram Name SetPoint Temperature. Type UINT
Description This analog digital converter input symbol. NAME value connects hardware port (see "Connecting Hardware Ports Peripherals" page 38). TYPE value used define variable type (UBYTE, SBYTE, UINT, SINT LONG). instances have Type UINT, which unsigned integer. comment value used report file (see "Analysing Generating Program Code" page 44).
Symbol
Functional Category Mathematical
Name Symbol: sub2 None
Values
Description This input subtractor, with type inheritance. IN2. subtracts actual temperature from Control Temperature. details type inheritance, "Type Inheritance" page 204.
Symbol
Functional Category Hierarchical Sheet
Name Symbol: sss1_1
Values Scheme Name related subscheme file (filter.sch, example).
Description This subscheme connection symbol. represents process that contained sub-scheme. this case, subscheme input ("In") output ("Out"). using Portin Portout symbols within subscheme connection made between pins this symbol subscheme. This subscheme described Section 3.3.10 page
29/248
Tutorial
Chapter
Symbol
Functional Category Logic
Name Symbol: mux1 None.
Values
Description This single-output multiplexer, where input condition determines whether output value should equal input input example, when input condition equals output value will input value from line
Symbol
Functional Category Constant
Name Symbol: constw Value
Values
There instances this diagram, ARTimer subscheme diagram, another Filter subscheme diagram. Description This word constant value symbol that inputs value
Symbol
Functional Category Conversion
Name Symbol: comp None
Values
Description This multi purpose comparator. returns three values that depend three inputs. when greater than when equal when smaller than There occurrence this symbol. indicates Start condition, when this condition met, outputting This condition when differential between control temperature actual temperature greater than degree indicates Stop condition (output=1 this pin) when differential between control temperature actual temperature negative.
30/248
Chapter
Tutorial
Symbol
Functional Category State machine
Name Symbol: stateout
Values Name HeatingON Several additional occurrences this symbol found other main scheme diagrams.
Description This example state output symbol. State output symbols connected state symbols their names. When system switches specified state, processing that follow state output symbol performed. example, processing simply consists enabling pump.
Symbol
Functional Category State machine
Name Symbol: statein
Values There occurrences this symbol this diagram: Name Start Name Stop Another instance this symbol found Internal Input Condition diagram.
Description These state input symbols, that connect condition symbols state machine that have same name. example, when value received from output comparator, signals Start condition outputting value state machine.
3.3.7.2 Wires Occasionally, must attach data type attributes wires control outputs. example, must attach attribute TYPE SINT wire connected output sub2 symbol order able evaluate both positive negative temperature differentials. attach type wire, proceed follows: Click wire with left mouse button. Click right mouse button. list displays, with attributes: Type, Init, Label. Click Type. Edit value dialog opens, with scrolling list data types choose from.
31/248
Tutorial
Chapter
Select type, SINT, click SINT, stands Signed Integer.
3.3.8 Internal Input Conditions There internal input conditions that must met: Enough time must pass allow temperature values acquired filtered before temperature differential measured. When this happened, SetupTime condition met. Once HeatingOn state active, pump must enabled prior being into operation activating SetPump condition.
diagram shown below:
Symbol
Functional Category Time related
Name Symbol: timf
Values Name Timer Time 0.05 Comment Setup Timer
Description This simple timer. output signal until time specified elapsed, then output becomes This symbol allows enough time application acquire filter temperature values.
Symbol
Functional Category Logic
Name Symbol: None.
Values
This symbol also occurs later application. Description This multi-type bit-wise inverter. output from timer reverted triggering SetupTime condition
32/248
Chapter
Tutorial
3.3.9 External Actions External actions generate output signals relating current state state machine. output signals are: signal switch Pilot LED. signal generated Auto-Reload Timer control speed pump. Pilot Monitoring
3.3.9.1
long state system HeatingOFF, Pilot should OFF. corresponding diagram
Symbol
Functional Category Logic
Name Symbol: None.
Values
Description This two-value binary function symbol with type inheritance. either HeatingOFF Init states active, Pilot will remain off. However, neither these states active, will
Symbol
Functional Category Input output
Name Symbol: digout
Values Only instance example: Name HeatingIsON Comment Pilot
Description This digital output symbol. name value used connecting this symbol microcontroller output ports (see Section 3.3.11 page 38). Comment value used report file.
33/248
Tutorial
Chapter
3.3.9.2
Pump Speed Control
Pulse Width Modulation (PWM) signal generated OCMP1_B output (TBOC1LR Timer port, ST72212G2) ensures pump speed control. this, ARCP compare register loaded with value between that reflects temperature differential calculated comparing actual control temperature inputs (see "external input conditions" diagram above). pump speed control diagram main scheme follows:
Cont'd from Section 3.3.7 page
Symbol
Functional Category Mathematical
Name Symbol: None.
Values
Description This 2-input multiplier symbol with type inheritance. Z=A*B. Type type from UBYTE through LONG. Type largest types. details type inheritance, "Type Inheritance" page 204.
Symbol
Functional Category Mathematical
Name Symbol: limf
Values ValueTop ValueBottom
Description This fixed-value limiter symbol. output will larger than value smaller than bottom value. Type type type from UBYTE through LONG.
34/248
Chapter
Tutorial
Symbol
Functional Category Input output
Name
Values
Symbol: outputlatch Name ARCP Comment PumpSpeedControl
Description This output symbol. NAME value connects hardware port (see Section 3.3.11 page 38). type from through LONG used.
3.3.10 Creation Subscheme Internal Event-Driven Action Section 3.3.7, made reference main scheme subscheme internal eventdriven action. This particular action controls periodic activation temperature acquisition filtering process reflects timed interrupt execution condition-that event periodically triggered timer interrupt. Recall from Section 3.3.6 that events that need executed parallel, independently from, main scheme, must placed subschemes. tutorial application, subscheme attached this action (filter.sch groups code that executes interrupt service routine. This single-input, single-output subscheme represented sss1_1 symbol embedded main
scheme diagram where input symbol corresponds input subscheme, symbol's output corresponds output subscheme. course, subschemes have various numbers inputs outputs, represented symbols type "sssx_y", where number inputs number outputs. create subscheme: Double-click above symbol main scheme diagram. window (shown below) will appear asking wish create subscheme. Click
blank scheme will appear.
35/248
Tutorial
Chapter
3.3.10.1 Temperature Acquisition Filtering subscheme diagram follows:
Note: will learn create this Section 3.3.12 page
Symbol
Functional Category Hierarchical sheet
Name Symbol: portin
Values Label identifier used make connection between this subscheme parent scheme. Must name input symbol that found main scheme diagram. example, LABEL "In".
Description This symbol used connect input subscheme symbol ("sssx_y") from parent scheme with corresponding subscheme. This symbol homologous portout symbol which describes output subscheme symbol.
Symbol
Functional Category Logic
Name Symbol: loopdel None.
Values
Description other words output value this symbol value obtained during previous polling loop. This symbol acts one-loop delay symbol. Type type type from through LONG. example, this symbol used times: this means that temperature measurements performed times, polling loop after other. five temperature values then averaged smooth effect temporary variations.
36/248
Chapter
Tutorial
Symbol
Functional Category Mathematical
Name Symbol: add2 None
Values
Description This input adder, with type inheritance. IN2. details type inheritance, "Type Inheritance" page 204.
Symbol
Functional Category Mathematical
Name Symbol: None.
Values
Description This 2-input divider symbol with type inheritance. A/B, modulo Type type from UBYTE through LONG. Type largest types. details type inheritance, "Type Inheritance" page 204.
Symbol
Functional Category Hierarchical sheet
Name Symbol: portout
Values
Label identifier used make connection between this subscheme parent scheme. Must name output sss1_1 symbol that found main scheme diagram. example, LABEL= "Out".
Description This symbol used connect output subscheme symbol ("sssx_y") from parent scheme with corresponding subscheme. This symbol homologous portin symbol which describes input subscheme symbol.
37/248
Tutorial
Chapter
3.3.10.2 Leaving Subscheme subscheme, return root scheme either these actions: Click Close File option main menu, Click with right mouse button blank position subscheme. popup menu opens with five options. Select Leave. will returned root scheme.
Click here return root scheme
3.3.11 Connecting Hardware Ports Peripherals Once have finished drawing your application schemes, next step connect application inputs outputs microcontroller input output hardware ports, peripherals. heating control application, input/output symbols are:
Symbol Symbol Name Type Analog Input Function Diagram Control temperature acquisition, External Input Conditions diagram.
Analog Input
Actual temperature acquisition, External Input Conditions diagram.
digout
Output
HeatingIsON, External Actions diagram.
outputlatch
Output
Loading ARCP Compare Register, External Actions diagram.
38/248
Chapter
Tutorial
Therefore, there four input/output symbols, they need connected shown Table 3(1). four input/output symbols represent types devices: Three ports, namely Setpoint (PC.4), Temperature (PC.5) HeatingIsON (PB.0). on-chip peripheral, ARCP (Timer activated Auto Reload mode with generation TBOC1LR Timer (Output Compare Register. Application-Microcontroller Connections.
Application Symbol: SetPoint (adc) Temperature (adc) HeatingIsON (digout) ARCP (outputlatch) Microcontroller Pin: PC.4, 8-bit analog input PC.5, 8-bit analog input PB.0, Push-pull output TBOC1LR Timer Register
Table
make these connections, follow instructions connecting port device Setpoint, Temperature HeatingIsON symbols instructions connecting onchip peripheral ARCP symbol. 3.3.11.1 Connecting port device You're going connect SetPoint input: Double-click SetPoint symbol. Hardware connections dialog opens listing available pins type connection want make: going connect first PC.4, 8-bit analog input.
connections depend upon application target microcontroller. this tutorial application, target microcontroller, ST72212G2, have specified necessary connections. order correctly create your application, will need familiar with target microcontroller which intended.
39/248
Tutorial
Chapter
Available resources list, double-click entry PC.4,8-bit analog input then click
connect Temperature HeatingIsON inputs same way. When connect port devices, dialog boxes automatically display input output pins depending type symbol. There need configure ports input output, prior connecting them. However, on-chip peripherals, such Timer ST72212G2, need specify some hardware settings before appropriate resource appears dialog box. instructions specify these settings, below. 3.3.11.2 Connecting Specifying Hardware Settings On-Chip Peripheral connect on-chip peripheral, Timer proceed follows: Click Hardware Settings entry Project menu. Click Properties button Hardware connections dialog box. Hardware settings dialog box, click Timer tab. Timer dialog opens.
Timer Dialog box, click Enable box. This action permits application Timer peripheral allows access interrupts control registers peripheral.
40/248
Chapter
Tutorial
following parameters: Prescaler division 1/8. Input Capture: Capt1 transition Rising, Capt2 transition Falling. Output Compare: Click Enable OCMP1 Level Level High. Click Initialise Compare register1 value 0x0. Click Initialise Compare register2 value 0x100. Click box.
Click confirm. dialog closes. Timer on-chip peripheral enabled generating device. Consequently, Pulse-Width Modulated signal generated OCMP1 output pin.
that device correctly configured, follow procedure Section 3.3.11.1 page connect ARCP symbol (outputlatch) TBOC1LR Timer register.
3.3.12 Event Control last thing must when create application assign execution conditions those events that represented subschemes.
Note:
Execution conditions cannot assigned main (root) schemes-it simply doesn't make sense main scheme interrupt routine, example. addition, best define execution conditions after having enabled (see page necessary microcontroller peripherals, that these peripheral functions available use.
execution conditions box, shown bottom left corner subscheme, seen Temperature Acquisition subscheme diagram page created follows: Right-click mouse blank position diagram. popup menu opens with five options. Select Execution Conditions. Execution Conditions dialog specified target microcontroller (ST72212G2, example) opens. Specifying this target microcontroller first tasks
Click here open Hardware Connections dialog box.
41/248
Tutorial
Chapter
perform (see Section 3.1.2 page 14).
This device have specified beginning.
Name file where subscheme saved.
Select subscheme execution condition (Timed Interrupt tutorial example).
Execution Conditions dialog (see above), double-click Timed Interrupt line. dialog opens specify time period between input value acquisitions.
Enter 0.01 (1/100 second) click Click button Execution Conditions dialog box. Timed Interrupt event connected subscheme, with time value 0.01 seconds. What does this mean? means that code described Temperature Acquisition Filtering subscheme will executed every 1/100 second, after main processing loop been interrupted priority basis. polling temperature capture points consolidation measured temperatures will thus performed every 0.01 seconds.
42/248
Chapter
Tutorial
3.3.13 Summary have completed heating control application schemes. have learned through doing this: place edit symbols. What principal symbols when them. wire symbols together create main scheme subscheme. connect application inputs outputs target microcontroller pins. define execution conditions subscheme. Recall that main, root, scheme heating control example will look like following:
next part this tutorial will show analyse generate code heating control application.
43/248
Tutorial
Chapter
Analysing Generating Program Code this part tutorial going learn analyse schemes draw generate program code them. When execute analysis compile, ST-Realizer analyses your scheme creating netlist, creating cross references, analysing generating final code. During these phases connectivity between symbols, assignment variable types checked before generating source code. Providing fatal errors encountered, ST-Realizer generates non-compiled macro-assembler language (.asm) file from scheme, which then compiles. When analysing process been successfully completed, report file generated. This report file gives information about designation pins, list variables used type memory space required application. 3.4.14 Setting Compile Options There number compile options that before performing Analysis your application. These options discussed detail Section page 129. However, most default settings suitable tutorial application. view compile options: main menu, click Options, then Project. Code Generation dialog Analyse Options window opens. default settings suitable tutorial application. Click
44/248
Chapter
Tutorial
3.4.15 Executing Analysis Compile execute ST-Analyser from application windows. Project menu, simply click Analyse. Analyser Status window will open will Analyse function checking your application step-by-step.
there errors: dialog will open, showing status compilation, with number errors warnings. Click descriptive list errors will shown Analyzer messages window bottom scheme window. view each error either doubleclicking message window, clicking previous message next message icons toolbar. area scheme where error occurs will appear scheme window.
Correct errors re-compile application clicking Analyse under Project menu.
45/248
Tutorial
Chapter
3.4.16 Viewing Analyse Compile Report Once have analysed your scheme compiled your program code, view report generated ST-Realizer during analysis compilation process. This report provides with useful information such input output connections made, gives overview much memory used application. report, View menu, click Report. portion application report shown below:
ST72212G2 Realizing Unit (V4.00) 1990-98 Actum Solutions Report file project C:\Program Scheme Version 1.00 Report timestamp: 13:14:40 1999 Analyze results errors -Schematic dependencies events: -C:\Program Scheme: C:\Program Event: Timed interrupt 0.01 Sec. ST72212G2 (DIL28) connection overview: -Pin Name Alternative name Type Description RESET (BIT Input Active OSCin Oscillator OSCout Oscillator PB.7 (BIT Input connected PB.6 (BIT Input connected PB.5 MISO (BIT Input connected PB.4 MOSI (BIT Input connected PB.3 OCMP2_A (BIT Input connected PB.2 ICAP2_A (BIT Input connected PB.1 OCMP1_A (BIT Input connected PB.0 HeatingIsON (BIT Output), Push-pull output PC.5 Temperature (UBYTE Input analog input PC.4 Setpoint (UBYTE Input analog input PC.3 ICAP2_B (BIT Input Used application PC.2 CLKOUT (BIT Input connected PC.1 OCMP1_B (BIT Input Used application PC.0 ICAP1_B (BIT Input Used application PA.7 (BIT Input connected PA.6 (BIT Input connected PA.5 (BIT Input connected PA.4 (BIT Input connected PA.3 (BIT Input connected PA.2 (BIT Input connected PA.1 (BIT Input connected PA.0 (BIT Input connected TEST Test mode Ground Power Supply
next, final part this tutorial will describe simulate fine-tune your application using ST-Simulator.
46/248
Chapter
Tutorial
Simulating Fine-Tuning Your Application Once have designed analysed your application, ST-Simulator simulate behavior, generate view input signals, monitor signals that generated your application, fine-tune necessary. this part tutorial, you're going Create simulation environment file, which defines environment which you'll simulate your application. adjusters your simulation environment file, which enable generate view signals that input your application. probes your simulation environment file, which enable view signals that generated your application. simulation.
3.5.17 Creating Simulation Environment File (.sef) first step simulating your application create simulation file. Simulation files based application schemes target device, created ST-Simulator. create heating control simulation environment file: Make sure that heating control application open. Tools menu, click Simulator. ST-Simulator window opens.
File menu, click Simulation environment. Create File dialog opens, letting assign name simulation environment. Type name .sef file: heating.sef. Click Save.
47/248
Tutorial
Chapter
You've created simulation environment file heating control application. level drawing ST72212G2 chip appears shown right. Note that where pins have been connected application input/output functions, names have been replaced function names. double-click level drawing, will open copy your root scheme diagram another window. also open subschemes double-clicking subscheme symbols. both level drawing scheme diagrams help simulation-both views useful evaluating whether your application running wish. views once, under Window menu, select Tile. 3.5.18 Connecting Probes Adjusters going connect probes adjusters your scheme, that adjust input values application view output values. This enables experiment with fine-tune your application. There four types adjusters three types probe available, these described detail Sections 10.2 10.3, respectively. Connecting Adjuster application, recall that there temperature inputs: Setpoint temperature, which desired temperature system, Actual temperature, which read
48/248
Chapter
Tutorial
filtered temperature probe. simulation environment, need adjust both these temperatures order test application responds. order control these temperatures, Numeric Adjuster, which allows input adjust values wish. first adjuster going connect adjuster placed level drawing that will simulate setpoint temperature that input application. this, will need place digital numeric adjuster Setpoint pin: Click Setpoint level drawing. Click
Click where want Numeric Adjuster appear. decrease size adjuster rightclicking selecting Decrease size. Enter temperature value level, temperature values expressed Volts, rather than simple conversion formula links quantities:. Therefore,
Now, connect numeric adjuster Temperature same manner, also setting value
list temperatures their corresponding values Volts shown Table Table list temperature values their corresponding values Volts.
Actual Temperature (Temperature pin)
Setpoint Temperature (Setpoint pin)
3.53 3.53 3.53 3.53
2.35 2.94 3.33 3.92
49/248
Tutorial
Chapter
Connecting Probe addition adjusters, which input values, also need connect probes, view output values. this application, will three types probe evaluate response application: During simulation, would helpful know whether heat pump running not. Recall that included Pilot that would turn when heating came connecting Numeric Probe (which lets view value output Binary, Decimal, Hexadecimal Octal number bases) HeatingIsON pin, view whether (voltage (voltage connect numeric probe, proceed follows: Select output called HeatingIsON. Click
Click where want Numeric Probe appear (i.e. close HeatingIsON).
addition seeing heat pump running not, would also like power rating. application, recall that pump's power directly proportional (positive) temperature differential between actual temperature setpoint temperature. view input power heat pump, attach Oscilloscope Probe, which allows view value output graph. Select Timer output (called OCMP1_B). Select Oscilloscope Probe clicking Place probe where wish appear. Your level diagram should look something like diagram right. Once Oscilloscope Probe placed, need variable display range display time 0.001 meaning that Y-axis graph displayed oscillator probe will start X-axis (Time) will start 0.001 s(1): toolbar.
50/248
Chapter
Tutorial
Double click Oscillator probe once placed. Change Oscilloscope Probe dialog opens:
Y-axis Bottom field, enter Y-axis field, enter Begin field, enter00.00.00.0000. after field, enter 00:00:00:0010. Select Mode value Trigger. Select Trigger Rising edge. Click
view root scheme selecting heating.sch under Window menu. what signal values various connection wires, should place Numeric Probes main scheme diagram.
complete description oscilloscope parameters control them, please refer Section 10.3.9 page 153.
51/248
Tutorial
Chapter
Since heart heating control application state machine, useful check that each input condition required effect state machine, that state machine takes appropriate actions. what current active state place State Machine Probes (probes that show state machine's condition) main scheme diagram. probes root scheme: Click connection wire wish. Note that State Machine Probes only connected initial state symbol State Machine Diagram. Click Probe. Click where want Probe appear. example, wish place Numeric Probes State Machine Probe main scheme diagram follows: connect Numeric Probe, connect State Machine
also additional probes subscheme filter.sch desired, better understand application working. have placed your adjusters probes, simulate your application, adjust values input view values generated
52/248
Chapter
Tutorial
3.5.19 Running Simulator ready simulator, reacts when change values input Click simulation.
see, oscilloscope starts generating signal. simulate behavior heating control system, change value analog numeric adjusters placed after pins. This causes value pilot probe changed, shape oscillator signal display discrete levels. adjusting input values Setpoint Temperature pins clicking buttons analog numeric adjusters. buttons decrease increase values respectively, buttons decrease increase values respectively. Table page shows list suggested values designed allow view application reacts starting stopping heat pump, depending difference between Setpoint Actual temperatures.(1) When want stop running simulator, click again simulator click
Note that before re-running simulator, initialize clicking: it's You!
You've completed tutorial. this tutorial learned three major steps involved creating your application using ST-Realizer: draw application. analyse your scheme compile your application code. simulate your application.
Furthermore, learned what most ST-Realizer symbols where place them. ready start developing your bug-free applications families microcontrollers using ST-Realizer. want look more examples, refer Appendix B:"Sample Applications" page 211.
Simulator time does necessarily elapse same rate real time (the time your watch). simulator time generally slower than real time, depending hardware characteristics running ST-Analyser this reason, application example (see Section 3.3.10 page 35), specified periodic sampling every 0.01 seconds that simulation would slow. find that simulation takes long respond changes input values, need change periodic sampling time.
53/248
Tutorial
Chapter
54/248
Chapter
Project Files
CREATING, OPENING SAVING PROJECTS
Project Files Each application design stored project. recommended that each project have folder. ST-Realizer stores schemes subschemes associated with application project folder. Once your have created specified your project folder, ST-Realizer will create project.rpf file, that contains project-specific path settings, project's scheme names, target hardware information compiler settings. project.rpf file ASCII text format. Creating Project create project: Click Project cascading menu. Create File dialog opens. haven't done already, create folder your project clicking folder icon shown.
Click here create folder. Click here move folder level. Type name your project here.
Browse folder that you'll create your project specify name project file. .rpf extension will applied automatically. Click Save
55/248
Opening Existing Project Opening Existing Project
Chapter
Note:
Only project open time.
open project:
Click Project Open. (Files with .rpf extension displayed automatically.) Click File Open
(You must specify .rpf extension).
Open File dialog opens:
Browse folder containing your project file, either select type name (.rpf extension) File name field. Click Open.
Opening Earlier Realizer Version Projects Open file dialog shown above used open .ini project files from earlier versions ST-Realizer. Both.ini projects .rpf projects fully compatible. When opening projects from earlier versions, aware that these projects still target hardware from these earlier versions. Simply reselect target hardware (see Chapter page once have opened earlier version project.
56/248
Chapter Closing Project close project:
Closing Project
Click File Close Project Close. Saving Projects Once have defined your project, should save that configuration information have updated kept part .rpf file. close modified project, will prompted save Otherwise, save project, under File menu, select Save. wish save your project another filename (for example, create back-up copy project), under File menu, select Save type name file that wish save project
Tip:
save your project different folder, schemes subschemes associated with project will also saved folder.
57/248
Saving Projects
Chapter
58/248
Chapter
Devices
SPECIFYING TARGET HARDWARE DEVICE
Devices Once have created project, next step define device type that application will loaded into. This will attach hardware configuration device (such pinout memory capacity) scheme that will describe your application. This hardware data assures that application tailored target device. Note users: ST-Realizer does support paging, except static pages. Because this, size limited kilobytes size bytes. Max. Max. values determine maximum size ST-Realizer application. pins determine number input output symbols that used STRealizer application. EEPROM values determine much EEPROM used symbols from MAINPER.LIB symbol library. This symbol library contains symbols that EEPROM space store their values.
59/248
Choosing Target Microcontroller Choosing Target Microcontroller 5.2.1 Selecting Target Microcontroller Project
Chapter
When create project, just after creating your project.rpf file, will prompted specify target hardware your project. Click Target Hardware folder Select Target Hardware window. browsable list target hardware devices will appear window shown below.
Find target microcontroller clicking device icons list until name chosen device displayed. Select target device clicking once Click confirm. also double-click line showing device. Once have selected your target hardware, Project Viewer will open, similar that shown right:
60/248
Chapter 5.2.2 Changing Target Microcontroller
Choosing Target Microcontroller
Once have specified target hardware device project, configuration connection information that device stored .rpf file project. change target hardware device previously existing project, target hardware device information also added .rpf, without losing previously specified device information. change target hardware device existing project, follow these steps: Open Project whose target microcontroller wish modify. Click Hardware Select. Project menu, double-click target hardware device Project Viewer. Select target hardware dialog will open, showing target hardware device previously selected. Simply browse target hardware device desired. Click once select
Click confirm. also double-click line showing microcontroller. Note that name current microcontroller displayed dialog box.
target hardware device pre-existing project, have update hardware connections reconnecting symbols appropriate hardware ports peripherals. more information, refer "Connecting Input/Output Symbols Microcontroller Pins, Ports Peripherals" page
61/248
Hardware Configuration Hardware Configuration 5.3.3 Accessing Hardware Settings Dialog Boxes Follow these steps: Click Hardware Settings. Project menu.
Chapter
Hardware Settings dialog specified target microcontroller opens. This dialog shows number tabs that direct following hardware configuration daughter dialog boxes: General tab, configuring general hardware options. Memory tab, setting hardware memory options. corresponding each target microcontroller's on-chip peripherals, allowing peripheral settings customized. example, ST72212G2 microcontroller hardware settings dialog box, shown below, four peripheral setting tabs corresponding each four on-chip peripherals: Timer Timer Ports.
Click appropriate tab.
There circumstances which want modify settings these windows: when build scheme, when want recompile existing scheme order customize program will operate when loaded into microcontroller. first case specify settings, keep default settings); second case, modify existing settings.
Note:
62/248
Chapter 5.3.4 General Hardware Configuration This first dialog box.
Hardware Configuration
Note:
Option bytes supported.
From General tab, specify: oscillator frequency microcontroller.
This frequency external frequency. uses internal frequency which half external frequency (Fin FExt/2).
Note:
Whether Watchdog function enabled. Watchdog function peripheral included each microcontroller. Enabling Watchdog initializes instructs ST-Realizer refresh Watchdog regularly. more information Watchdog function, please refer your microcontroller's datasheet.
Whether want disabled. Realizer Operating System (ROS) made macros pieces code that perform background tasks that must added ST-Realizer application complete ready load into device. certain sense, similar BIOS your PC-ROS macros encompass such operations chip initialization, initialization, timer initialization data memory initialization, that essential running your application.
Note:
Refer Chapter "Introduction Concepts" page overview running ST-Realizer program.
Alternatively, disable inclusion standard macros, generate your code perform tasks instead. tasks which must provide macros described below. disable ROS: Click Complete check box. disabled when check empty (unchecked). Click
disable ROS, must external program perform following functions: Call following subroutines that created ST-Realizer:
63/248
Hardware Configuration
Chapter
PortInit, which initializes ports according ST-Realizer application. RamInit, which initializes allocated ST-Realizer application. RealInit, which initializes ST-Realizer application. RealMain, which executes ST-Realizer application. PortInit, RamInit RealInit must executed once RealMain subroutine must executed continuously. Perform interrupt management. Fill input variables that used ST-Realizer application copy output variables ST-Realizer application data registers ports.
input variables are: Apxd where port name number 0.7. This variables generated result conversion. These variables already allocated with size byte. RTICK This one-byte timer tick variable. This must filled with number ticks during last execution RealMain subroutine. output variables form: BUDRx where port name each variable byte length. Their contents must copied data registers appropriate port.
Include files user-defined macros. scheme analysing compiling includes symbol that created yourself, must include macro macros linked symbol before analysing scheme. details create your symbols "Creating Your Symbol" page 165. include macros linked user-defined symbols: Include files field, enter name full path macro files linked your symbols. include more than macro file, separate each path file name with semi-colon (;). Click
Assembler options. Normally, will need alter default assembler options.
64/248
Chapter 5.3.5 Memory Configuration
Hardware Configuration
second Hardware Settings dialog entitled Memory. this tab, shown below, configure target microcontroller's memory configuration options, such start (corresponding beginning your application code). start (corresponding beginning your application variables). start EEPROM this memory type included your target microcontroller).
update these parameters: Type value overtype current value. Click
reset values standard device settings, click Reset.
Notes:
default values found these fields correspond those reported microcontroller's datasheet because ST-Realizer reserves portion available memory use. example, devices, STRealizer uses bytes memory. values these fields changed, there will impact application's variables generation code.
65/248
Hardware Configuration 5.3.6 Enabling Peripherals
Chapter
Each peripheral belonging target microcontroller associated Hardware settings window. wish more peripherals your application, must enable peripheral, which allows initialized configured. this: Click appropriate open dialog that describes peripheral configured. peripherals available vary depending target microcontroller device. Check Enable peripheral's dialog box. peripheral enabled configured (using rest options dialog box) wish. details peripherals available, their configuration options, refer Microcontroller data book. also Chapter "The Main Symbol Library" page 103.
66/248
Chapter
Schemes
CREATING, OPENING, SAVING SCHEMES
Schemes Once have created opened project which want work, must create open scheme. scheme sheet which design your application. When have finished working scheme, remember save your work. export schemes Windows metafile (.WMF) format, that import them into drawing word processing packages. This section describes create scheme, open existing scheme, save your work. Creating Scheme When create project, empty root scheme created default, taking same name project. example, created project called "Heating.rpf", root scheme called heating.sch will created default.
default root scheme automatically created ST-Realizer each project.
Tip:
wish change root scheme, right-click scheme schematics folder, select Change root schematic. will then prompted select browsing) scheme which will become root scheme project.
6.2.1 Opening Root Scheme root "main") scheme sheet which design main part your application created ST-Realizer when create project. open root scheme: Project Viewer (shown above), double-click root scheme (for example, heating.sch, shown above) located under Schematics folder.
67/248
Creating Scheme
Chapter
blank worksheet opens where draw root scheme application:
6.2.2 Creating Subschemes other Schemes
Click
also click File Scheme. Create File dialog opens. Browse your project folder specify name scheme file (.sch extension). Click Save. new, blank scheme opens.
Tip:
subscheme will appear under Schematics list Project Viewer until been connected project project been Analysed. connect subscheme project, there must symbol somewhere root scheme another subscheme which connected subscheme (refer "Connecting subscheme symbol root scheme" page 92). scheme subscheme, only connected project declared root scheme.
68/248
Chapter Opening Scheme
Opening Scheme
Click
also click File Open. Open File dialog opens. Enter path your project, specify scheme name (.sch extension). Click Open.
Tip:
open scheme you've used recently, click name bottom File menu.
Saving Schemes save scheme that currently active, click
save schemes that open, click Save File menu. save scheme under name,: Click Save File menu. Specify name scheme file (.sch extension). Click Save.
also ST-Realizer save your work automatically specified interval. "Automatically Saving Your Work Setting Screen Preference." page further details.
Note:
Tip:
Subschemes will appear Project Viewer until have performed Analyse project. saved .sch scheme file will placed root directory project, will have open manually does appear Project Viewer.
69/248
Saving Schemes
Chapter
70/248
Chapter
Schemes their Components
BUILDING SCHEMES
Schemes their Components scheme collection symbols connected another lines named "wires". Each symbol input output pins that allow them wired other symbols. symbols, pins wires scheme assigned attributes precisely define their configuration behavior. Schemes heart ST-Realizer. designing schemes, fact creating your application code. each application create, must have root "main") scheme. This scheme which contains main body your application-the core program which controls sequential running application. addition root scheme, most applications also include subschemes that represent specific processing your application. Subschemes usually contain those actions which must performed addition (and sometimes conditionally) actions root scheme. particular, subschemes connected events, such timer interrupts, periodic events, hardware (external) input changes peripheral operation. Subschemes also used mask more complex operations, that they "clutter" root scheme. Symbols Symbols basic building blocks used create application with ST-Realizer. essence, each symbol graphical representation portion assembler code, usually representing function short subroutine. Symbols represent many coded entities such mathematical, logical, conversion power management functions, constants, tables, subschemes/hierarchical sheets, states, input devices, output devices sequential, counted time-related events. main symbol library ST-Realizer (see Chapter page 103) encompasses main functions required assembler code, should need very specialized symbol your application, there symbol editor function that allows modify existing symbol, create entirely symbol, save library. Most symbols ST-Realizer's main library have attributes which must specify. These attributes allow specify many parameters, such Giving symbol application-specific name order identify elsewhere scheme. Assigning input output data type. Specifying time period time-related symbol.
71/248
Symbols
Chapter
above list means exhaustive. modifiable attributes depend type symbol. Chapter page 103, will find complete list symbols STRealizer main library, complete with modifiable attribute values available each one. Earlier, mentioned that each symbol fact graphical representation portion assembler code called macro. Later, Chapter page 165, will take closer look customizing symbols using Symbol Editor, assembler macros that define each symbol. remainder this chapter will concentrate manipulate symbols their attributes, wire together symbols create application scheme.
Note:
With ST-Realizer, object naming case-sensitive. addition, spaces interpreted characters. Ensure that object names used consistently, otherwise, errors will result when compile application.
7.2.1 Placing Controlling Symbols Placing symbol Symbols placed scheme ways: scheme Insert symbol (one that does already exist open scheme) choosing from main library: Click main.lib (and mainper.lib exists target microcontroller) dialog box(es) open. symbols are, default, ordered functional category (Hierarchical View). However, view library symbols alphabetically right-clicking library dialog selecting Alphabetical View. also open library File Open menu sequence, specifying appropriate <filename>.lib file. ST-Realizer with number symbol libraries <root_folder>\Lib directory, including some that microcontroller-specific.
72/248
Chapter
Symbols
most commonly-used symbols grouped libraries: main.lib, symbols that values stored RAM, mainper.lib, symbols that values stored permanent, non-volatile storage. When build scheme, symbols that copied from these libraries. list symbols actually selected constitutes local library attached scheme. Note that when copy scheme, also copy attached local library.
Tip:
Double-click name symbol wish place select symbol clicking once right-click mouse without moving from library dialog box, select Place square will appear next cursor, indicating size position symbol have chosen. Move cursor where want place symbol, then click once. Make copy symbol that already exists open scheme (symbol from local library): Click
dialog (having name open scheme title) opens. contains list symbols used that scheme. Select symbol want place. Click Place. also double-click name list. Drag drop ghost associated with symbol down location symbol. obtain information about symbol clicking Info, prior placing
Tip:
local library attached scheme saved further use. example, enrich symbols available another scheme. this, click Save option File menu, specify .lib file type, keeping original name scheme.
Selecting Symbol, with drawing package, before modify object group objects must first select them. Wire Group Objects select items, must selection mode (the cursor form arrow). This default mode. However, need activate
73/248
Symbols selection mode: Click
Chapter
object selected when outlined box. select more objects follows: Select object clicking Take care click symbol attribute this will open dialog attribute. Select group objects dragging around them. cursor corner area wish select. Keeping left mouse button pressed, move cursor diagonally across area want select until whole area outlined box. When release mouse, will that each individual object found area outlined been selected. Select multiple objects pressing SHIFT while simultaneously clicking each object one. Each item select surrounded box, indicating that selected. select segments connected wire, double-click segment wire. Copying Symbol copy symbol ways:. Right-click symbol copied. popup menu will open. Select Copy shape Drag drop ghost symbol where want place will prompted specify attribute values symbol.
choices shown popup menu vary depending type symbol. example, Constant type symbols, Value option also displayed, symbols connected microcontroller output pins, such digout, Connect option will shown.
Tip:
Select symbol copied. Click Drag drop ghost symbol where want place Note that attribute values also copied. copy symbol clipboard, click
74/248
Chapter
Symbols
Copying Group copy either group symbols scheme (portion entirety). Note that will also copy other objects group, such Symbols wires. Select group symbols copied. Click toolbar. Place ghost where wish place copied objects. copy group symbols clipboard, select group then click with right mouse button. pop-up menu shown right will appear. Select Copy. copy selection scheme page choose Duplicate. Pasting Object from Clipboard Click then drag drop ghost down location symbol.
Moving Symbol move symbol group objects: Group Objects Select symbol group objects. Place cursor selected group drag drop ghost with four-headed arrow pointer location symbol. Note that wire connections attached symbol moved with symbol. Deleting Symbol Group Symbols Select symbol group symbols. Click key. press
Note that delete also other objects group, such wires. delete symbol place clipboard, select symbol click
Changing Symbols have variety attributes that Symbol's Attributes depend symbol type. When place symbol scheme from symbol library, prompted specify these attributes. However, they changed point. this: Right-click symbol. popup menu opens.
75/248
Symbols
Chapter Attributes. Select Attribute dialog opens. click line attribute want change. Edit Value dialog opens.
field label this dialog (NAME, example) depends value changed specified attribute. Enter value, then click
Tip:
change value Constant symbols also click Value entry popup menu that specific this type symbol. same Edit value dialog opens.
Changing also change manner which attribute displayed symbol: Symbol Attribute Preference Settings Right-click attribute field symbol interest. popup menu opens. Select Properties.
76/248
Chapter following dialog opens:
Symbols
Change preference settings desired values. Select appropriate Alignment Direction settings corresponding drop-down lists. change color text, click Edit select color from displayed palette. have name value displayed scheme check appropriate box. Click confirm changes have made preference settings. Mirroring Symbol Group Symbols Select symbol(s), then click
also Mirror option popup menu associated with symbol (right-click symbol). mirror group symbols, select group then click with right mouse button. popup menu displays. Choose Mirror.
Rotating Symbol Group Symbols
Select symbol(s) wish rotate, then click
selected symbol will rotated counterclockwise. also Rotate option popup menu associated with
77/248
Symbols
Chapter symbol (clicking symbol with right mouse button). rotate group symbols, select group then click with right mouse button. popup menu displays. Choose Rotate.
Viewing Symbol Information
Select symbol about which want view information. Click
information opens. When have finished viewing symbol information, click 7.2.2 Wiring Symbols Together Connecting Application Inputs/Outputs Almost symbols have least input output which connect wires (the only exceptions some subscheme symbols). Wiring symbols together creates data flow between them. default, input pin(s) left symbol output pin(s) right. This section describes wire symbols together, control attributes wires connect external application inputs outputs appropriate target microcontroller ports peripherals. Drawing Wires between Symbols wire symbols together: Select wiring mode clicking cursor changes crosshair, indicating that wiring mode. Place cursor first symbol, where want wire start. crosshair snaps onto when comes into snapping distance. indicates point which crosshair snapped. Click when crosshair snapped first symbol, where wish wire start. ST-Realizer will draw wire that follows cursor.
want define your wire corners, click twice where want each corner
Tips:
Move cursor second symbol, where
78/248
Chapter
Symbols wish wire end. Click when crosshair snapped onto appropriate point. places where clicked connected wire. Right-click mouse press click finish wiring. symbols connected wire.
Using Automatic Wiring:
also ST-Realizer draw wires you. Automatic wiring simplifies task wiring symbols together Automatically choosing shortest path between symbols connected (Auto wiring), creating corners where required. Automatically rerouting wires when symbol moved (Auto rerouting). Both these options enabled default. details "Wire Drawing Options" page Select wire copied. Click
Copying Wire
Drag drop ghost wire where want place Note that attribute values also copied. copy wire clipboard, click Pasting Wire from Click then drag drop ghost down location wire. Clipboard Moving Wire Select wire, click once drag drop ghost with four-headed arrow pointer down location wire. Select wire group wires. Click press key.
Deleting Wire
Note that delete also other objects group, such symbols. delete wire place clipboard, select symbol click
Mirroring Wire
Select wire, then click
79/248
Symbols
Chapter
Rotating Wire
Select wire, then click
selected wire rotated counterclockwise. Changing Wire's Attributes Click wire with right mouse button. popup menu opens: Click name attribute want change. Edit Value dialog opens: Enter value, then click
Connecting Input/ Output Symbols Microcontroller Pins, Ports Peripherals
Application input output symbols must connected microcontroller input output pins, ports peripheral control registers order application function.
Note:
Application Input Output symbols are: adc: digin:
digout:
input:
inputlatch:
output:
outputlatch:
event
eventenable
80/248
Chapter connect these symbols target microcontroller port peripheral: Right-click double-click symbol. This popup menu opens: Click Connect. Hardware Connections window target microcontroller opens. resources available this window vary depending target microcontroller. Select appropriate device pin.
Symbols
Click right arrow double click selected device name. Click
Tips:
have connections device sorted order, check Sort resource box. peripheral register that wish connect does appear list left side window, click Properties button. This will open Hardware settings dialog box, allow enable peripheral that desire use. When return Hardware connections dialog box, registers bits peripheral just enabled should included list.
81/248
Working Schemes Working Schemes
Chapter
This section describes general functions utilities available when working scheme, such viewing options. Viewing hidden attributes. print schemes. title comment scheme. Using Zoom-In View Click then click blank area scheme worksheet.
also click Zoom entry View cascading menu obtain clicking blank area scheme worksheet.
Note:
Zooming magnifies view 200%.
Zooming Selected Area Using ZoomOut
Click
then select area scheme want zoom
Click
then click blank area scheme worksheet.
also click Zoom entry View cascading menu obtain clicking blank area scheme worksheet.
Note:
Zooming reduces magnification 50%.
Using Full Screen View
Click
also click Full view entry View cascading menu obtain right-clicking blank area scheme worksheet. Redefining View Click then click where want centre scheme. Center your Scheme also click entry View cascading menu obtain clicking blank area scheme worksheet.
82/248
Chapter Printing Currently Active Scheme
Working Schemes Click File-Print sequence main menu bar. Continue normal printing dialog click when ready. Printer File menu, click Printer setup. standard Windows Print Setup dialog opens. Refer your Windows documentation further information. Click when have finished setting your printer. Choose Printer Font File menu, click Printer setup, next click Properties Font tab.
best results, True-Type fonts that come standard with your Windows environment.
Tip:
Printing Project Schemes
Click Project select Print drop-down menu: Continue normal printing dialog click when ready.
Viewing Hidden Attributes
When shapes pins that make symbol created, attributes assigned them define additional characteristics. These attributes visible default when design application, since they only refer parts symbol itself. STRealizer enables view hidden attributes: Click Invisible attributes entry View cascading menu
83/248
Working Schemes
Chapter obtain clicking blank area scheme worksheet. When Invisible attributes option selected, attributes visible.
Placing Title Right-click blank area scheme. Scheme popup menu appears. Select New/Attribute options. Create attribute dialog opens.
Specify following options: Enter title text Value edit box. Under Visibility, there options. wish only title text that typed appear, select Value only. wish attribute appear well this case "TXT title text"), select both Value. specify color, size alignment values title. Place heading dragging where want click
84/248
Chapter
Subschemes, Execution Conditions Events
Subschemes, Execution Conditions Events Subschemes exactly what their name implies-additional schemes that subservient root scheme. Their appearance similar root scheme, that they also contain symbols wires. However, subschemes exist apart from root scheme, only executed when called upon subscheme symbol root scheme. previously discussed, there three reasons create subscheme: include complex portions main loop, thus saving space root scheme making easier reuse processes. this case, subscheme executed were part main loop. include parts application that event-driven. (Events never placed root scheme.) Subschemes assigned either single execution condition, which will apply entire subscheme, alternatively, include number event symbols. More will said about execution conditions events shortly. save functional parts your application (analogous subroutines) that wish reuse other applications. Subschemes saved their files (.sch files) easily copied other ST-Realizer projects reused. also save customized subschemes symbols library, accessible projects. (Subscheme symbols described below).
Designing subscheme different than designing ordinary scheme, with exception-a subscheme connections root scheme subscheme symbol. subscheme symbols named sssp_q, where indicates number inputs need your symbol number outputs. example, sss2_1 subscheme with inputs output. When want subscheme, must therefore first think about connections: what inputs does subscheme need deliver output. Once know this, choose correct subscheme symbol from main library. Subschemes linked events (either definition execution conditions inclusion event symbols) basically annexes root scheme, therefore, same rules that apply root schemes must apply them. However, those subschemes which execution conditions attached, which event symbols embedded, special cases, rest this section dedicated describing configure subschemes with execution conditions event symbols. 7.4.3 Description ST-Realizer Events Events general concept (described Section page allow conditional execution code within application. outlined above, event applied
85/248
Subschemes, Execution Conditions Events
Chapter
entire subscheme, called execution condition; applied only portion code within subscheme, event takes form event symbol. following paragraphs give list principle types events-those that hardwareindependent, meaning that they available microcontrollers-and those that hardware-dependent, meaning that they make peripherals that only available certain microcontrollers. Events that independent target hardware device: Upon subscheme input change Code contained subscheme executed each time input signals coming from parent scheme changed. This similar If.Else switch standard programming algorithms. diagram right shows schematic flow diagram application with subscheme having this type event (either execution condition event symbol).
Reset entry point
Initialization
Normal Code Execution
Subscheme input(s) changed?? Subscheme Code
Normal Code Execution
86/248
Chapter
Subschemes, Execution Conditions Events
Once period time specified elapsed, subscheme periodic code part will executed periodic counter will reset. periodic event execution condition analogous If.Else statement, where condition whether specified number ticks have been counted beginning each main loop cycle.
Time Elapsed?
Periodic Code Part/ Subscheme Normal Code Execution
example, beginning each main TIMER loop cycle, number timer ticks elapsed during previous main loop cycle written variable called "rtick"(1). other Update timer words, during execution main loop datastructures cycle value rtick equal number ticks elapsed main loop cycle n-1. Because periodic events execution conditions together rtick values count elapsed time, they relatively imprecise timing methods should used when application requires very precisely timed event take place. example, imagine that wish define event period equal timer ticks. that during first main loop cycle, number timer ticks elapsed equal value rtick duration second main loop cycle will therefore equal However, during second main loop cycle, because other events interrupts, execution time longer, timer ticks elapse. value rtick will
more detailed look variable "rtick" related timer tick provided page 131.
87/248
Optimized part (Periodic Optimization)
Periodic Events periodic event, execution condition, acts level main loop. Inclusion periodic event causes counter based number base clock timer ticks elapsed previous main loop cycles measure certain period time. (Therefore, period specified must always whole number multiple timer tick's value).
Reset entry point
Initialization
Normal Code Execution
Subschemes, Execution Conditions Events
Chapter
duration main loop cycle, that when periodic event evaluated, adds together values rtick that received completed main loop cycles, arrives total timer ticks. Evaluation elapsed time periodic events always performed using "equal greater than" condition. Therefore, event will take place during main loop cycle. However, there will imprecision least timer tick this particular case, because specified period timer ticks actual elapsed time timer ticks beginning main loop cycle. Timed interrupts Timed interrupts very precise method timing event, because timed interrupt executed independently main loop application, measures time directly from base clock timer tick. While periodic events count cumulative value elapsed timer ticks beginning each main loop cycle, timed interrupts count each elapsed timer tick occurs. This means that soon specified amount time (i.e. specified number timer ticks) elapsed, interrupt immediately executed. other words, timed interrupt triggered directly from hardware clock (for example, Timer Timer measuring timer ticks, rather from evaluation main loop variables (such rtick) which count number timer ticks elapsed previous main loop cycle. Therefore, matter what main loop doing, when specified time elapsed, main loop interrupted timed interrupt code subscheme performed immediately.
Reset entry point
Initialization
Normal Code Execution TIMER
Update timer datastructures
Time Elapsed?
Timed Interrupt code part
Return from Interrupt
88/248
Chapter
Subschemes, Execution Conditions Events
Event that hardware-dependent are: Peripheral interrupts These interrupts that occur when specified peripheral signalled application some way. example would peripheral, which uses RS232 protocol transmission. specify interrupt, interrupt would occur (independent main loop) when transmission occurred. 7.4.4 Execution Conditions Execution conditions applied subschemes, such that subscheme only executed when certain conditions met-such timed interrupt, upon subscheme input change. Subschemes with execution conditions allow perform tasks addition main loop, execution condition met. this way, subschemes with execution conditions analogous subroutine operations. While root scheme runs constant loop from time application starts when stops, subschemes only performed when specified execution conditions. There variety execution conditions that assign subscheme, these vary depending target microcontroller which application designed, furthermore, upon which microcontroller's peripheral have been enabled application. 7.4.5 Event Symbols Event symbols analogous execution conditions, while execution conditions apply entire subscheme, event symbol placed within scheme, acts trigger only certain portions subscheme. When conditions necessary trigger event symbol met, event symbol outputs binary value "1". When event symbol's conditions (i.e. event triggered), event symbol outputs binary value "0". However, none event symbols subscheme triggered, subscheme effectively invisible rest program code within executed. Event symbols assigned much same execution conditions-all same options available. However, because more than event symbol included single subscheme, they used means imposing range conditions same, similar sequences code. Because this functionality, event symbols were conceived more means controlling hardware-dependent interrupts, than allpurpose condition trigger.
89/248
Subschemes, Execution Conditions Events
Chapter
Reset entry point
Initialization Normal Code Execution
Subscheme Code symbol sequence Event
event symbols
out1
Event Subscheme Symbol
out2 symbol sequence
symbol sequence
Normal Code Execution
revisit flow chart shown Section 2.6.5, different event symbols incorporated same subscheme, they influence (and under which conditions) code subscheme executed. this schematic example, have placed subscheme symbol midst normal code loop (i.e. root scheme) that references subscheme containing event symbols. neither conditions defined event symbols met, subscheme ignored. However, either both events triggered (meaning that their conditions met), then code subscheme executed following manner: Event triggered event's condition being met): Symbol sequence will performed with output signal equal (out other words, symbol sequentially following Event symbol will have binary value input signal, rest code sequence will executed accordance. Symbol sequence will performed with output signal equal (out2 other words, symbol sequentially following Event symbol will have binary value input signal, rest code sequence will executed accordance. Symbol sequence will performed unconditionally (there event symbols connected this code sequence).
90/248
Chapter Event triggered:
Subschemes, Execution Conditions Events
Symbol sequence will performed with out1 Symbol sequence will performed with out2 Symbol sequence will performed unconditionally. neither Event Event triggered, part subscheme code will performed.
7.4.6 Compatibilities Between Types Events Certain Symbols There certain rules concerning which types events placed together same subscheme, because some types events have priority over others, furthermore, some types events incompatible when placed together same subscheme. Event types that placed together same subscheme: number peripheral interrupts. When these interrupts occur simultaneously, program will give priority peripheral accordance with settings. timed interrupt number peripheral interrupts. Once again, execution priority given accordance settings. Periodic events upon subscheme input change events placed together same subscheme. Execution priority less importance, because neither these events independent main loop (i.e. each event triggered value that augmented incrementally with base clock timer tick). both events occur simultaneously, event symbol closest upper left-hand corner subscheme will treated first.
Event types that never placed together same subscheme: More than timed interrupt. periodic event timed interrupt. periodic event peripheral interrupt. "upon subscheme input change" event timed interrupt. "upon subscheme input change" event peripheral interrupt.
above event types placed separate event symbols same subscheme, error message will result when ST-Analyser.
Note:
Compatibilities between Events Time-Related Symbols Periodic events time-related symbols completely compatible, because they both count elapsed time identical manner.
91/248
Subschemes, Execution Condi

Other recent searches


WEDPN16M64VR-XB2X - WEDPN16M64VR-XB2X   WEDPN16M64VR-XB2X Datasheet
SSOT-3 - SSOT-3   SSOT-3 Datasheet
HSD278 - HSD278   HSD278 Datasheet
CAT3643 - CAT3643   CAT3643 Datasheet
AN2285 - AN2285   AN2285 Datasheet
ADC12L066 - ADC12L066   ADC12L066 Datasheet
74AC14 - 74AC14   74AC14 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive