Home
ST-Realizer ® II USER MANUAL June 1999
Contents
1. 144 Sine Wave 148 DIACINO PME 148 Square Wave 150 PIAC le WEE 150 setting values neneenn ennenen 150 time table cece ee eee eeeeeeeseesseseaeeaes 146 steer 146 setting values 146 values recording esssesssenenernnreneene 139 160 reusing csecceneeceeneeeeeeeeeneeens 139 160 ALLOCATEBLOCKIN attribute 207 ALLOCATION attribute 207 Analog to digital symbol 80 Analyse 9 421010 0 133 what to do if there are errors 134 Analyse and compile report 135 Ayr Analyse error messages 134 viewing and tracing 135 Analysing and generating your application ssssusss 129 Application development steps 11 Applications introduction fo 5 simulation of 139 structure Of t 4 Apxd variable Variables POX ME 64 Arguments for macOS 188 Attaching numeric adjusters to pins 143 Attribute preference settings for symbols 76 Attributes T 206 ALLOCATEBLOQCKIN 207 ALT OCGATION 207 attaching to symbols 182 BLOCKSIZEINUNITS 207 Eegen 207 COMMENT E 207 EV e 207 OODE E 208 LADET rerna 208 NAME 208 STEE 208 En EE 208 E 208 FINI
2. 8 3 Logic Symbols Sequential Wait Symbol Reads a physical input and waits until it equals a pre defined value This symbol is meant for short and time critical operations Name Physical input type All The user is prompted for the symbolic name In The input type equals the Val input type The connection is made to a physical micro controller pin or register and is invisible Val The comparison value En type Boolean When true the physical input is continuously read until the physical value equals the Val input Out type Boolean A copy of the En input This output is used for linking sequential symbols Note When the wait sequence is started all normal execution process are halted The physical input is read continuously until it equals the Val input Only the interrupts are still active The watchdog is re loaded Logic symbols perform logical functions essential to most programs With these functions you can control a program s path and depending on whether the logical condition is satisfied or not divert the application into different subschemes or subdiagrams ky Two value binary AND function symbol with type inheritance Z AANDB A type Any type BIT LONG B type Any type BIT LONG Z type The largest A or B type Note ANDing a BIT type value and a WORD type value is not allowed Three value binary AND function symbol only applicable to BIT type values Z A AND B AND C 107
3. 11 4 7 Creating the New User Defined Symbol Macro Once the macro header has been pasted into an ASCII text file the next step is to write the rest of the macro for the new symbol Writing macros requires a knowledge of the assembler programming language and it is now within the scope of this document to instruct the user how to write assembler code We will simply give some general guidelines to follow and show how the assembler macro for the our example symbol Stepper was created General Rules When you create your own macros for inclusion in ST Realizer applications you must follow the rules described below e Symbols using multi type pins require two macros one for the BIT type and one for the WORD type Symbols only using BIT type pins require one macro call e The macro instructions are written in assembly language using any plain ASCII text editor Remember to save the ASCII file asa mac file for ST6 or as an inc file for ST7 For ky 187 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 example we could save our Stepper symbol as stepper inc Naming Macro Instructions The names of macro instructions are a concatenation of the following e The attribute value e The type of the input output variable ranked by the pin number The type of the input output variable uses the following convention w for a WORD type b for a BIT type bb for a BIT clock input ww for a WORD clock input For ex
4. 62 5 3 4 General Hardware Configuration cee ee ee eee 63 5 3 5 Memory Configuration 0 0 0 0 ce eee 65 5 3 6 Enabling Peripherals 66 CREATING OPENING SAVING SCHEMES lle 67 Cal OCNCINGS S xax god abord dul OR dolut i d RE UR CR f I R8 UA OR o ER S UR Be 67 6 2 Creating a New Scheme lllell eee ees 67 6 2 4 Opening the Root Gcheme 0 0 cc ee 67 6 2 2 Creating Subschemes and other Schemes 68 6 3 Opening a Scheme 0 cc eee eens 69 6 4 Saving Schemes sese 69 www BDTIC com ST Table of Contents Y BUILDING SCHEMES i222 2 c lt ce00ceveceetneies tere Ee d E ante s 71 7 1 Schemes and their Components cc ee eee 71 E lee 71 7 2 1 Placing and Controlling Symbols 72 7 2 2 Wiring Symbols Together and Connecting Application Inputs Outputs 78 7 3 Working IN Schemes a auis dhs gee ee bobo ee ER Gee eEZrzibe zbdond REGE 82 7 4 Subschemes Execution Conditions and Events 85 7 4 3 Description of ST Realizer Events 85 7 4 4 Execution Conditions 89 74 5 EventoymbolS 00nd ce0 0 642406440004 Sino Stead seadecen 89 7 4 6 Compatibilities Between Types of Events and Certain Symbols 91 7 4 Subscheme Operations ll ee eee 92 145 Table SVUHDOLS ico ooo a4 woe dr dod E dep act doa eS uar door dones Redi ded 99 8 THE MAIN SYMBOL LIBRARY eceeern nnn 103 8 1 Input an
5. e Call the following subroutines that are created by ST Realizer 157 63 248 www BDTIC com ST 4 64 248 Hardware Configuration Chapter 5 Portlnit which initializes the I O ports according to the ST Realizer application Ramlnit which initializes the RAM allocated by the ST Realizer application Reallnit which initializes the S T Realizer application RealMain which executes the ST Realizer application The Portinit Raminit and HReallnit must be executed once and the RealMain subroutine must be executed continuously Perform all the interrupt management Fill in the input variables that are used by ST Realizer application and copy the output variables of the ST Realizer application to the data registers of the I O ports The input variables are Apxd where x is the port name A B or C and d is the pin number 0 7 This is a set of variables generated as the result of the A D conversion These variables are already allocated with the size of one byte RTICK This is the one byte timer tick variable This must be filled with the number of ticks during the last execution of the RealMain subroutine The output variables are of the form BUDRx where x is the port name A B or C and each variable is one byte in length Their contents must be copied to the data registers of the appropriate port Include files for user defined macros If the scheme you are analysing and compiling includes a symbol that you created
6. fee Create attribute Color mm Edit Tag SIZE 20 mm VALUE sl Alignment Value Horizontal Center E Vertical Center B Direction Hommel e V Isibiliby Cancel T ad Iv Value e Inthe Tag drop down list select Value 184 248 d www BDTIC com ST Our Stepper symbol should now appear as at right Chapter 11 Defining a New User Defined Symbol e Inthe Value field type 1 This is the default value for the attribute e Under Visibility check the Value box only e Click OK when you have finished defining the attribute e The cursor becomes a ghost box indicating the size of the attribute Position the cursor just beside the text Step Value and click once Click again to return to normal editing mode Step Value 11 4 5 Modifying Existing Attributes You can change the properties of an attribute you have already created while still in the symbol editor 1 Select the attribute by clicking on it For example in our Stepper example we would like to remove the pin numbers Select the pin number 1 by clicking on it i S Rotate k Tag oq Point of Effect 2 Properties k N S 4 Step Value 1 2 Right click the mouse A popup menu appears as shown above Select Properties Ay 185 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 A Change properties dialog box appears fee Change properties E4 Color Em Edit Ta
7. The run options are Whether you want to run the simulation continuously for a set number of loops or for a set time period 158 248 ky www BDTIC com ST Chapter 10 Running the Simulator When continuous simulation is chosen you stop the application when you want Periodic adjusters such as square wave adjusters and sine wave adjusters are particularly adapted to this mode When a set number of loops is chosen you can execute one loop at a time Note that in this case a loop time is the time needed to execute all the macro instructions and not the tick which is the time base used by ST Realizer e Whether you want to use your PC s clock or the microcontroller clock for the simulation Note that if you use the PC s clock the sampling time is the end of the execution loop The corresponding absolute time is recalculated using the PC s clock This mode is much faster to run since the number of sampled points is lower however the lower sampling frequency causes a loss of precision To set these options Uptonz vVincdow 1 Onthe Options menu click Simulate simulata Environment The Simulating daughter dialog box opens Simulate options Logging Simulation mode Fin level Running made Continuous Timing mode Target time M Enable accurate simulation Enabling this option will result in a mare accurate but slower pin level simulation UK Lancel ky 159 248 www BDTIC com
8. heating sef for example A pin level drawing of the target microcontroller appears such as shown at right Note that where the pins have been connected to application input output functions the pin names have been replaced by the function names SCK If you double click on the pin level drawing you will open a copy of your root scheme diagram as another window You can also open subschemes by double clicking on the subscheme symbols MISU rir cer AER MOSI OCMP2_ A rir Do re em ICAP A You can use both the pin level drawing and the scheme diagrams to help you run the simulation both views are useful in evaluating whether your application is running as ies ce you wish Temperature ICAP1 B UC A Setpoint UCI B To see all views at once under the Window menu select Tile ICAP B CLEOUT 140 248 ky www BDTIC com ST Chapter 10 Working with Simulation Environment Files You ve now created a new simulation environment file for your application Don t forget to save your work see Section 10 1 3 below 10 1 2 Opening an Existing sef File 1 If you are already running ST Realizer open the Simulator Window by clicking on Simulator on the elei Window Help cimulatar m ST Realizer Tools menu A symbol Editor Cristi ON K Tip You can access ST Simulator directly from Windows by selecting Start 2Programs gt ST Realizer Il 2Simulator Ny 2 Once you are in ST Simulat
9. 11 4 4 Assigning Attributes to Your Symbol 182 11 4 5 Modifying Existing Attributes 185 11 4 6 Creating the Macro Header 187 11 4 7 Creating the New User Defined Symbol Macro 187 11 4 8 Writing the Assembly Macro 188 11 4 9 Adding New User Defined Symbols to a Library 191 d www BDTIC com ST Table of Contents 12 CUSTOMIZING ST REALIZER 0 cee 193 12 1 Automatically Saving Your Work and Setting Screen Preference 194 12 2 Attribute Display Preferences 0 000 195 12 3 Worksheet Layout Preferences 000 cece ees 196 124 nung ODHOLIS scs ou 9 Da cee ce eee ee oe ue Abas Ae ee ees See eo mee ees 197 12 5 Symbol Layout Preferences 00 ccc eee eee 198 12 5 GUSIOMIZING OOIDAIS 2444254540 e cae sede eh ee ee S idR A S 199 12 6 1 Adding and Deleting Toolbar Buttons LL 200 12 6 2 Placing Separators Between Toolbar Buttons 200 12 6 3 Changing the Order of Toolbar Buttons 5 200 12 6 4 Restoring the Default Toolbar 0 0 ee eee 200 12 7 Wire Drawing Options 201 Appendix A Variables and Attributes 0 0 0 ce ee 203 A1 Variable Types and Hues 203 A1 1 Type Inheritance llle 204 Pd Type Ov rm lng ase os o4 3 4 A rfr YR CROP CERNI Rol E EE Gees 205 A2 Attribute Tvpes RR nr 205 A2 1 mitbieten 206 A2 2 Symbol Attributes a a naana aaa ees 207 A
10. 128 user defined sesnnsssnnesennnnserensenneeen 64 W lt 126 WAItSequence ssss nneoeennneeeeenreeeerereeeee 107 57 Wiring PESEE 78 wiring together eessssssees 78 WMETQE oosnnossnsssnnssiiissinnnrinsernnernnerrnsernen 123 WDaCkK esseeeenenenee 123 Urn mc M 123 WwuUnpaCk 124 MOM SE 109 T TABLE attribute 208 Table symbols changing data formart 100 editing data 100 importing data files into 101 INSEM NQ oonnnnoonnnnnnonnnnnnnennnnnnsnnnnnssennnnnnnn 100 Tables data format CNAN Un Le 100 editing data in sssssssses 100 importing files 101 WAC OX RR 99 208 fero COD 99 208 ROM U 208 Target Hardware changing fe 61 configuring Une 62 requirements nnooennnanoennaannnnnannneene nnne 1 dado s deeg 62 specifying device 59 Target Microcontroller see Target Hardware Target dependent events 96 TIME attribute noanooooeeennnnnnnnennseenrenennnnn 209 Time table adiusierg 146 Timer ticks changing the value of 131 introduction To 10 A 10 Oopilons 131 Toolbar buttons sse 199 TUON E 13 TXT attribute 20 eccceeceeeeessse
11. 997 7554 GEORGIA Norcross Tel 770 449 4610 Fax 770 449 4609 ILLINOIS Schaumburg Tel 847 517 1890 Fax 847 517 1899 INDIANA Kokomo Tel 317 455 3500 Fax 817 455 3400 Indianapolis Tel 317 575 5520 Fax 317 575 8211 MICHIGAN Livonia Tel 313 953 1700 Fax 313 462 4071 MINNESOTA Mineapolis Tel 612 835 3500 Fax 612 835 3555 NORTH CAROLINA Cary Tel 919 469 1311 Fax 919 469 4515 NEW JERSEY Voorhees GE ax Basking Ridge Ed Fax 609 609 908 N 72 6222 72 6037 66 7401 66 7738 JNN 908 M ee e NEW YORK Poughkeepsie Tel 914 896 2926 Fax 914 897 3734 OREGON Lake Oswego Tel 503 635 7635 Fax 503 635 7677 TENNESSEE Knoxville Tel 615 524 6239 Fax 615 524 6247 TEXAS Carrollton Tel 972 466 8844 Fax 972 466 8130 Houston Tel 281 376 9939 Fax 281 376 9948 FOR RF AND MICROWAVE POWER TRAN SISTORS CONTACT THE FOLLOWING REGIONAL OFFICE IN THE U S A PENNSYLVANIA Montgomeryville Tel 215 361 6400 Fax 215 361 1293 ASIA PACIFIC AUSTRALIA DINGLEY VIC 3172 Suite 6 Business Centre 14 Garden Boulevard Tel 61 3 9558 3399 Telefax 61 3 9558 3377 NSW 2220 HURTSVILLE Suite 3 Level 7 Otis House 43 Bridge Street Tel 61 2 9580 3811 Telefax 61 2 9580 6440 CHINA Liaison Offices BEIJING Beijing No 5 14 Wu Lu Tong Road De Sheng Men Wai Tel 86 10 202 4378
12. Cancel www BDTIC com ST 149 248 Setting Adjusting and Viewing Input Values Chapter 10 5 Fill in the values that will define the amplitude and frequency of the sine wave input e To set the bottom range of the wave amplitude edit the value in the Bottom field e To set the top range of the wave amplitude edit the value in the Top field e To set the wave frequency edit the value in the Frequency field 6 Click OK 10 2 7 Setting Square Wave Input Signals To set a square wave input signal you must attach a Square Wave Adjuster to the appropriate input pin or wire Square Wave Adjusters let you set the signal amplitude duty cycle and frequency To attach a Square Wave Adjuster to a pin or wire 1 Select the pin or wire to which you want to connect the adjuster by clicking on it 2 Click 3 Click where you want the adjuster to appear The adjuster is now placed in your scheme and connected to the pin or wire you selected In the example at right we SCK see that the square wave adjuster has MISO been connected to the pin called MOSI Setpoint which is also the name of the DCMP2 A input symbol Note that the square wave ICAP2 A adjuster shows the name of the pin OCMP1 A whose input the adjuster controls EC BS Heztingls DN 4 Set the signal amplitude duty cycle Munus ICAPI B and frequency by Bib Setpoint OCMPi B e Double clicking the adjuster ICAP2 B CLKOUT Or Increase size e Right clicking o
13. Macro INC c 64 Macro parameters eese 188 Visio e GE 208 Slvetf lu 188 creating E 187 NAMING NETTEN ERR 188 Main symbol library 103 PTAs Oral E 73 mainper lib Iran 13 Memory Configuration ssesnneaeneaanaeaeeaen 65 Memory confguraton 62 Monitoring simulated egonals 151 Multitype pinms E 203 N NAME attribute 208 Naming Macros eeoonnneeeoenneeeeeeneeeerereeeeeee 188 NMI signal event 96 Non volatile variables 207 Numeric adjusters a0onneeennaannnannenneeen 143 O OCODE attribute ss 208 Opening FO FS E 56 schemes EE 69 simulation environment file 141 COTS el 133 Oscilloscope probes 159 Output ej 181 BY IANO ONG cute tedciteitesai cientes i Papier iaeue e 80 Output svmbol 80 outputlatch svmbol 80 239 248 www BDTIC com ST INDEX P Page preferences sees 196 Parameters for macros 188 Passive output poim 181 Periodic event 95 Peripherals Sie le trm 66 le 62 Pin type 206 Pins multtvpe EE 203 Placing symbols mascheme 72 portin symbol portout symbol essuesss 92 Portlnit subroutine sssss 64 Preference
14. Purchase of IC Components by STMicroelectronics conveys a license under the Philips PC Patent Rights to use these components in an DC system is granted provided that the system conforms to the IC Standard Specification as defined by Philips STMicroelectronics Group of Companies Australia Brazil Canada China France Germany Italy Japan Korea Malaysia Malta Morocco The Netherlands Singapore Spain Sweden Switzerland Taiwan Thailand United Kingdom U S A Recycled and chlorine free paper www BDTIC com ST
15. conditions and actions Event or Input Signal State Transition Setup Time has SetupTime HeatingOFF Pilot LED OFF elapsed Measured Temp otart HeatingON Pilot LED ON is lower than Control Temp Measured Temp Stop HeatingOFF Pilot LED OFF exceeds Control Temp System switches SetPump PumpEnabled Pump speed to HeatingON control active state Event Timer Interrupt No state transition Input acquisition active 1 For more information about Events please refer to Section 7 4 on page 85 d 18 248 www BDTIC com ST Chapter 3 Tutorial When you define the state machine the first symbol you must place is the initial state For the heating control application the initial state is nit This is a holding state that allows time for the application to measure and filter the actual temperature before deciding whether to turn on the heat pump 3 2 5 1 Placing the Initial State To place the initial state Init 1 Click H 2 The main library dialog box will open as shown at right All of the symbol names are categorized by function A complete listing of symbols organized by functional category and name can be found in Chapter 8 on page 103 The initial state symbol is called stateinit located under the State machine category Find stateinit and select it by e double clicking on it Or e clicking once on it and without moving the cursor Mam lib Ed Input and output Sequential Logic Time
16. if tData eq TCONST ld A low Data shr 16 endif if tData eq TUBYTE or tData eq TUINT clr A endif if tData eq TSBYTE or tData eq TSINT clr A push CC bittjf Data 7 D amp labnr cpl A D labnr pop CC endif if tData eq TLONG ld A Data 1 endif if tin2 eq TCONST adc A low c5 shr 16 tendif ld S 1 A if tData eq TCONST ld A low Data shr 24 endif if tData eq TUBYTE or tData eq TUINT clr A 190 248 d www BDTIC com ST Chapter 11 Defining a New User Defined Symbol endif if tData eq TSBYTE or tData eq TSINT clr A push CC bittjf Data 7 G amp amp labnr cpl A G amp labnr pop CC endif if tData eq TLONG ld A Data endif if tin2 eq TCONST adc A low c5 shr 24 endif ld S A endif if tNS copyww S tS NS tNS comw NS tNS endif E amp labnr mend 11 4 9 Adding New User Defined Symbols to a Library You can save your new user defined symbol to a library by following these steps 1 3 In any ASCII text editor open the library file to which you wish to save your new symbol For example if you wish to save your symbol to the main library open lt root folder gt Lib st72lib mac the ST6 main symbol library or lt root folder gt Lib st72lib inc the ST7 main symbol library If you wish to save the symbol to a new library create a new ASCII file in the lt root folder gt Lib folder an
17. shows an M in its design countf pcountf 120 248 d www BDTIC com ST Chapter 8 Conversion Symbols Counter symbol with variable initial value A rising edge on the Up input pin causes the counter to be incremented by one A rising edge on the Dn input pin causes the counter to be decremented by one A high level on the Clr input pin causes the counter to be set to 0 countv pcountv A rising edge on the Pr input pin causes the counter to be loaded with the Pval input value When the counter output value Val reaches 0 the Zero output value 1 Up Dn Clr Pr and Zero types BIT Val and Pval types WORD When in the persistent non volatile library this symbol named pcountv shows an M in its design 8 7 Conversion Symbols Conversions symbols allow you to convert between different data types within the application 8 bit to 1 byte Packer Symbol Enables you to construct a byte out of eight bits BO to B7 type BIT W type WORD Af 121 248 www BDTIC com ST Conversion Symbols Chapter 8 1 byte to 8 bit Unpacker Symbol Enables you to unpack a byte into eight or less bits W type WORD BO to B7 type BIT Multi purpose Comparator Symbol if B gt A the B gt A output takes bit value 1 if B A C the B A C output takes bit value 1 if B lt C the B lt C output takes bit value 1 A B C types WORD output types BIT Type conversion symbol that enables
18. tables subschemes hierarchical sheets states input devices output devices and sequential counted or time related events 4 248 d www BDTIC com ST Chapter 2 Inside ST Realizer Applications The symbols are made such that you need never write a single line of assembler code to produce your application all of the attribute modifications you may need to perform are accessible through dialog boxes 2 3 Inside ST Realizer Applications An application is built around an ST6 or ST7 microcontroller unit MCU The input signal s enter the application from one or more of the microcontroller s pins ports or peripherals The application treats the input signal s as you require and the result is output to one of the microcontroller s pins or ports The figure below shows a generalized view of an application The input signal s enter the application via one of the MCU s pins ports or peripherals and is taken up by the root or main scheme The root scheme is the core of the application the main sequential loop If the application requires any interrupts you must create a subscheme Interrupts cannot occur in the root scheme If you simply wish to section off a very complex part of the application for aesthetic reasons you may also create subschemes to contain parts of the main loop Subschemes are represented in the root scheme by subscheme symbols of which more will be said a little later Application Root Sch
19. 1 Overview ST Analyser is a built in tool that analyses your application for errors and converts it into either SI6 or ST7 code depending on the target microcontroller If any errors are encountered during the analysis and code generation online information is provided to help you locate the error and take corrective action When you execute the analysis and compile ST Analyser analyses the current project by creating the netlist and cross references then analysing and generating the final code During this process all project schemes are checked for connections between symbols I O assignments and variable types before generating the source code Providing no fatal errors are encountered ST Realizer generates a non compiled ST macro assembler language asm file from the scheme ST Analyser then generates the binary ST code This process runs the STMicroelectronics ST assembler Depending on whether or not you included the ROS see Section 2 3 on page 5 and Section 5 3 4 on page 63 a file with extension hex or obj respectively is generated for S16 or with extension s19 or obj for ST7 A hex or s19 file can be directly loaded into an ST MCU while you must link a obj file with another program When the analysis process has been successfully completed a report file is generated This report file gives information about the designation of I O pins a list of the variables used by type and the memory space required by the appl
20. 2 Click 5 3 Click where you want to place the copy beside the HeatingOFF state symbol as shown in Figure 1 4 23 248 www BDTIC com ST Tutorial Chapter 3 4 Double click the name of the symbol The Edit the value dialog box opens Type Start the name of the new condition then click OK 5 For the HeatingON state symbol select and copy the HeatingOFF state symbol SH using to Place it beside the Start condition symbol Double click the name of the symbol and enter the new value HeatingON as shown in the diagram 6 Create the SetPump condition in the same manner that you created the Start condition Note that in the State Machine diagram the SetPump condition symbol is in the opposite direction to the Start condition symbol You can change its direction using the mirror function by clicking on d or by rotating it to the required D position by clicking twice 7 For the PumpEnabled state symbol select and copy the HeatingON state symbol SE using Place it at the bottom of the State Machine diagram Double click the name of the symbol and enter the new value PumpEnabled as shown in the diagram 8 For the Stop condition symbol select the select the SetPump condition symbol sel click d to copy it place the new symbol at the left of the PumpEnabled state symbol then enter the value Stop The next step is to wire the HeatingON state symbol the three new condition symbols and the PumpEnabled state symbol Look at
21. 248 www BDTIC com ST Logic Symbols Chapter 8 Four value binary AND function symbol only applicable to BIT type values Z A AND B AND C AND D Six value binary AND function symbol only applicable to BIT type values Z A AND B AND C AND D AND E AND F Eight value binary AND function symbol only applicable to BIT type values Z A AND B AND C AND D AND E AND F AND G AND H Change Detection Symbol An output pulse is generated when the input value changes IN type Any type BIT LONG OUT type BIT 108 248 d www BDTIC com ST Chapter 8 Logic Symbols D Element Symbol D flip flop symbol with multiple type data input D input is clocked in on a rising edge on the C input D input type Any type BIT LONG C input type BIT Q Q output types same as D When in the persistent non volatile library this symbol named pdff shows an M in its design D Element with Clear Symbol D flip flop symbol with multiple type data and clear input D input is clocked in on a rising edge on the C input The D flip flop is cleared when Clr is high D input type Any type BIT LONG C input type BIT Q Q output types same as D D Latch Symbol with multiple type data input D input is clocked in when C input is high D input type Any type BIT LONG C input type BIT Q Q output types same as D Two value binary Exclusive OR function symbol with type inheritance Z AXORB A type
22. 3 The Edit the value dialog box opens Type HeatingOFF in the field then click OK 4 Now wire the SetupTime condition to the new state symbol as explained above Your scheme should now look like this HeatingOFF gt Setup Time Now design the rest of the state machine diagram so that it appears as shown in Figure 1 The following paragraphs contain hints and explanations to help you Figure1 The final state machine diagram State Machine Diagram gt HeatingOFF HeatingON Setup Time SetPump 22 248 d www BDTIC com ST Chapter 3 Tutorial 3 2 5 5 Designing the Complete State Machine Diagram Hints and Explanations Reminder The application manages a heating control system The ambient temperature is periodically measured filtered and compared with a preset value When the measured temperature is lower than the control value the heating system is re started while the pump speed is adjusted proportionally to the temperature differential A pilot LED lights up to show that the heating is on When the measured temperature exceeds the control value the heating system is stopped When the application is started the initial state Init triggers a counter that allows enough time for the system to measure and filter the actual temperature value Once this time has elapsed the SetupTime condition is met and triggers the HeatingOFF state while simultaneously evaluating the temperature inputs If the temperature
23. Changing the order of toolbar buttons Restoring the default toolbar Note that the changes you make to the toolbar are not implemented until you open a scheme The following paragraphs describe how to perform these tasks 1 In the Environment Options dialog box click the Toolbar tab The Toolbar dialog box opens The Available buttons box lists the toolbar buttons that are available but are not currently being used The Active buttons box lists the toolbar buttons that are currently being used im Environment options Available buttons Analyse Do Simulate Go 4 File Mew File Oper File Save Separator Edit Cut Edit Copy Edit Paste Edit Delete Separator Select amp Wire Group Separator Analyse Results E Previus Messane Up Down Separator Default OK Cancel 199 248 www BDTIC com ST Customizing Toolbars Chapter 12 12 6 1 Adding and Deleting Toolbar Buttons 1 To add a button to the toolbar e n the Active buttons box select the button to the left of which you wish to add the new button e Inthe Available buttons box click the name of the button you want to add then click mg 2 To delete a button from the toolbar click its name in the Active buttons box then click Le 3 Click OK 12 6 2 Placing Separators Between Toolbar Buttons You can place separators between toolbar buttons so that you can group the buttons as you like For example you coul
24. IOR IOR MASK LD RTICK A RT IMEND LD A RTICK Ay OlO0H www BDTIC com ST Fast Counter Application 231 248 Fast Counter Application Appendix B Sample Applications JRNZ IRTCOO0OO3 JE RTCSKIP IRICOO003 Decrement 16 bit timers JRS 7 0257H RICOOSDS3 sub2www 037H 4 RTICK 2 037H 4 EICODOS RICSKIPj RINPEND moved to TIMERI interrupt CALL SUBOO002 LDI IOR IOR MASK copyww y2n9 4 v0n5 4 LODI IOR IOR MASK O10H moved to PORTB interrupt CALL SUBOO002 check for time out JRR 7 AT00001 UNIOOO0 LDI ATOOODITO l LDI ATO00001 1 43 CALL SUBO0001 UNI0000 input change detection on vn LD A v0n7 0 CP Beer Zb JRZ UNIOO01 JP EXECOOO03 UNIOO01 LD A vOn7 1 CP A pvOn7 1 JRZ UNIOOO02 JP EXECOO03 _UNTOOO2 JP NOEX0003 EXECOO03 CALL SUBO0003 NOEX0003 Disable interrupts for parameter passing LDI IOR LOR MASK copyww vOnl11 2 x4n5 2 copyww vO0n8 2 x4n2 2 copyww vOnl10 2 x4n4 2 copyww v0n9 2 x4n3 2 Enable interrupts LDI IOR IOR MASK O10H moved to TIMERI interrupt CALL SUBOO004 ROUTPEND d 232 248 www BDTIC com ST Appendix B Sample Applications Fast Counter Application copyww vOn7 4 pvOn7 4 LDI IOR IOR MASK LD A BUDRA LD DRA A LD A BUDRB LD DRB A LD A BUDRC LD DRC A LDI IOR IOR MASK O10H LDI HWDR OFFH JP RealMain SUBODO T 3s loopdelwww v0n5 4 svin2 4 vin0O 4 loopdelwww vlin0 4 pvin0 4 vini1 4 loopdelwww vinl 4 pvinl 4 vin
25. New Scheme Chapter 6 A new blank worksheet opens where you can draw the root scheme of the application 2 ST Realizer Beta heating File Edit Search Yiew Project Options Tools Window Help D d x i ts PZ i n O Ore AQ aUl gml C Program Files ST Realizer E xamples Heating heating sch Root 1320 0000 STG265C 4K ROM 128 bytes RAM 6 2 2 Creating Subschemes and other Schemes 1 Click Ej You may also click the File gt New gt Scheme The Create a New File dialog box opens 2 Browse to your project folder and specify the name of the scheme file sch extension 3 Click Save A new blank scheme opens ON Tip A new subscheme will not appear under the Schematics list in the Project Viewer until it has been connected to the project and the project has been Analysed To connect a subscheme to a project there must be a symbol in somewhere in the root scheme or in another subscheme which is connected to the new subscheme refer to Connecting a subscheme to a symbol in the root scheme on page 92 If the new scheme is not a subscheme it can only be connected to the project if it is declared as the root scheme ae 68 248 d www BDTIC com ST Chapter 6 Opening a Scheme 6 3 Opening a Scheme 1 Click Le You may also click File gt Open The Open a File dialog box opens 2 Enter the path of your project and specify the scheme name sch extension 3 Click Open l Tip To op
26. New Subscheme Symbol Chapter 11 A new dialog box opens where you specify labels for the subscheme output pins E Select the output pin properties Pin 4 label Dutt Back Next gt Click Next when you ve finished The Generate the symbol dialog box opens fee Generate the symbol Creating sub scheme symbol 2233 1 With 3 input pins With 1 output pins Click Finish to generate the symbol Back Finish Click Finish to generate the new symbol 168 248 d Chapter 11 Defining a New Subscheme Symbol The new subscheme symbol is automatically added to the local symbol library for the project in which you are working To save In1 Out the symbol in a library accessible to all projects follow the instructions in Section 11 3 1 In2 SSS3 1 7 i n3 To place it in your scheme click as explained on custom sch In our example at left the new subscheme symbol has 3 input pins and one output pin The associated subscheme is named page 3 custom sch however you may choose to leave this attribute field non specific by leaving the placed by default for example 11 3 1 Adding Your New Subscheme Symbol to a Library In order to use your new subscheme symbol or symbols if you have created more than one in any ST Realizer project you must save it to a library file located in the root folder gt Lib folder To do this 1 Open the project where you have created the new subsche
27. O type BIT ky 117 248 www BDTIC com ST Mathematical Symbols Chapter 8 Variable Timer Symbol A rising edge on the input pin name causes a pulse to be generated The Time input defines the number of clock ticks for the pulse default 10 ms 1 A O Time type WORD H O type BIT comment 8 5 Mathematical Symbols These symbols perform mathematical functions such as adding subtracting multiplying dividing integrating and differentiating so that you may treat and transform your application s signals Two value Add Symbol with type inheritance OUT IN1 IN2 IN1 type WORD H IN 2 type WORD OUT type The largest IN1 or IN2 type Average Symbol Takes average of IN1 and IN2 A OUT IN1 IN2 2 DAP average IN1 type WORD IN 2 type WORD i OUT type The largest IN1 or IN2 type Differential Symbol Takes derivative of input In with respect to time K is a constant input value rn S Out t 2 3 In t In t dt dt 1 3 Out t dt DIFF out ee K 2 3 dt k Type depends on input type Divider Symbol Q A B A Q R A B aly A B type WORD B B Q R type The largest A or B type 118 248 yy www BDTIC com ST Chapter 8 Mathematical Symbols Integral Function Symbol Out t Out t dt In t dt K 1 dt Type depends on input type Fixed Limiter Symbol Output value is not larger than the top value and not smaller than the bottom value type WORD O type
28. Sec ST72212G2 DIL28 connection overview Description Active low Oscillator In Oscillator Out SS Not connected SCK Not connected MISO Not connected MOSI Not connected OCMP2 A Not connected ICAP2 A Not connected OCMP1 A Not connected HeatingIsON Temperature Setpoint ICAP2 B CLKOUT OCMP1 B ICAP1 B Push pull output 8 bit analog input 8 bit analog input Used by the application Not connected Used by the application Used by the application Not connected Not connected Not connected Not connected Not connected Not connected Not connected Not connected Test mode pin Ground Power Supply bd The next and final part of this tutorial will to describe how to simulate and fine tune your application using ST Simulator d 46 248 www BDTIC com ST Chapter 3 Tutorial 3 5 Simulating and Fine Tuning Your Application Once you have designed and analysed your application you can use ST Simulator to simulate its behavior generate and view input signals monitor signals that are generated by your application and fine tune it if necessary In this part of the tutorial you re going to Create a simulation environment file which defines the environment in which you ll simulate your application Add adjusters to your simulation environment file which enable you to generate and view the signals that are input to your application Add probes to your simulation environment file which ena
29. Telefax 86 10 202 4378 SHANGAI 200233 108 10 Astronartics Building 222 Cao Xi Road Tel 86 21 6472 5415 Telefax 86 21 6472 6814 SHENZHEN 518001 52 Tao Hua Road Futian Free Trade Zone SHENZHEN 518048 Tel 86 755 359 0950 Telefax 86 755 359 1155 WANCHAI 22nd Floor Hopewell centre 183 Queen s Road East Tel 852 2861 5700 Telefax 852 2865 5000 INDIA Liaison Offices BANGALORE 560052 Diners Business Service 26 Cunningham Road Tel 91 80 267 272 Telefax 91 80 261 133 NOIDA 201301 Liaison Office Plot N 2 amp 3 Sector 16A Institutional Area Distt Ghaziabad UP Tel 91 11 853 0965 8 Telefax 91 11 855 6957 SALES OFFICES MALAYSIA 46000 PETALING JAYA SELANGOR Level 12 Std D PJ Tower A AMCORP Trade Centre No 18 Jalan Persiaran Barat Off Jalan Timur Tel 60 3 758 1189 Telefax 60 3 758 1179 PENANG 10400 Unit 9 A Lower Level 5 Hotel Equatorial 1 Jalan Bukit Jambul Tel 60 4 642 8291 Telefax 60 4 642 8284 KOREA SEOUL 19th Fl Kang Nam Building 1321 1 Seocho dong Seocho ku Seoul Tel 82 2 3489 0114 Telefax 82 2 588 9030 TAE GU 701 023 18th Floor Youngman Tower 111 Shinchun 3 Dong Dong Ku Tel 82 53 756 9583 Telefax 82 53 756 4463 SINGAPORE SINGAPORE 2056 28 Ang Mo Kio Industrial Park 2 Tel 65 482 1411 Telefax 65 482 0240 TAIWAN TAIPEI 106 20th Floor 207 Tun Hua South Road Section 2 Tel 8
30. View Invisible attributes from the main menu For our Stepper symbol we only wish to view the text and therefore only check the Value box To change the attribute color click the Color field and choose a new color 6 To change the attribute size edit the value in the Size field 7 f you want to change the vertical and horizontal alignment select the Alignment type from in the Vertical and Horizontal drop down lists Ay 183 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 8 Click OK when you have finished defining the attribute The cursor becomes a ghost box indicating the size of the attribute Position the cursor over the part of the symbol to which you want to attach the attribute and click once Click again to return to normal editing mode v Tip Note that the attachment point the item to which the attribute is attached Jl e appears as red spot in the symbol d Our Stepper symbol should now appear as at right Step Value Our Stepper symbol still lacks an essential attribute the value of the amount to increment the data input signal the Step Value For the moment we have only added text to the symbol this has no impact on the actual function of the symbol To add provide a numerical step value to the macro we need create another attribute e Click Sl in the symbol editor toolbar or select New Attribute popup menu The Create attribute dialog box opens
31. a internal frequency which is half the external frequency Fi Fe 2 2 Whether or not the Watchdog function is enabled The Watchdog function is a peripheral included on each ST6 and ST7 microcontroller Enabling the Watchdog initializes it and instructs ST Realizer to refresh the Watchdog regularly For more information on the Watchdog function please refer to your microcontrollers datasheet 3 Whether or not you want the ROS to be disabled The Realizer Operating System ROS is made up of macros or pieces of code that perform background tasks that must be added to an ST Realizer application for it to be complete and ready to load into an ST device In a certain sense the ROS is similar the BIOS of your PC ROS macros encompass such operations as chip initialization I O initialization timer initialization and data memory initialization that are essential to the running of your application Note Refer to Chapter 2 Introduction and Concepts on page 3 for an overview of the running of an ST Realizer program Alternatively you can disable the inclusion of the standard ROS macros and generate your own code to perform the ROS tasks instead The tasks which you must provide macros for are described below To disable the ROS e Click the Complete ROS check box ROS is disabled when the check box is empty unchecked e Click OK If you disable the ROS you must use an external program to perform the following functions
32. active state is you can place State Machine Probes probes that show the state machine s condition in the main scheme diagram To probes in the root scheme 1 Click on the connection wire you wish Note that State Machine Probes can only be connected to the initial state symbol in the State Machine Diagram 2 Click to connect a Numeric Probe or ve to connect the State Machine Probe 3 Click where you want the Probe to appear For example you may wish to place Numeric Probes and a State Machine Probe in the main scheme diagram as follows You may also add additional probes to the subscheme filter sch as desired to better understand how the application is working Now you have placed your adjusters and probes you can simulate your application adjust the values input to it and view the values generated by it d 52 248 www BDTIC com ST Chapter 3 Tutorial 3 5 19 Running the Simulator You are now ready to run the simulator and see how it reacts when you change the values input to it Click gt to run the simulation As you can see the oscilloscope starts generating its signal To simulate the behavior of the heating control system change any value in the analog numeric adjusters placed after the adc pins This causes the value of the pilot LED probe to be changed and the shape of the oscillator signal to display discrete levels Try adjusting the input values of the Setpoint and Temperature pins by clicki
33. and Viewing Input Values When you simulate an application you can set adjust and view the values input to the application This enables you to experiment with and fine tune your application To be able to set adjust and view input values and types you connect adjusters to the appropriate pins and wires in the pin level and scheme views of your application ST Realizer lets you set four types of adjusters e Numeric Adjusters which display and let you adjust variable values numerically in binary decimal hexadecimal or octal format e Sine Wave Adjusters which generate and let you define analog sine wave signals They let you adjust the wave depth and frequency e Square Wave Adjusters which generate and let you define analog square wave signals They let you adjust the wave depth frequency and duty cycle The duty cycle is the percentage of the period in which the signal is at its top value Time Table Adjusters which let you adjust the value of a variable at specified time intervals 142 248 r www BDTIC com ST Chapter 10 Setting Adjusting and Viewing Input Values The following paragraphs describe how to attach adjusters to pins and wires and how to set the appropriate input values Note 1 You can only attach one adjuster to each pin or wire 2 Clicking any object in the schematic causes information on this object to be displayed in the status bar Changing Adjuster or Probe Attributes If you right click any
34. at ER gente EE a aro o ouis ae 43 3 4 Analysing and Generating Program Code 44 3 4 14 Setting the Compile Options 0 eee 44 3 4 15 Executing the Analysis and Compile 45 3 4 16 Viewing the Analyse and Compile Report 46 3 5 Simulating and Fine Tuning Your Application lll 47 3 5 17 Creating the Simulation Environment File sef 47 3 5 18 Connecting Probes and Adjusters 0 0000 c eee nee 48 3 5 19 Running the Simulator 53 3 6 Now its Up to YOU uzesmen deu imus mee eR EXE WEGE bees Gane ss 53 CREATING OPENING AND SAVING PROJECTS Le 55 4 1 Project PIOS iu baa deer ete don ee bed wth et hed de done De done d Dome pen deed woth td 55 4 2 Creating a New Project 0 0 0c eee eee 55 4 3 Opening an Existing Project 56 4 4 Opening Earlier Realizer Version Projects 0 000 cece eee ee 56 4 5 Closing a Project 0 ccc eee eee ens 57 4 6 Saving Projects 57 SPECIFYING THE TARGET HARDWARE DEVICE 59 51 Sch tter Se ee E e E te ee wu S meds 59 5 2 Choosing a Target Microcontroller 0 0 0 cece eee 60 5 2 1 Selecting the Target Microcontroller for a New Project 60 5 2 2 Changing the Target Microcontroller lssn 61 5 38 Hardware Configuration 0 0 0 ce eee eh 62 5 3 8 Accessing Hardware Settings Dialog Boxes
35. click the Enable box This action permits the application use of the Timer B peripheral and allows access to the interrupts and control registers of the peripheral 40 248 Ky www BDTIC com ST Chapter 3 Tutorial 4 Set the following parameters e Prescaler division 1 8 e Input Capture Capt1 transition Rising Capt2 transition Falling e Output Compare Click the Enable OCMP1 box and set Level 1 2Low and Level 2 High e Click the Initialise Compare register1 box and set the value to OxO e Click the Initialise Compare register2 box and set the value to 0x100 e Click the PWM box 5 Click OK to confirm The dialog box closes The Timer B on chip peripheral is now enabled as a PWM generating device Consequently a Pulse Width Modulated signal can be generated on the OCMP1 B output pin 6 Now that the device is correctly configured follow the procedure in Section 3 3 11 1 on page 39 and connect the ARCP symbol outputlatch to the TBOC1LR Timer B register 3 3 12 Event Control The last thing you must do when you create an application is to assign execution conditions to those events that are represented in subschemes Note Execution conditions cannot be assigned to main root schemes it simply doesn t make sense to use the main scheme as an interrupt routine for example In addition it is best to define execution conditions after having enabled see page 40 any necessary microcontroller peripherals so that
36. d 34 248 www BDTIC com ST Chapter 3 Tutorial Input and output Symbol outputlatch Name ARCP Se Comment PumpSpeedControl Comment Description This is an output symbol The NAME value connects it to a hardware port see Section 3 3 11 on page 38 Any type from BIT through LONG can be used 3 3 10 The Creation of a Subscheme for an Internal Event Driven Action In Section 3 3 7 we made reference in the main scheme to a subscheme for an internal event driven action This particular action controls the periodic activation of the temperature acquisition and filtering process and reflects a timed interrupt execution condition that is an event periodically triggered by a timer interrupt Recall from Section 3 3 6 that all events that need to be executed in parallel or independently from the main scheme must be placed in subschemes In our tutorial application the subscheme attached to this action filter sch groups code that executes as an interrupt service routine This single input single output subscheme is represented by the sss1_1 symbol embedded in the main scheme diagram where the input pin of the symbol corresponds to the input in the subscheme and the symbo s output pin corresponds to the output of the subscheme Of course subschemes can have various numbers of inputs and outputs and can be represented by symbols of type sssx_y where x the number of inputs and y the number of outputs To c
37. dialog box will open entitled Change numeric adjuster From this dialog box you can several numeric adjuster options described in Table 5 fee Change numeric adjuster Radis Decimal hi Value T Step Step fast 10 Iw Extended Table 5 Changing Numeric Adjuster Options Change the number base in which the value is set Select the appropriate button in the Radix box and displayed Change the current value of the attached pin or wire Enter the new value in the Value field Change the increment value of the lt and gt buttons Enter the new value in the Step field Change the increment value of the lt lt and gt gt Enter the new value in the Step fast field buttons Hide or display the lt gt lt lt and gt gt buttons Click the Extended check box When this box is checked the buttons are displayed ky 145 248 www BDTIC com ST Setting Adjusting and Viewing Input Values Chapter 10 10 2 5 Setting Variable Input Values To set variable analog or binary input values attach a Time Table Adjuster to the appropriate input pin or wire The Time Table Adjuster lets you set an input value that changes at specified time periods Once you have placed a Time Table Adjuster you can either import data from an ASCII text file or enter the data directly into the Time Table Adjuster The following diagram shows the format of Time Table Adjuster compatible ASCII files ASCII File Contents Table Valu
38. font Size overtype the appropriate value in the text box 4 To change the attribute Alignment select a new value from the appropriate drop down list 5 Click OK when you have finished 195 248 4 www BDTIC com ST Worksheet Layout Preferences Chapter 12 12 3 Worksheet Layout Preferences In this dialog box you can change the size and orientation of your scheme worksheet These characteristics are visible on screen and when you print a scheme 1 Inthe Environment Options dialog box click the Page tab The Page dialog box opens bes Environment options Onentation Landscape e Size Ad arid 10 m m Ok Cancel 2 To change the worksheet orientation select the appropriate option in the Orientation drop down list To change the worksheet size select a new size from the Size drop down list 4 To change the grid distance overtype the appropriate value in the Grid box 5 Click OK when you have finished 196 248 d www BDTIC com ST Chapter 12 Printing Options 12 4 Printing Options In this dialog box you can change the margins and the font of your printed scheme page These characteristics are visible on screen and when you print a scheme 1 In the Environment Options dialog box click the Print tab The Print dialog box opens Margine in m m Lett 20 Fonthace Anal pointsize 8 Select font LIF Cancel 2 To change the margins overtype the values in the ap
39. hardware device 80 COIS EE 126 COMMS HO E 126 CORSIW esssssssseseeeerennnmen nnns 126 COnVersIOn ccccccccceeceesseeeeeeeeessseaaes 121 CO 122 eg eee 120 countf Doum 120 COUNTV DCOUnIV 121 creating your own 165 defining a new subscheme symbol 166 defining new user defined symbols 171 deleting nooneeennnneeninsnenneeennnnnerrnnseneenn 75 Eege 116 delfoff ee 116 delfon a pee 116 KEEN 116 delvo ee 117 delvoff eee 117 ei mere NER 109 e Ee 109 242 248 differential sess 118 all o M 80 103 0 0 0 0 Cee 80 103 CLIN ose seer tee EE See 118 e 21e EE 109 drawing shapes in 178 edge nens 115 EVOM Gee eee ee 80 104 eventenable 80 104 hierarchical sheet 128 indextable aeenennennnnnnnnnnenenennererereenes 124 information editing EE 180 uri E 78 AOU EE EE ET 80 104 input and output ssssse 103 inputlatch ssessuusessse 80 104 inputsequence eeeerneenee 106 Itzeg E 119 introduction To 6 Je 110 IKI ei 110 Mf SE 119 IEN e Bee 119 Jee Ve 107 lookuptable suesesssse 124 WOO SI M 110 main symbol library 103 mathematical 118 microdelf E 1
40. how best to optimize available resources such as memory There are two main parts to each ST Realizer assembler application The first part is a series of initialization macros that are embedding automatically and that make up the Realizer Operating System ROS The ROS sequentially initializes the microcontroller it s l O s peripherals and memory in much the same way that your PC s BIOS initializes the PC hardware as soon as you switch the power on The second part of the code is the part that you create using ST Realizer the application program The figure at right shows a flow chart of the overall structure of the generated assembler code that ST Realizer produces 2 2 Programming using Symbols Chapter 2 Reset entry point Chip Initialization ROS UO Initialization Peripheral Initialization Data memory Initialization Keep track of elapsed time Read inputs Calculate data Main Write outputs Loop EES Updating of you create Copies and State Machines Peripheral IRQs Interrupt Subroutines With ST Realizer you create applications by placing and connecting symbols in a scheme Each symbol is in fact a graphical representation of an assembler macro usually including attributes which you can modify to your specific needs The symbols included in the ST Realizer main library represent a variety of coded entities such as mathematical logical conversion and power management functions constants
41. how your symbols work The creation of both of these types of symbols is described in this chapter In both cases you use the ST Symbol Editor to create your symbol Note The ST Realizer online help system includes a tutorial which leads you through the steps of creating an example symbol and its macros 11 2 Running the ST Symbol Editor To run ST Symbol Editor from the ST Realizer window 1 Make sure you have a scheme loaded in the ST Realizer window window Help Simulator F12 2 On the Tools menu click Symbol Editor Symbol Editor Ctr F11 or BP o www BDTIC com ST Defining a New Subscheme Symbol Click the scheme area out of any symbol with the right mouse button and select the New 2Symbol menu sequence The ST Symbol Editor window opens It automatically shows the symbol editor s tool bar and the Select the Symbol properties dialog box Chapter 11 Attribute lew Leave Connect Propertes You can now define either a new subscheme symbol or a new user defined symbol 11 3 Defining a New Subscheme Symbol Subscheme symbols are effectively single symbol representations of an entire subscheme that can be used to reference a subscheme from within another scheme Some subscheme symbols have already been defined in the ST Realizer library but you may find that you need to create a subscheme with say 3 inputs and only one output We will use this example to help explain how to easil
42. in mind Once your subscheme has been drawn Place the symbols that represent the function the subscheme is supposed to execute Place as many portin and portout symbols as necessary These symbols are used to establish the links in and out between the root scheme and the embedded subscheme Make sure that the names for the portin and portout symbols are the same in the root scheme and in the subscheme Input ports are normally to the left and output ports to the right of the symbol Choose a name for your scheme and save it A sch file is created with the name you specified Input and output Sequential Logic Time related Mathematical Counter Conversion e Open the root scheme e Click oft H The Main lib list dialog box opens Select the sss type symbol you want to place You will select the sssp_q symbol that has p portin symbols and q portout symbols in Table Power management Constant State machine Hierarchical sheet the future subscheme Title e Click Place ars The sssp_q symbol will be placed in the root scheme nz For example the sss2 1 symbol is shown at left When prompted to enter the SCHEME attribute type the name of the subscheme without the sch extension The subscheme is now inserted in the root scheme double clicking the symbol in the root scheme causes the subscheme to open A www BDTIC com ST Chapter 7 li Tip x Opening a Subscheme Assigning an Exec
43. in the list at the left side of the window click on the Properties button This will open the Hardware settings dialog box and allow you to enable the peripheral that you desire to use When you return to the Hardware connections dialog box the registers or bits of the peripheral you just enabled should now be included in the list 81 248 www BDTIC com ST Working in Schemes Chapter 7 7 3 Working in Schemes This section describes general functions and utilities available when you are working in a scheme such as e How to use the viewing options e Viewing hidden attributes e How to print schemes How to add a title or comment to a scheme Using the Zoom In View Note Zooming in on a Selected Area Using the Zoom Out Note Using the Full Screen View Redefining the View Center of your Scheme 82 248 Click Gi then click the blank area in the scheme worksheet You may also click the Zoom in entry in the View cascading menu you obtain by clicking the blank area in the scheme worksheet Zooming in magnifies the view by 200 Click Ei then select the area of the scheme you want to zoom in on Click en then click the blank area in the scheme worksheet You may also click the Zoom out entry in the View cascading menu you obtain by clicking the blank area in the scheme worksheet Zooming out reduces the magnification by 509 Click CH You may also click the Full view entry in the View cas
44. input and output pins ports or peripheral control registers in order for the application to function Label Application Input and Output symbols are adc Z digin e Bh name De comment In pur comment inputlatch output digout IUBYTE comment Comment outputlatch Tem 7 event event name 4 Comment comment eventenable www BDTIC com ST Chapter 7 Tips ss d Symbols To connect these symbols to a target microcontroller port or peripheral e Right click or double click the I O symbol CORRS IEE This popup menu opens e Click Connect The I O Hardware Connections window for the target microcontroller opens The resources available in this window vary depending on the target microcontroller e Select the appropriate device pin ee 7 72212G2 1 0 Hardware connections Connect EznLrme to LIB YTE Setpoint Pee eee eee eee eee eee eee Rotate d Mirrar Attributes Connect Avallable resources Connected resources FL U 8 bit analog input FL 1 8 bit analog input FL 2 8 bit analog input ae HL 2 8 bit analog input FL 4 8 bit analog input HL D 8 bit analog input Properties UK Cancel Click the right arrow or double click the selected device pin name Click OK To have connections for the device sorted in pin order check the Sort by resource box If the peripheral register or bit that you wish to connect does not appear
45. is activated the Hours Resp Minutes variable of the Alarm time is increased each time the key HOURS Resp MINUTES is activated All time variables are reset to 00 when they reach the maximum value 23 for the hours and 59 for the minutes B3 2 Current Time Counting The system uses a timebase generated by the clock of the embedded timer on the ST6 or ST7 MCU This timebase can be configured the default value is 10 ms It is used to trigger three chained modulo n counters Unit Counter e One for seconds n 60 e One for minutes n 60 e One for hours n 24 220 248 d www BDTIC com ST Appendix B Sample Applications Clock Design When any of these Unit Counters reach their maximum value a clock is issued to increment the Unit counter of the next stage B3 3 Current Time Setup The current time value is modified by incrementation of the counters used for the current time counting This is achieved by duplicating the clock input of the appropriate counter in the current time counting block In practice two different additional clocks are needed one for minute incrementation and one for hour incrementation Each of these additional clocks is controlled by the combination of the keys TIME SETUP HOURS and MINUTES B3 4 Alarm Time Setup This process is similar to current time setup Two counters are used one for minutes and for hours The contents of these counters can only be modified by pressing the keys
46. is invisible Remarks None eventenable Input Symbol The NAME attribute is used for connecting this symbol to a hardware port For this double click the LUBYTE symbol The TYPE attribute is used to define the variable type BIT UBYTE SBYTE UINT SINT or LONG The comment COMMENT attribute is used in the report file Inputlatch Symbol The input value name is loaded when the enable input En is TRUE You are prompted for the symbolic name and the type of input The TYPE attribute is used to define the variable type BIT UBYTE SBYTE UINT SINT or LONG The COMMENT attribute is used in the report file En type boolean In type Any type BIT LONG Output Symbol The NAME attribute is used for connecting this symbol to a hardware port For this double click the symbol The TYPE attribute is used to define the variable type BIT UBYTE SBYTE UINT SINT comment or LONG The COMMENT attribute is used in the report file 104 248 d www BDTIC com ST Chapter 8 Sequential Symbols Outputlatch Symbol The output value Name is transferred to the hardware port when the enable input En is TRUE You are prompted for the symbolic name En and the type of the physical output The TYPE attribute is comment used to define the variable type BIT UBYTE SBYTE UINT SINT or LONG The COMMENT attribute is used in the report file En type boolean Out type Any type BIT LONG 8 2 Sequential Symbols S
47. or LONG The two instances have the Type UINT which is unsigned integer The comment value is used in the report file see Analysing and Generating Program Code on page 44 Sym Functional Category Name Values o Values 0 La B 99 Description This is a two input subtractor with type inheritance OUT IN1 IN2 It subtracts the actual temperature from the Control Temperature For details on type inheritance see Type Inheritance on page 204 Hierarchical Sheet Symbol sss1 1 Scheme Name of the related subscheme file filter sch in the example scheme Description This is a subscheme connection symbol It represents a process that is contained in a sub scheme In this case the subscheme has one input In and one output Out By using Portin and Portout symbols within the subscheme the connection is made between the pins of this symbol and the subscheme This subscheme is described in Section 3 3 10 on page 35 29 248 4 www BDTIC com ST Tutorial Chapter 3 i Description This is a single output multiplexer where an input condition determines whether the output value should be equal to input O or input 1 For example when the input condition equals 1 the output value will be the input value from line 1 Constant Symbol constw Value 10 There are two instances in this diagram one in the ARTimer subscheme diagram and another one in the Filter subscheme diagram Description Th
48. performed There are many types of events some hardware independent and others that are hardware dependent The full range of events available is detailed in Section 7 4 on page 85 2 6 4 Execution Conditions An execution condition can be applied to a subscheme such that the subscheme is only executed when that execution condition is met such as a timed interrupt or upon a subscheme input change Only one execution condition can be applied to any given subscheme and when this execution condition is fulfilled all of the code within the subscheme is executed Reset entry point Initialization Normal Code Execution Is Execution Condition met Subscheme Code Normal Code Execution Subschemes with execution conditions are chiefly used to contain reasonably complex subroutine functions that are conditionally performed in addition to the code in the main programming loop The diagram at right shows a schematic example of how a subscheme with execution conditions is used in an application d 8 248 www BDTIC com ST Chapter 2 Events 2 6 5 Event Symbols Event symbols can be included in subschemes to determine when and which portions of the code is executed Event symbols are always placed in subschemes because events act as interrupts and interrupts may never be placed in the root scheme In a certain manner event symbols act as switches to control when i e under which conditions subs
49. project here File name heating Save as type Project files Ir Cancel 2 Browse to the folder that you ll create your project in and specify the name of the project file An zp extension will be applied automatically Click Save 157 55 248 www BDTIC com ST Opening an Existing Project Chapter 4 4 3 Opening an Existing Project Note Only one project may be open at a time To open a project 1 Click Project 2Open Files with the rpf extension are displayed automatically or 4 Click File gt Open or i You must specify the rpf extension The Open a File dialog box opens Look in 3 Heating heating rpf Files of type Project files rpf Cancel 2 Browse to the folder containing your project file and either select it or type its name rpf extension in the File name field 3 Click Open 4 4 Opening Earlier Realizer Version Projects The Open a file dialog box shown above can be used to open ini project files from earlier versions of ST Realizer Both ini projects and rpf projects are fully compatible When opening projects from earlier versions be aware that these projects still use the target hardware from these earlier versions Simply reselect the target hardware see Chapter 5 on page 59 once you have opened the earlier version project 56 248 ky www BDTIC com ST Chapter 4 Closing a Project 4 5 Closing a Project To close a project Click File gt Cl
50. related Mathematical Counter Conversion Table Power management Constant State machine Hierarchical sheet Title from the library dialog box right click the mouse and select Place 3 A square box will now appear next to the cursor indicating the size and position of the stateinit symbol Move the cursor to where you want to place the symbol then click once It is recommended that you place the symbol towards the top and left of your scheme Note If you wish to move the symbol after having placed it just click once next to the symbol so that a red rectangle appears around the entire symbol indicating that it has been selected Then simply drag and drop it where you wish 4 Adialog box will open prompting you to edit the value of the state In doing so you are effectively naming the initial state variable Type Init in the field then click OK CAUTION With ST Realizer object naming such as when you assigned the name Init to the initial state symbol above is case sensitive In addition spaces are inter preted as characters Ensure that all object names are used consistently other wise errors will result when you compile the application ky 19 248 www BDTIC com ST Tutorial Chapter 3 You ve just placed your first symbol the initial state Init It should look like this If it doesn t select the symbol by clicking next to it then delete it by pressing the Delete button on your keyboard and redo steps 2
51. sequential functions should be kept here However if there are any particularly complicated or cumbersome actions in your main loop you may wish to put them into a subscheme to save space in the root scheme and to make the application easier to follow visually 2 5 3 Subschemes Applications can include any number of subschemes which contain further symbols and wires but are displayed in the root scheme as a single symbol There are three reasons to create a subscheme e To include complex portions of the main loop thus saving space in the root scheme and making it easier to reuse processes In this case the subscheme is executed as if it were a part of the main loop root scheme e To include parts of the application that are event driven Events can never be placed in the root scheme Subschemes can be assigned either a single execution condition which will apply to the entire subscheme or alternatively can include any number of event symbols More will be said about execution conditions and events shortly e To save functional parts of your application analogous to subroutines that you may wish to reuse in other applications Subschemes are saved in their own files sch files and can be easily copied to other ST Realizer projects and reused You may also save customized subschemes symbols to a library to be accessible by all projects Subscheme symbols are described below Designing a subscheme is no different than designi
52. settings symbol attributes 76 Preferences wl 196 PIPING BE 197 Eeer 194 SVITIDOIS accessi tectcepeceieceenepennidereceiienin 198 ele e TE 199 Printer eu EE 83 setting UP sees 83 Printing preferences ssosnnnnnnnnaaannenaanns 197 Probes NUMO EEN 152 OSCINOS CODC e 153 VEG MN E 153 changing properties of 154 Sim ulaton 151 state machine ussssss 156 state machine probes attaching 156 values Eelke e EE 139 tigre TT 139 values recording 160 values reuseing 160 Processing Cycle controlling the time of 131 gi em T 12 240 248 CIOS ING M A 57 creating new 55 Opening 56 opening projects from earlier versions of Realizer 56 SAVINO eeaeee E 57 R MA A RE 65 Ramlnit subroutine 64 Reallnit subroutine 64 Realizer Operating System 63 RealMain subroutine 64 Recording adjuster values 139 160 probe values 139 160 simulation information 158 Report analyse and compile 135 file example 228 printing of 138 Requirements bardware ccc cccceceece
53. step by step Close ST Analyser Status Se Hardware select Status Ma errors Creating Metlist New Open Hardware settings Creating Cross Reference Analysing Generating Final Code Executing Target Compiler Creating Report File e When the analyse process has finished successfully with no errors click OK at the bottom of the ST Analyser Status window e A new window will appear on your screen entitled Analyser messages It will simply report the date and time and that no errors were found 9 4 What to Do if there are Errors Found during Analyse 1 If errors are found the ST Analyser Status window will show a fail message and give the number of errors found Click OK 2 A descriptive list of the errors will be shown in the Analyser messages window which then opens at the bottom of the scheme window You can view each error by either double clicking on its message in the window or by clicking the previous message or next 134 248 Ier www BDTIC com ST Chapter 9 Viewing and Tracing Generated Messages message icons on the toolbar The area of the scheme where the error occurs will appear in the scheme window Error 609 amp state input Start is not connected to a net An input pin must always be connected to a net Waning 2 Mat all symbols are analysed total symbols 44 analysed symbols 40 Message ST Analyser Beta results of Mon Apr 12 13 38 40 1999 1 Wa
54. symbol The subscheme symbols are named sssp q where p indicates the number of inputs you need for your symbol and q the number of outputs For example sss2 1 is a subscheme with two inputs and one output When you want to use a subscheme you must therefore first think about its connections what inputs does the subscheme need to deliver its output Once you know this you can choose the correct subscheme symbol from the main library Subschemes not linked to events either by definition of execution conditions or the inclusion of event symbols are basically annexes to the root scheme and therefore the same rules that apply to root schemes must apply to them However those subschemes to which execution conditions are attached or in which event symbols are embedded are special cases and the rest of this section is dedicated to describing how to configure subschemes with execution conditions or event symbols 7 4 3 Description of ST Realizer Events Events are a general concept described in Section 2 6 on page 8 and allow for the conditional execution of code within an application As outlined above if an event is applied to 157 85 248 www BDTIC com ST Subschemes Execution Conditions and Events an entire subscheme it is called an execution condition if it is applied to only a portion of code within a subscheme the event takes the form of an event symbol The following paragraphs give a list of the principle types of ev
55. the state machine diagram to see how these are wired together In your scheme make sure wiring mode is selected by clicking and wire the symbols Note Auto wiring and Auto reroute are options available in the Option 2Environment Wiring menu path These options create corners and reroute wires across the shortest path automatically If you prefer to connect the wires another way you can deactivate them 1 On the Options menu select Environment 2 In the Environment Options dialog box click the Wiring tab 3 Click the Auto wiring and Auto reroute check boxes When these are empty Auto wiring and Auto reroute are deselected d 24 248 www BDTIC com ST Chapter 3 Tutorial To place a heading in the diagram 1 Click anywhere in the diagram area with the right mouse button A popup menu displays 2 Select the New Attribute options The Create an Attribute dialog box opens 3 Specify the following options TAG TXT Value State Machine Diagram enter text Visibility Tag checkbox left unchecked 4 Place the heading where you want by dragging it 5 Click OK You ve just drawn the state machine which is part of the main scheme of the heating control application The next section will explain how to draw the rest of the heating control application Since you should now be used to placing editing and wiring symbols the descriptions that follow will explain what symbols you will place with what values and why the s
56. the stateinit and condition symbols together 1 Select wiring mode by clicking The cursor changes to a crosshair indicating that it is in wiring mode 2 Place the cursor next to the right arrow on the right of the stateinit symbol This is its output pin The crosshair snaps onto the pin when it comes into snapping distance An x indicates the point to which the crosshair is snapped as shown in the following diagram oetupTime 3 Click when the crosshair is snapped to the pin ST Realizer will now draw a wire that follows the cursor 4 Move the cursor to the line on the left of the SetupTime condition symbol This is its input pin Click when the crosshair is snapped onto the condition symbol s pin 5 Right click the mouse or press the ESC key or click N to finish wiring The two symbols are now connected by a wire Your scheme should now look like this SS 7A setup Time If it doesn t 1 Select the wire by clicking it 2 Delete the wire by pressing the Delete button on your keyboard and redo steps 1 to 6 above ky 21 248 www BDTIC com ST Tutorial Chapter 3 3 2 5 4 Placing the Next State To place the state HeatingOFF 1 In the main library dialog box under the State machine category scroll down the list until you reach state then double click it 2 Move the cursor to where you want to place the symbol then click Place the symbol to the right of the state symbol as shown in the diagram below
57. these peripheral functions are available for use The execution conditions box shown at the bottom left corner of the subscheme as seen in the Temperature Acquisition Timed interrupt 0 01 Sec Subscheme diagram on page 36 is created as follows 1 Right click the mouse in any blank position in Execution conditions the diagram Click here to New C open the A popup menu opens with five options Eire View 2 Select Execution Conditions Connections os The Execution Conditions dialog box for the dialog box Execution conditions specified target microcontroller ST72212G2 in the example opens Specifying this target microcontroller was one of the first tasks you had Properties ky 41 248 www BDTIC com ST Tutorial Chapter 3 to perform see Section 3 1 2 on page 14 This is the device you have specified at the beginning Name of the file where the subscheme is saved E ST 722126 Execution condiz Conditional execution of Filter sch E by conditions Available conditions Applied conditions Upon sub scheme input change Penodic Timed interrupt TimerB Capture 1 interrupt Select the subscheme execution TimerB Compare 1 interrupt See condition Timed Interrupt in the TimerB Capture 2 interrupt TimerB Compare 2 interrupt tutorial example di TimerB Overflow interrupt Zon Properties OF Cancel 3 n the Execution Conditions dialog box see above
58. tick is provided on page 131 157 87 248 www BDTIC com ST Subschemes Execution Conditions and Events Chapter 7 duration of the 3rd main loop cycle so that when the periodic event is evaluated it adds together the values of rtick that it has received for all completed main loop cycles and arrives at a total of 2 4 6 timer ticks Evaluation of elapsed time in periodic events is always performed using an equal to or greater than condition Therefore the event will take place during the 3rd main loop cycle However there will be an imprecision of at least 1 timer tick in this particular case because the specified period was 5 timer ticks and the actual elapsed time was 6 timer ticks at the beginning of the 3rd main loop cycle Reset entry point Initialization Normal Code Execution e Timed interrupts Timed interrupts are a very precise method of timing an event because a timed interrupt is executed independently of the main loop of the application and measures time directly from the base clock timer tick While periodic events count the cumulative value of elapsed timer ticks at the beginning of each main loop cycle timed interrupts count each elapsed timer tick as it occurs This means that as soon as a specified amount of time i e a specified number of Update timer timer ticks has elapsed the interrupt is datastructures immediately executed Time Elapsed Timed Interrupt code part R
59. to use probes ky 151 248 www BDTIC com ST Monitoring Signals with Probes Chapter 10 10 3 8 Viewing Signal Values Numerically To view signal values in numeric form you must attach a Numeric Probe to the appropriate wire or symbol Numeric Probes let you view the current value of the wire or symbol s signal in the Binary Decimal Hexadecimal or Octal number bases While the simulation is running the value that Numeric Probe displays will vary with the changing signal in the wire or symbol To attach a Numeric Probe 1 Select the pin or wire to which you want to connect the probe by clicking on it Er 2 Click 3 Click where you want the probe to appear The probe is now placed in your pin level drawing or scheme and connected to the pin or wire that you selected In the example below we see that the numeric probe has been connected to the a wire in a scheme Because this wire is an input to a symbol and the symbol pin to which it is connected is called ARCP this is also the name of the signal that the numeric probe is measuring Because of this the numeric probe also displays the signal name ACHT Cantralling the Pump Speed PumpEnabled gt PumpSpeedContral To select the displayed number base Increase sre 1 Double click the probe or right click the probe and select D ecrease size Properties from the popup menu shown at right m MB oo EF www BDTIC com ST Chapter 10 Monitoring Signal
60. two symbols together between Symbols e Select wiring mode by clicking The cursor changes to a crosshair indicating that it is in wiring mode Place the cursor on the pin of the first symbol where you want the wire to start The crosshair snaps onto the pin when it comes into snapping distance An x indicates the point to which the crosshair is snapped e Click when the crosshair is snapped to the pin of the first symbol where you wish the wire to start ST Realizer will now draw a wire that follows the cursor Tips If you want to define your own wire corners click twice where you want each corner to be e Move the cursor to the pin of the second symbol where you 78 248 ky www BDTIC com ST Chapter 7 Using Automatic Wiring Copying a Wire Pasting a Wire from the Clipboard Moving a Wire Deleting a Wire Mirroring a Wire 157 Symbols wish the wire to end e Click when the crosshair is snapped onto the appropriate point The two places where you clicked are now connected by a wire e Right click the mouse or press the ESC key or click L to finish wiring The two symbols are now connected by a wire You may also let ST Realizer draw wires for you Automatic wiring simplifies the task of wiring symbols together by Automatically choosing the shortest path between the two symbols to be connected Auto wiring and creating corners where required Automatically rerouting wires when a symb
61. type of adjuster or probe probes are described in SE Section 10 3 on page 151 a popup menu will open that looks similar to Decrease size that at right re ES Properties From this menu you may increase or decrease the size of the adjuster by selecting Increase size or Decrease size 10 2 4 Setting Fixed Input Values To set a fixed analog or binary input value you must attach a Numeric Adjuster to the appropriate input pin or wire Numeric Adjusters let you set the value input by the pin or wire to which it is attached as well as change the number base that the value is displayed in To attach a Numeric Adjuster to a pin or wire 1 Select the pin or wire to which you want to attach the Numeric Adjuster by clicking on it The pin or wire you choose should be an input pin or wire For example select the pins on the pin level drawing that you have attached to input symbols in your scheme refer to Connecting Input Output Symbols to Microcontroller Pins Ports and Peripherals on page 80 Note A numeric adjuster has the same type as the pin or wire it is attached to E 2 Click ky 143 248 www BDTIC com ST Setting Adjusting and Viewing Input Values Chapter 10 3 Click where you want the Numeric Adjuster to appear he adjuster is now placed in your sch you selected In the example at right we see that the numeric adjuster has been connected to the pin called Setpoint eme and connected to the pin or w
62. useful in keeping track of different project versions Once you have selected the options you wish click OK 3 The second tab opens the Timing dialog box ie Analyse options E4 Code generation Code optimisation Realzer uses timer ticks for timing Generate 4 timer tick after 0 001 ZEC To ensure that the processing time of a project iz always the same use a fed processing cycle time Eed processing cycle time Une processing cycle must be finished in 1 timer ticks UK Cancel Every ST6 or ST7 microcontroller has a timer called Timer 1 ST6 or Timer A ST7 which if there are either time related symbols or events in the application is used as the base clock to measure out units of time called timer ticks Timer ticks are the smallest increment of time that a timer can count In this dialog box you may choose the value for the timer tick or base clock unit used in the application The minimum value that you can enter for the timer tick depends on the target hardware device The table below summarizes the minimum and maximum values for the timer tick ky 131 248 www BDTIC com ST Changing the Compile Options Chapter 9 for each family of microcontroller ST6 8 MHz crystal ST7 16 MHz crystal Minimum 100 us Timer Tick Maximum Timer Tick 48 000 us 60 000 us Timer ticks may also be used to count the number of main loop cycles The time it takes to perform a main loop cycle is called the Pr
63. you compile the application 7 2 4 Placing and Controlling Symbols Placing a symbol in Symbols can be placed in a scheme in two Mam lib x the scheme Ways Input and output 1 Insert a new symbol one that does not X Sequential Logic already exist in the open scheme by r3 Time related choosing it from the main library amp Mathematical i Counter Click i Conversion Table Power management The main lib and mainper lib it it El Constant exists for the target microcontroller State machine dialog box es open The symbols Zwee are by default ordered by functional category Hierarchical View However you can view the library of symbols alphabetically by right clicking in the library dialog box and selecting Alphabetical View You may also open any library via the File gt Open menu sequence by specifying the appropriate lt filename gt 1ib file ST Realizer has with a number of symbol libraries in the root folder NLib directory including a some that are microcontroller specific 72 248 ky www BDTIC com ST Chapter 7 ly Tip c voz Tip psi a Selecting a Symbol Wire or Group of Objects 157 Symbols The most commonly used symbols are grouped in two libraries main lib for symbols that use values to be stored in RAM and mainper lib for symbols that use values to be stored in permanent non volatile storage When you build a scheme you use a se
64. you convert a BIT type to a WORD type or a WORD type to a BIT type IN type BIT LONG OUT type BIT LONG Shift register symbol If Clr 1 the shift register is cleared If D U 0 the shift direction is down If D U 1 the shift direction is up A rising edge on Cin causes the In input value to be loaded into the shift register A rising edge on Shift triggers the shift operation in the shift register The C output is the last bit shifted out carry Clr D U Cin Shift C type BIT comment In Out type Any type BIT LONG When in the persistent non volatile library this symbol named pshift shows an M in its design name 122 248 d www BDTIC com ST Chapter 8 Conversion Symbols Word Merge Symbol Symbol used to build a word out of a high byte and a low byte All types WORD Word Pack Symbol Symbol used to pack sixteen bits into one word DI E1 EZ EJ Ea ES Ee ET E E Word Split Symbol Symbol used to split an input word into a high byte and a low byte All types WORD ky 123 248 www BDTIC com ST Table Symbols Chapter 8 Word Unpack Symbol Symbol used to unpack a word into sixteen bits ED bi ba bi Bad Ea Ez Br Pai Era 8 8 Table Symbols Table symbols allow input values to be converted to output values according to a table of correspondence which you either input directly or import from an ASCII file Note Take care to choose the data
65. yourself you must include the macro or macros linked to the symbol before analysing the scheme For details on how to create your own symbols see Creating Your Own Symbol on page 165 To include the macros linked to user defined symbols In the Include files field enter the name and full path to the macro files linked to your symbols To include more than one macro file separate each path and file name with a semi colon Click OK Assembler options Normally you will not need to alter the default assembler options www BDTIC com ST Chapter 5 Hardware Configuration 5 3 5 Memory Configuration The second Hardware Settings dialog box tab is entitled Memory In this tab shown below you can configure the target microcontrollers memory configuration options such as e The start and end of ROM corresponding to the beginning of your application code e The start and end of RAM corresponding to the beginning of your application variables The start and end of EEPROM if this memory type is included in your target microcontroller To set or update one of these parameters le ST 72212G2 Hardware settings Fa i teenie Wes value or overtype its current value Begin 0x008 00173 End 0 0173 OxFFDF 2 Click OK To reset the values to standard device settings click Reset Reset UK Cancel Notes 1 The default values found in these fields do not correspond to those reported in the microc
66. 0005 CALL SUBO0004 copyww 2 TCONST AT00004 2 NI 0005 Create normal stack pop LD A STACKO LD REG A LD A STACKW LD W A LD A STACKV Lb WA LD A STACKY LD Y LD A LD X iD A RETI ENDC D STACKX D STACKA PORTA PORTB interrupt service routine IFC NDF PORTAint PORTAint Create normal stack push LD STACKA A LD A X LD STACKX A LD AT LD STACKY A LD A V LD STACKV A Ay www BDTIC com ST 235 248 Fast Counter Application Appendix B Sample Applications LD A W LD STACKW A LD A REGO LD STACKO A SET 6 v2n12 CALL SUBOO02 RES 6 v2n12 Create normal stack pop LD A STACKO LD REGO A LD A STACKW LD W A LD A STACKV LD 37A LD A STACKY LD Y A LD A STACKX LD X A LD A STACKA RETI ENDC RROMEND ORG OFFEH JP Reset ORG OFO9EH JP Reset ORG OFFOH JE Rtcint ORG OFFCH NOP RETI ORG OFF6H JP PORTAint ORG OFF4H NOP RETI ORG OFF2H NOP RETI d 236 248 www BDTIC com ST Symbols CECR 206 ASM De 129 Bet AE 11 129 SVAN THN E 56 NOG ING oes setmteaneecncttexsoentrnesseeecseesasescmcetncecect 160 el 11 129 EECH eegene vanced 55 S19 file 11 129 SON Eege 67 sef files 0 lt 1 1 00 ee 139 aile e E 141 SAVING riesenia c tuer odec ci eue eus 142 RITIENE 67 142 A ACTUM solutions internet address 3 adc symbol ssssseeeees 80 el EN 142 lu Le 143 hat el e MEHR E E 143 Ai ejl ojo er M 145 setting values
67. 05 microdelv AA 106 self qo grro Mm 77 pem 75 mul ee 119 11114 110 MOX 111 nand 111 Wie E WEEN 111 lte ME 111 nand 112 nand8 o oo eee ceceeceeeceeeeeeeceeeeeeeeeenaneneeeeees 112 NO 112 nen WEE 113 ioc EE 113 NOTO EE 113 ky www BDTIC com ST HOLO EE 114 sy 114 215 E 114 2D 114 OTO P ee ee 115 leet 115 A E 117 RE 117 SU E 80 0 0 i 0 ee ne 80 104 QUTOU TTA ICT NEE 80 outputsequence sssssssss 106 persistent library symbols 103 pitable 125 placing in a scheme 72 ejejqg e M 92 128 DOMOU PET 92 128 power management 125 programming wi 4 ramtable volatile RAM 125 deir C 77 e ieee eee eee eee 119 leri D NER RES 120 sequential eesseeeeeeeeeee 105 SITES JOS UE 122 SIOW 125 SITE DE 115 SIS E EE 92 chc EN 128 S LE ee eon ee 127 state machune 6 126 statein seessssssseeeeeereeneenne 127 stateinit pstateinit 126 iz isle l NR 127 SLO 125 djo 120 Ell gt RR 124 table symbols ssss 99 time related 116 e RR RR RR RR 117 roy P 118 EE
68. 1 v4n45 3 1 v4n 46 4 1 digoutb v4n46 4 1 BUDRC 3 1 digou utb ee BUDRC T digoutb v4n44 2 1 BUDRC 2 1 digoutb v4n42 0 1 BUDRA 2 1 digoutb v4n47 7 1 BUDRA 1 1 digoubsb v4n43 0 41 BUDEA 0 1 digoutb v4n41 1 1 BUDRA 3 1 Staceoutb v4nl2Z 5 1 st0 2 0 digoutb wva4nlz 5 y1 BUDRB O 1 SraLteourb v44nl3 6 1 9 0 2 digoutb v4n13 6 1 BUDRB 1 1 Stateoutb v4nl14 7 1 st0 2 2 digoutb snl4 T l BUDRB 6 1 Srateoutb v4nl5 0 1 59t0 2 39 drgousb v4nlo40 1 BUDEB Tpl Srtareminit st0 2 0 Stateminit St0 2 1 stateminit stO0 2 2 stateminit stO0 2 3 Srtabemrinit SL0 2 1 stateinit st0 2 0 state st0 2 0 1 stateend st0 2 0 StaLeinit sSt0 2 1 state ek Ardy 2 stateend st0 2 1 stateinit St0 2 2 state st0 2 2 3 stateend st0 2 2 stateinit st0 2 3 state st0 2 3 0 stateend st0 2 3 statemend st0 2 4 LD A BUDRA LD DRA A LD A BUDRB LD DRB A LD A BUDRC LD DRC x ret end of interrupt driven sub routine LEC NDF Etcint REGIN LDI TSCR 0008 LDL PSC 0 15H LDI TCR OCFH LDI TSCR 06DHA INC TICK Create normal stack push d 234 248 www BDTIC com ST Appendix B Sample Applications Fast Counter Application LD STACKA A LD A X LD STACKS A LD A Y LD STACKY A LD bw LD STACKV A LD A W LD STACKW A LD A REGO LD STACKO A Decrement interrupt timers JRS 7 T02006 TM1_0004 decw T02006 2 JRR 7 T02006 TMIl 0004 CALL SUBOOD2 TM1 0004 Decrement prioritized timers decw AT00004 2 JRR 7 AT00004 TM1_
69. 137 248 www BDTIC com ST Printing Reports 9 6 Printing Reports To print a report 1 Display the report 2 Select File 2Print in the main menu bar 3 Continue the normal printing dialog and click OK when ready 138 248 www BDTIC com ST Chapter 9 Chapter 10 Working with Simulation Environment Files 10 SIMULATING YOUR APPLICATION Once you have designed and analysed your application you can use ST Simulator to simulate its behavior generate and view input signals monitor signals that are generated by your application and fine tune it if necessary The principal tasks involved in simulating an application are Creating a simulation environment file which defines the environment in which you ll simulate your application e Adding adjusters to your simulation environment file which enable you to view and control the value of the input signals to your application e Adding probes to your simulation environment file which enable you to view the signals that are generated by your application e Running the simulation You can also record the values generated by adjusters and read by probes while a simulation is being run ST Realizer records this information in Log files This information can be useful for viewing the exact adjuster and probe values at any given time during the simulation This section explains how to perform these tasks 10 1 Working with Simulation Environment Files Each project you want to
70. 2th Door Tel 34 3 4251800 Telefax 34 3 4253674 E 28027 MADRID Calle Albacete 5 Tel 34 1 4051615 Telefax 34 1 4031134 SWEDEN S 16421 KISTA Borgarfjordsgatan 13 Box 1094 Tel 46 8 7936920 Telefax 46 8 7504950 SWITZERLAND 1215 GENEVA 15 Route de Pr Bois 20 Tel 41 22 9292929 Telefax 41 22 9292900 UNITED KINGDOM and EIRE MARLOW BUCKS Planar House Parkway Globe Park Tel 44 1628 890800 Telefax 44 1628 890391 Internet Address http www st com Home Page Product Support http www st com stonline products support index htm www BDTIC com ST AMERICAS BRAZIL 05413 SAO PAULO R Henrique Schaumann 286 CJ33 Tel 55 11 883 5455 Telefax 55 11 282 2367 CANADA NEPEAN ONTARIO K2H 9C4 301 Moodie Drive Suite 307 Tel 613 829 9944 Telefax 613 829 8996 U S A NORTH amp SOUTH AMERICAN MARKETING HEADQUARTERS 55 Old Bedford Road Lincoln MA 01773 Tel 617 259 0300 Telefax 617 259 4421 ALABAMA Huntsville Tel 205 895 9544 Fax 205 895 9114 ARIZONA Phoenix Tel 602 485 6201 Fax 602 485 6330 CALIFORNIA Agoura Hills Tel 818 865 6850 Fax 818 865 6861 Santa Ana Tel 714 957 6018 Fax 714 957 3281 San Jose La 408 452 8585 ax 408 452 1549 Scotts Valley a 408 439 2950 Fax 408 439 2969 COLORADO Longmont Tel 303 772 9729 Fax 303 772 0790 FLORIDA Boca Raton Tel 561 997 7233 Fax 561
71. 5 4 add2www v0n5 4 vln0 4 vln3 4 add2www vin3 4 vinl 4 vln4 4 add2www vln4 4 vln5 4 vln6 4 divwwww vilno 4 vln 2 vin9 4 0 0 limfww vln9 4 v0n7 4 0 9999 copyww vOn5 4 sviln2 4 copyww vin0 4 pvin0 4 copvww vinl 4 p5vinl 4 ret SUBODOZ interrupt driven sub routine OSCID w2nl3 D 1 49 100 7T02006 7 edgebbb wznls 0 l pvaznl5 l l v2nll 2 1 loopodelbDDD cyznlli2 1pyv2nll 3 L v21 3 4 1 eventb vznl2 96 1 count ftbbbbbbbwb Va2nl2 60 l2DVALIlzZZ7 4 Vv2t045941pV2m440 1 V2133445 V214 9 1 Pe Oy Ly v 201074 0D D DCTO0U2000 4 dltchwbww v2n10 4 v2n11 2 1 y2n9 4 0 0 coODVID Wwzmnl3pgp0 lpv2nlos l CGODVIDD VEZRILIS 1 pv2nl15 5541 copvbb vzn4 b5 l pvzn4 0 l ret end of interrupt driven sub routine SUBODOS divwwww vO0n7 4 v3n18 4 v3nl10 2 v3n10 4 divwwww vonl0 4 vonl9 2 v3na27 2 v3nl2 2 Oivwwww wvonl2 2 v929nz0 2 vV3n26 2 V9n215 2 indtabww v323n21 2 v0n11 2 803011 14 0 indrabww v3onZ6 2 v0n10 7 903011 14 0 1ndrLabww vonz z2 vV0n9 2 903011 14 0 indtabww v3nl6 2 v0n8 2 503011 14 0 ret SUB0004 interrupt driven sub routine stateoutb v4n22 1 1 9t0 2 2 Srtateourb va4nZ2l 2 17St0 2 5 oOrzbobb vdn2l 2 1 v4n22 1 1l1 w4l 951 Stateoutb v 4n19 4 1 st0 2 1 ky 233 248 www BDTIC com ST Fast Counter Application Appendix B Sample Applications or2bbb v4nl19 4 1 v4n21 2 1 v4n0 5 1 muxZbbwwwww v4n0 5 1 v4nl 3 1 x4n2 2 x4n3 2 x4n4 2 x4n5 2 v4n6 2 bunpackwbbbbbbbb v4n6 2 0 0 0 v4n43 6 1 v4n47 7 1 v4n42 0 1 v4n41 1 1 v4n44 2
72. 86 2 2378 8088 Telefax 886 2 2378 9188 THAILAND BANGKOK 10110 Unit 1315 54 Asoke Road Sukhumvit 21 Tel 66 2 260 7870 Telefax 66 2 260 7871 JAPAN TOKYO 108 5 F Nisseki Takanawa Blg 2 18 10 Takanawa Minato Ku Tel 81 3 3280 4120 Telefax 81 3 3280 4131 OSAKA 532 Shin Osaka Second Mori Bldg 3 5 36 Miyahara Yodogawa Ku Tel 81 6 397 4130 Telefax 81 6 397 4131 d www BDTIC com ST THE EUROPEAN QUALITY AWARD WINNER 97 Information furnished is believed to be accurate and reliable However STMicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use No license is granted by implication or otherwise under any patent or patent rights of STMicroelectronics Specifications mentioned in this publication are subject to change without notice This publication supersedes and replaces all information previously supplied ST Microelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of STMicroelectronics The ST logo is a trademark of STMicroelectronics Intel is a U S registered trademark of Intel Corporation Microsoft Windows and Windows NT are U S registered trademarks of Microsoft Corporation 1999 STMicroelectronics All Rights Reserved Printed in France
73. 9 Figure B9 System Optimization Using Customized Components AG From the voltage divider Analog value entry Key recognition 4 219 248 www BDTIC com ST Clock Design Appendix B Sample Applications B3 Clock Design MCU solutions are often used as clocks owing to the onboard timer and all the task management possibilities offered by the MCU embedded resources This approach enables single chip solutions to be developed that are extremely useful in applications such as small home appliances The following paragraphs show an example clock design that includes an alarm feature that was developed using ST Realizer B3 1 Application Overview The clock system provides the following features e Current time counting e Alarm triggering at a defined time e Current time setup e Alarm time setup The time values are represented in the HH MM format but the described concept can easily be extended to representation in seconds By using this HH MM format the time value is represented by a pair of integer variables ranging between 0 to 59 for the minutes and 0 to 23 for the hours The user interface consists of 4 keys TIME SETUP ALARM SETUP HOURS and MINUTES With these 4 keys both the current time and the alarm time can be adjusted e When the key TIME SETUP is activated the Hours Resp Minutes variable of the current time is increased each time the key HOURS Resp MINUTES is activated e When key ALARM SETUP
74. ALARM SETUP HOURS and MINUTES once B3 5 Alarm triggering An alarm process is launched when the current time is equal to the predefined alarm time The occurrence is enabled by a double comparison Hours equal Minutes equal Figure B10 Application Block Diagram Current TIME SETUP Time Computing ALARM SETUP COMPARISON MINUTES B3 6 Timebase The timebase is described using the Oscillator component of the ST Realizer library Any real time value can be defined for the period For this application the 1Hz timebase is defined as an oscillating square wave with half a period level High duration of 00 00 00 50 in the HH MM SS xx format Figure B11 ky 221 248 www BDTIC com ST Clock Design Appendix B Sample Applications ST Realizer uses the embedded Timer of the ST6 or ST7 MCU as the timebase and generates by software any periodic variable Figure B11 Timebase Description 1 Hz Timebase UI 00 00 00 50 B3 7 Current Time Counting Each of the 3 chained Modulo N counters presents e An input clock issued from the previous stage timebase for the 1st stage e An output clock to activate the following stage A byte wise output with the current counted value Second Minute or Hour e An optional clock for the incremental set up process Any content change can only be performed during an input clock transition from 0 to 1 Thus the reset phase when the counter reaches its maxim
75. Any type BIT LONG B type Any type BIT LONG Z type The largest A or B type Note XORing a BIT type value and a WORD type value is not allowed Initial Loop Symbol Output TRUE only during the first pulse after reset Out type BIT Ay 109 248 www BDTIC com ST Logic Symbols Chapter 8 Multi type binary Inverter Symbol Z NOTA A type Any type BIT LONG Z type A type Jk Flip flop Symbol Values are J K Q Where rising edge x dontcare Q 1 previous value inv One loop Delay Symbol The output is the previous value of the current input In type Any type BIT LONG Out type In type One selection Input Multiplexer Symbol If the 0 1 selection input value is 0 Out takes the input 0 value Otherwise Out takes input 1 value a 0 1 type BIT 0 1 type Any type BIT LONG Out type The largest 0 or 1 type Out 1 110 248 d www BDTIC com ST Chapter 8 Symbol Symbol Name Name Q 1 Qut 2 3 A amp B A d C A 3 o zh A b Logic Symbols Two selection Input Multiplexer Symbol Values taken by Out are shown in the following table Sel bit O Sel bit 1 Out 0 0 Input value Input value 1 0 0 1 Input value L 1 Input value Sel 0 1 type BIT 0 1 2 3 type Any type BIT LONG Out type The largest 0 1 2 or 3 type Two value binary NOT AND function symbol with type inheritance Z NOT A AND B A type Any t
76. D ON Init A 1 ze SetupTime ARCP filter sch PumpEnabled En Temperature in 1 10 degrees Celsius PumpSpeedControl External Input Conditions The next part of this tutorial will show you how to analyse and generate the code for the heating control application 4 43 248 www BDTIC com ST Tutorial Chapter 3 3 4 Analysing and Generating Program Code In this part of the tutorial you are going to learn how to analyse the schemes you draw and generate the program code for them When you execute the analysis and compile ST Realizer analyses your scheme by creating the netlist creating cross references analysing and generating final code During these phases the connectivity between symbols the I O assignment and variable types are checked before generating the source code Providing no fatal errors are encountered ST Realizer generates a non compiled ST6 or ST7 macro assembler language asm file from the scheme which it then compiles When the analysing process has been successfully completed a report file is generated This report file gives information about the designation of I O pins a list of the variables used by type and the memory space required by the application 3 4 14 Setting the Compile Options There are a number of compile options that you may set before performing an Analysis of your application These options are discussed in detail in Section 9 2 on page 129 However most of the default settings are su
77. Double click the probe or right click the probe and select Properties from the popup menu shown at right Chapter 10 OCMPY B Increase size Decrease size Properties The Change oscilloscope probe dialog box will open From this dialog box you can set options that will control the way in which the signal is displayed Table 7 explains the various options available in the dialog box bes Change oscilloscope probe E3 TONI UM B Channel 2 Top 99 Po Bottom Gm Time Begin at OO DO 00 0000 hh mm ss ms End at OO DO 00 0010 brmmmr ss ms Mode Trigger M Trigger an a Rising edge sl when the value equals 0 000 Cancel Delete ED 154 248 www BDTIC com ST Chapter 10 Monitoring Signals with Probes Table 7 Adjusting the Oscilloscope Probe Output To change the maximum displayed Enter the new top Y axis value in the Top field Y axis value To change the minimum displayed Enter the new bottom Y axis value in the Bottom field Y axis value To change the time at which the Enter the new time in the Begin at field signal display will start i e the beginning of the X axis To change the time at which the Enter the new time in the End at field signal display will end i e the end of the X axis The Oscilloscope can display in three modes e Single scan mode The signal is displayed from the Begin at X value until the End at X value and then the display
78. E I be Enter the time in seconds EX double click the Timed Interrupt line A new dialog box opens for you to specify the time period between input value acquisitions 4 Enter 0 01 1 100 second and click OK 5 Click the OK button in the Execution Conditions dialog box 6 The Timed Interrupt event is now connected to the subscheme with a time value of 0 01 seconds What does this mean It means that the code described by the Temperature Acquisition and Filtering subscheme will be executed every 1 100 of a second after the main processing loop has been interrupted on a priority basis The polling of the temperature capture points and the consolidation of the measured temperatures will thus be performed every 0 01 seconds d 42 248 www BDTIC com ST Chapter 3 Tutorial 3 3 13 Summary You have now completed the heating control application schemes You have learned through doing this e How to place and edit symbols e What the principal symbols do and when to use them How to wire symbols together to create a main scheme and a subscheme e How to connect application inputs and outputs to target microcontroller pins e How to define the execution conditions of a subscheme Recall that the main or root scheme for the heating control example will look like the following State Machine Diagram Internal Input Conditions Switching the Pilot LED On HeatingON gt SetPump HeatingOFF HeatinglsON Pilot LE
79. E ra E 209 EE 209 TIPE 206 JUNTTI PE E 209 VALUE ee 209 viewing bidden 83 Automatic wiring eseesseseceeee 79 B Backup file Creating EE 194 Base Clock changing the timer tick value 131 zi m 203 237 248 www BDTIC com ST INDEX BLOCKSIZEINUNITS attribute 207 BUDRx variable Variables BUDAY aresciermic einernie E Eni 64 Buttons in toolbar ss 199 C Changing table data format 100 Changing the Target Microcontroller 61 Clock input pm 181 CODE attrbute 207 Code generation example of eeeeesssssse 230 seen 130 Structure 4 Colors of boxes neennooennesnnneeernnneernnssneen 194 COMMENT attribute 207 Compiling changing options sss 129 EXECUTION ee men ne on 133 Configuring events eessssss 95 Connecting Application to Target Device introduction eese 11 UO evmbols 80 Constant symbol changing value sesss 76 Creating a new Droe 55 ale ich 194 maCTOs 187 duidelmes 187 new Schemes eese 67 ejfe SSS TNR Rc 55 simulation environment file 139 your own symbol 165 Customization of ST Realizer 193 D Dolau COCK Cu 10 Desc
80. Heating Control Application The State Machine Diagram explained the relationship between the state of the heating control system and certain conditions The next step is to link each state with an action and to define the rules by which each condition is or is not met To do this you need to draw the other parts of the main scheme and subschemes that together make up the heating control application specifically e External Input conditions that are transmitted to the application from external sources such as the measured actual temperature This function will be part of the Main Scheme e Internal input conditions that control the Setup Timer and enable the pump These functions will be part of the Main Scheme e External actions that are output from the application such as putting on the pilot LED or controlling the speed of the pump This function will be part of the Main Scheme e An internal event driven action such as the periodic activation of the temperature acquisition and filtering process This function will be part of a subscheme called filter sch which we will learn how to create in Section 3 3 10 on page 35 d 26 248 www BDTIC com ST Chapter 3 Tutorial 3 3 6 What differentiates a main scheme from a subscheme Each diagram meaning a collection of symbols wired together in a scheme is analogous to a sub routine in a program The main scheme is if you will the conceptual core of your application It
81. I type Variable Limiter Symbol Output value is not larger than the top value and not smaller than the bottom value TOP type WORD BOTTOM type WORD In type WORD O type In type Multiplier Symbol Z A B A B type WORD Z type The largest A or B type Fixed Scaler Symbol G Gain O Offset Output Input Gain Offset type WORD Output value type type ky 119 248 www BDTIC com ST Counter Symbols Chapter 8 Variable Scaler Symbol G Gain O Offset Output Input Gain Offset type WORD 3 FG scalerv Output value type I type LI Symbol Two value Subtractor Symbol with type inheritance OUT IN1 IN2 IN1 type WORD IN 2 type WORD OUT type The largest IN1 or IN2 type 8 6 Counter Symbols Counter symbols let you count the iterations of either a fixed or variable signal Counter symbol with fixed initial value A rising edge on the Up input pin causes the counter to be incremented by one A rising edge on the Dn input pin causes the counter to be decremented by one A high level on the Clr input pin causes the counter to be set to 0 A rising edge on the Pr input pin causes the counter to be loaded with the specified value via the value dialog box When the counter output value Val reaches 0 the Zero output value 1 Up Dn Clr Pr and Zero types BIT Val type WORD When in the persistent non volatile library this symbol named pcountf
82. IC com ST www BDTIC com ST INDEX 245 248 SALES OFFICES EUROPE DENMARK 2730 HERLEV Herlev Torv 4 Tel 45 44 94 85 33 Telefax 45 44 948694 FINLAND LOHJA SF 08150 Ratakatu 26 Tel 358 19 32821 Telefax 358 19 3155 66 FRANCE 94253 GENTILLY Cedex 7 avenue Gallieni BP 93 Tel 33 1 47 40 75 75 Telefax 33 1 47 40 79 10 67000 STRASBOURG 20 Place des Halles Tel 33 3 88 75 50 66 Telefax 33 3 88 22 29 32 GERMANY D 85630 GRASBRUNN Bretonischer Ring 4 Postfach 1122 Tel 49 89 460060 Telefax 49 89 4605454 D 30916 ISERNHAGEN Ernst Grote Strasse 23A Tel 49 511 9027513 Telefax 49 511 90275555 D 90491 N RNBERG 20 Erlenstegenstrasse 72 Tel 49 911 959840 Telefax 49 911 9598499 D 70499 STUTTGART 31 Mittlerer Pfad 2 4 Tel 49 711 13968 0 Telefax 49 711 8661427 ITALY 20090 ASSAGO MI V le Milanofiori Strada 4 Palazzo A 4 A Tel 39 2 57546 1 10 linee Telefax 39 2 8250449 40033 CASALECCHIO DI RENO BO Via R Fucini 12 Tel 39 51 591914 Telefax 39 51 591305 00161 ROMA Via A Torlonia 15 Tel 39 6 44251142 Telefax 39 6 85354438 NETHERLANDS 5652 AR EINDHOVEN Meerenakkerweg 1 Tel 31 40 2509600 Telefax 31 40 2528835 POLAND WARSAW 00517 Ul Marszalkowska 82 Tel 0048 22 622 0561 Telefax 0048 22 623 6437 SPAIN E 08004 BARCELONA Calle Gran Via Corts Catalanes 322 6th Floor
83. In the Directories box double click the folder holding the file you want to import The ASCII file you wish to import must be in the format shown on the previous page i e table entries must be separated by commas In the list below the File name field double click the file you want to import Click OK 101 248 www BDTIC com ST Table Symbols 102 248 www BDTIC com ST Chapter 7 Chapter 8 Input and Output Symbols 8 THE MAIN SYMBOL LIBRARY This chapter contains a listing of the symbols available in the main library main lib Some of them may be also included in the persistent non volatile library mainper lib these are mentioned in the corresponding explanation column where applicable The main symbol library is divided into the following functional categories Input and output oequential Logic Time related Mathematical Counter Conversion Table Power management Constant State machine Hierarchical sheet and Title Each of these functional categories and the symbols they contain are explained in the following sections 8 1 Input and Output Symbols These symbols provide input and output links between the application you create and the target microcontroller s pins ports and peripherals It is important to remember to connect each of the symbols from this category to resources on the target hardware device Refer to Connecting Input Output Symbols to Microcontroller Pins Ports and Peripherals on p
84. NExamplesNFastcntNLatch sch Event Periodic 3 Sec Scheme C Program Files ST Realizer Examples Fastcnt Input sch Event Count PB 2 interrupt Scheme C Program Files ST Realizer Examples Fastcnt convert sch Event Upon sub scheme input change Scheme C Program Files ST Realizer Examples Fastcnt display sch Event Timed interrupt 0 03 Sec ST6260 DIL20 connection overview Pin Name Alternative name Type I O Description 1 PB 0 Digit 0 1sd BIT Output 20 mA sink open drain output 2 Bl Digit 4 BIT Output J 20 mA sink open drain output or TEST a Test program 4 PB 2 Count BIT Input interrupt bt ER BIT Input Jj Not connected 63 PB 5 Lugrb 2 BIT Qutput Jz 20 mA sink open drain output J PB 7 Digit 3 msd BIT Output 20 mA sink open drain output 8 PA O a segment BIT Output 5 mA sink open drain output 9x Vad bs Power supply 10 Vss hg Power supply 11 PA 1 b segment BIT Output 5 mA sink open drain output 12 PA 2 c segment BIT Output 5 mA sink open drain output 13 PA 3 d segment KREE i 5 mA sink open drain output 14 O5Cin s Oscillator 15 OSCouLr F Oscillator 16 RESET BIT Input Xy Active low 17 NMI BII I p t j Non Maskable Interrupt 18 PC 4 f segment BIT Output 5 mA sink open drain output 19 PC 3 g segment BIT OO0tpUuEb s 5 mA sink open drain output 20 PC 2 e segment BIT Ou tp rt 5 mA sink open drain output 228 248 ky www BDTIC com ST Appendix B Sample Appl
85. No errors Wed Apr 14 13 14 40 1999 C Program Files ST Realizer Examples Heating heating sch Scheme C Program Files ST Realizer Examples Heating Filter sch Event Timed interrupt 0 01 Sec ST72212G2 DIL28 connection overview Pin Name Alternative name Type 1 RESET BIT 2 OSCin 3 OSCout 4 PB 7 SS BIT 5 PB 6 SCK BIT 6 PB 5 MISO BIT Ts PB 4 MOSI BIT 8 PB 3 OCMP2 A BIT 9 PB 2 ICAP2_A BIT 10 PB 1 OCMP1_A BIT LI PB O HeatingIsON BIT 12 PC 5 Temperature UBYTE 13 PC 4 Setpoint UBYTE 14 PC 3 ICAP2_B BIT 15 PC 2 CLKOUT BIT 16 PC 1 OCMP1 B BIT 17 PC 0 ICAP1 B BIT 18 PA 7 BIT 19 PA 6 BIT 20 PA 5 BIT 21 PA 4 BIT 22 PA 3 BIT 23 PA 2 BIT 24 PA 1 BIT 25 PA 0 BIT 26 TEST 27 Vss 28 Vdd Hardware connections I O Input Input Input Input Input Input Input Input Output Input Input Input Input Input Input Input Input Input Input Input Input Input Input Description Active low 7 Oscillator In Oscillator Out Not Not Not Not Not connected connected connected connected connected Not connected Not connected Push pull output 8 bit analog input 8 bit analog input Used by the application Not connected Used by the application Used by the application Not connected Not connected Not connected Not connected Not connected Not connected Not connected Not connected j Test mode pin Ground Powe
86. PE WORD is available This allows type UBYTE LONG to be connected to the pin For output pins a combination of input pins can be used to define the output type MAX a b c a b c are pin numbers MIN a b c The MAX value returns the largest of the input pin types and the MIN value return the smallest For example MAX1 will return the type of input pin 1 MAX12 will return the largest of the input pin types of pins 1 and 2 Non volatile allocation ALLOCATION FIXED Allocates a non volatile variable with the same variable type as the pin Local variables ALLOCATE x x extra variables are added the variable type of the pin is used 206 248 d www BDTIC com ST Appendix A Variables and Attributes Attribute Types A2 2 Symbol Attributes ALLOCATEBLOCK IN Defines the memory space RAM or EEPROM ALLOCATION By adding the ALLOCATION FIXED attribute to an output pin ST analyser will allocate a non volatile variable usually a EEPROM variable to it This variable is added to the macro parameter list after the list of parameters of that particular pin This enables you to make your own non volatile symbol BLOCK SIZE IN UNITS _ Defines the size of the block in units variables CODE Defines a macro that is executed inside the main execution loop Enter the macro name in the Value field COMMENT The value of this attribute is used in the report file COUNT PIN See DEVICE DEVICE DEVICE attributes
87. ST Recording and Reusing Adjuster and Probe Values Chapter 10 Table 8 Changing the Simulating options There are two simulation modes available e Pin level This is the default setting A pin level drawing of the simulation will be available as well as all of the application schemes e Functional Only the scheme views of the application will be available To change the Simulation mode There are three running modes available e Continuous The simulation will run continuously until you stop or pause manually e Limited loops You can enter the number of loops To change the Running mode processing cycles you wish the simulation to run for in the Stop after field e Limited time You can run the simulation for a specific period of time by entering the amount of time in the Stop after field There are two timing mode options e Use target time This option uses the microcontroller clock To change the Timing mode to time the simulation e Use host time This option uses the PC s clock to time the simulation Note If you choose to use the microcontroller clock for the simulation the simulation time is controlled by the ST device and a scaling effect takes place due to the simulation process This means that for instance the PC may need 10 seconds to represent say 100 ms in the simulated application environment This is the most accurate way of simulating the ST device If you choose to use your PC clock for
88. ST Realizer II USER MANUAL June 1999 Ay Ref DOC ST REALIZER II www BDTIC com ST USE IN LIFE SUPPORT DEVICES OR SYSTEMS MUST BE EXPRESSLY AUTHORIZED STMicroelectronics PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF STMicroelectronics As used herein 1 Life support devices or systems are those which a are intended for surgical implant into the body or b support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided with the product can be reasonably expected to result in significant injury to the user 2 A critical component is any component of a life support device or system whose failure to perform can reasonably be expected to cause the failure of the life support device or system or to affect its safety or effectiveness www BDTIC com ST TABLE OF CONTENTS 1 INSTALLING ST REALIZER Il 1 1 1 2 1 3 2 1 ST Realizer Application Structures 2 2 Programming using Symbols lille 2 3 Inside ST Realizer Applications 0 000000 244 ul e el 2 22 00 tae bed reser qon de UE beh See eh ae rS 2 4 1 State Machine Symbols 0000 eee 25 SDOIeITIOS uuo E ded E ee Red ee ee ee ee EE 2 5 2 TheRoot Scheme uL 25 0 SUDSCICINGS a aq ead X ARR RDEETESJQpasaT2 345 2 0 MEI su aom debuerant
89. Symbol digout Only one instance in the d example AC heme Name HeatinglsON comment Comment Pilot LED ON Description This is a digital output symbol The name value is used for connecting this symbol to the microcontroller output ports see Section 3 3 11 on page 38 The Comment value is used in the report file d 33 248 www BDTIC com ST Tutorial Chapter 3 3 3 9 2 Pump Speed Control A Pulse Width Modulation PWM signal generated on the OCMP1_B output pin TBOC1LR Timer B port for the ST72212G2 ensures pump speed control For this the ARCP compare register is loaded with a value between 0 and 255 that reflects the temperature differential calculated by comparing actual and control temperature inputs see the external input conditions diagram above The pump speed control diagram in the main scheme is as follows Controlling the Pump Speed Cont d from Section 3 3 on page 28 ARCP PumpEnabled En PumpSpeedControl o u Description This is a 2 input multiplier symbol with type inheritance Z A B Type for A and B can be any type from UBYTE through LONG Type for Z is the largest of A or B types For details on type inheritance see Type Inheritance on page 204 ValueTop 255 ValueBottom 0 Description This is a fixed value limiter symbol The output will not be larger than the top value and not smaller than the bottom value Type of O type of any type from UBYTE through LONG
90. The shape of the symbol represents but does not affect the process that is behind it Symbol shapes should not cross the square box in the ST Symbol Editor window this represents the physical limits of the symbol 5 Specify the number of input and output pins For the stepper symbol we require two inputs one for the initial value to be incremented and one for the clock that will control the frequency of the incremental steps and two outputs one for the incremented value and the second for the complement of the incremented value 172 248 ky www BDTIC com ST Chapter 11 Defining a New User Defined Symbol vi Tip All of the above options can be modified later using the Symbol Editor p Z 6 Click the Next button 7 A new dialog box opens for you to specify the input pin data types bes Select the input pin properties There are a number of data types to choose from BIT UBYTE SBYTE UINT SINT LONG and WORD In addition you can specify a sub type either Input or Clock Input 173 248 a www BDTIC com ST Defining a New User Defined Symbol Chapter 11 Fora pin eae this value Choose this data type 0 to 255 Unsigned byte UBYTE 128 to 127 Signed byte SBYTE 0 to 65535 Unsigned int UINT 32768 to 32767 Signed int SINT 2147483648 to 2147483647 Long LONG Any values except BIT type values Word WORD For a detailed description of data types and attributes refer to Appendix A Var
91. age 80 for instructions on how to do this Analog to Digital Converter Symbol The NAME attribute is used for connecting this symbol to a hardware port For this double click the symbol The TYPE attribute is used to define the variable type UBYTE SBYTE UINT SINT LONG or WORD The COMMENT attribute is used in the report file Digital Input Symbol The NAME attribute is used for connecting this symbol to a hardware port For this double click the symbol The COMMENT attribute is used in the report file Type BIT Digital Output Symbol The NAME attribute is used for connecting this symbol to a hardware port For this double click the symbol The COMMENT attribute is used in the report file Type BIT Ay 103 248 www BDTIC com ST Input and Output Symbols Chapter 8 Event Symbol Can be used only in a subscheme to cause the symbols that follow it in the subscheme code f hen th i event name 4 ow to be executed when the associated event occurs Output type EVENT comment Event With Enable Symbol Can be used only in subschemes to connect an event to the scheme it Is in E HAME thus causing an event driven execution of the scheme Comment E type Boolean When TRUE it enables the execution of the event driven subscheme OutDigital representation of the event type Event CountEvent name the user is prompted for the symbolic name Count The connection is made to a micro controller event interrupt and
92. al Input Conditions The external input conditions proceed from two inputs e The control temperature Setpoint in the diagram shown below he measured temperature Temperature in the diagram shown below The above external input conditions are indicated on the input pins on the microcontroller Each time an input signal changes it is processed and the appropriate condition Start or otop resulting from the comparison is signalled to the state machine by changing the condition value to 1 The processing is designed as follows TYPE SINT pu Setpoint Diagram cont d in Section 3 3 9 2 on page 34 Temperature Z UINT filter sch Temperature in 1 10 degrees Celsius External Input Conditions Draw the above diagram on your heater main scheme with the help of the following tables that describe the symbols you ll place what they do and the values entered with them Don t forget to wire your diagram appropriately d 28 248 www BDTIC com ST Chapter 3 Tutorial 3 3 7 1 Symbols Input and output Symbol adc There are two occurrences of PER Kid this symbol in the diagram Comment As shown in Comment diagram Name SetPoint and Temperature Type UINT Description This is an analog to digital converter input symbol The NAME value connects it to a hardware port see Connecting Hardware Ports and Peripherals on page 38 The TYPE value is used to define the variable type UBYTE SBYTE UINT SINT
93. ample a symbol that has two input pins one which is BIT type and the other WORD type and one output pin of WORD type and with the attribute CODE Stepper has the macro name Stepperbww Parameters The macro name is followed by the macro parameters A parameter set is used for each variable according to the signal type and function BIT type input and output pins have the parameters variable name bit number variable type where bit number is the position of the bit within a byte WORD type input and output pins have the parameters variable name variable type BIT type clock input pins have three parameters for the current clock variable variable bit number variable type and three parameters for the previous clock variable variable bit number variable type WORD type clock input pins have two parameters for the current clock variable variable name variable type and two parameters for the previous clock variable variable name variable type where current and previous refer to the loop The parameter sets are ranked by the pin number 11 4 8 Writing the Assembly Macro Macro headers are created as requested on page 175 For our Stepper symbol we requested an initialization macro header called iStepper and a main code macro header simply called otepper These macro headers enumerate the parameter list for each portion of the code e for the initialization portion of the code the parameter list is Data tData Clock nClo
94. analogous to an lf Else statement where the If condition is whether a specified number of ticks have been counted at the beginning of each main loop cycle For example at the beginning of each main loop cycle the number of timer ticks elapsed during the previous main loop cycle is written to a variable called rtick In other words during the execution of main loop cycle n the value of rtick is equal to the number of ticks elapsed in main loop cycle Subschemes Execution Conditions and Events Reset entry point Initialization Normal Code Execution Periodic Code Part Subscheme Optimized part Periodic Optimization Update timer datastructures n 1 Because periodic events and execution conditions add together rtick values to count elapsed time they are relatively imprecise timing methods and should not be used when the application requires a very precisely timed event to take place For example imagine that the you wish to define an event period equal to 5 timer ticks oay that during the first main loop cycle the number of timer ticks elapsed is equal to 2 The value of rtick for the duration of the second main loop cycle will therefore be equal to 2 However during the second main loop cycle because of other events or interrupts the execution time is longer and 4 timer ticks elapse The value of rtick will be 4 for the 1 A more detailed look at how the variable rtick is related to the timer
95. ange adjuster values 5 Once you have finished recording simulation information close the log file by clicking P ky 163 248 www BDTIC com ST Recording and Reusing Adjuster and Probe Values 164 248 www BDTIC com ST Chapter 10 Chapter 11 Overview 11 CREATING YOUR OWN SYMBOL 11 1 Overview You create or edit your own symbols using ST Symbol Editor Creating a symbol involves the following tasks e Creating a symbol shape e Placing pins that represent the variables that are input to and output from your symbol e Linking your symbol to the macro s it represents Once you ve finished creating your symbol you can create a customized library containing all the symbols that you used in a project including symbols that you created yourself The creation of new symbols falls into two categories The creation of new subscheme symbols These are the symbols that represent subschemes in the root scheme A number of subscheme symbols are included in the main library but you may find that you need to create your own because you require a different number of input and output pins that available in those symbols provided e The creation of new user defined symbols This is a means by which you can design your own symbol to perform a customized function Note that creation of a new user defined symbol requires a sound understanding of how to program in assembler code as it will be necessary to write the macros which define
96. apply to macros associated with some particular symbols They are automatically specified when you select the symbol They extend the macro definition with additional information added in the macro argument list after the pin and value attribute parameters The available DEVICE values are DEVICE INPUT which extends the macro argument list with the input port parameters In this case the attribute NAME must be used to associate a hardware port Examples input inputlatch symbols DEVICE INPUTREG is used to enable a hardware connection to an Input register DEVICE INPUTALL is used to enable a hardware connection to any hardware resource DEVICE OUTPUT which extends the macro argument list with the output port parameters In this case the attribute NAME must be used to associate a hardware port Examples output outputlatch symbols DEVICE OUTPUTREG is used to enable a hardware connection to an output register DEVICE OUTPUTALL is used to enable a hardware connection to any hardware resource 207 248 4 www BDTIC com ST Attribute Types Appendix A Variables and Attributes DEVICE cont d DEVICE TIMER which extends the macro argument list with a time value a time variable and a system tick variable The time value is optional attribute TIME 2 00 00 The type of the time variable is determined by the constant time value or the attribute TIMEPIN x where x is an input pin number The TIMER attrib
97. arget ST microcontroller by clicking the device icons in the list until the name of the chosen device is displayed Select the target device by clicking once on it 3 Click OK to confirm You may also double click the line showing the device 4 Once you have selected your target hardware the Project Viewer will open similar to Ire heating sch that shown at right E3 Libraries CN Target hardware 39 Project heating E ST 221282 Two 16 Bit Timers 8K ROM 255 Bytes RAM A 60 248 www BDTIC com ST Chapter 5 Choosing a Target Microcontroller 5 2 2 Changing the Target Microcontroller Once you have specified a target hardware device for a project the configuration and a connection information for that device is stored in the rpf file for the project If you change the target hardware device of a previously existing project the new target hardware device information is also added to the rpf without losing the previously specified device information To change the target hardware device for an existing project follow these steps 1 Open the Project whose target microcontroller you wish to modify Tools maea Options 2 Click Hardware Select on the Project menu or double click the target hardware device in the Project Viewer 3 The Select target hardware dialog box will open Hardware select showing the target hardware device previously Hardware settings selected Simply browse to t
98. ated functions are based on the timer tick they cannot measure times less than the value of one tick Furthermore the closer the value of the measured time period is to the value of one tick the more inaccurate the timer function will be refer to Periodic Events on page 87 for details on why this is Once you have entered the Timer options you wish click OK 4 Thelast tab opens the Optimisations dialog box The options in this dialog box are not currently available in this version of ST Realizer Il However they are implemented in Realizer Gold which can be obtained from Actum oolutions 9 3 Executing the Analysis and Compile When you execute the analysis and compile ST Realizer performs the following tasks Creates a netlist of all the schemes in the project Creates the cross references between all schemes in the project Analyses the logical functionality of the schemes for consistency Generates the ST code Transfers the ST code to the assembler for the chosen target hardware This assembler generates the final executable code that is transferred into the target ST ocans the map file and generates a report file You may execute the ST Analyser from any of the project windows ky 133 248 www BDTIC com ST What to Do if there are Errors Found during Analyse Chapter 9 e n the Project menu simply click Analyse The ST Analyser Status window will open and you will see the Analyse function checking your application
99. ble you to view the signals that are generated by your application Run the simulation 3 5 17 Creating the Simulation Environment File se The first step in simulating your application is to create its simulation file Simulation files are based on the application schemes and the target device and are created in ST Simulator To create the heating control simulation environment file 1 d Make sure that the heating control application is open window Help Simulator F1 bol Editor Ctrl F11 On the Tools menu click Simulator cvm The ST Simulator window opens On the File menu click New gt Simulation environment The Create a New File dialog box opens letting you assign a name for the new simulation environment Type the name of the sef file heating sef Click Save 47 248 www BDTIC com ST Tutorial Chapter 3 Create a new file Save In CH Heating kd ES am Mam set File name Save as type Environments sel sl Cancel You ve now created the simulation environment file for the heating control application A pin level drawing of the ST72212G2 chip appears as shown at right Note that where the pins have been connected to application input output functions the pin names have been replaced by the function names If you double click on the pin level drawing you will open a SEK copy of your root scheme diagram as another window You wen can also open subschemes
100. by double clicking on the MOSI subscheme symbols OCMP2 A You can use both the pin level drawing and the scheme ICAP2 A diagrams to help you run the simulation both views are useful OCMP1_A in evaluating whether your application is running as you wish Heatingls ON Temperature IC ob P To see all views at once under the Window menu select e Setpoint Tile IC ob P CLEOUT OCMP1_ H 3 5 18 Connecting Probes and Adjusters You are now going to connect probes and adjusters to your scheme so that you can adjust input values to the application and view output values This enables you to experiment with and fine tune your application There are four types of adjusters and three types of probe available and these are described in detail in Sections 10 2 and 10 3 respectively Connecting an Adjuster In our application recall that there are two temperature inputs a Setpoint temperature which is the desired temperature for the system and the Actual temperature which is read and 48 248 Ky www BDTIC com ST Chapter 3 Tutorial filtered by a temperature probe In our simulation environment we need to adjust both of these temperatures in order to test how our application responds In order to control these temperatures we use a Numeric Adjuster which allows us to input and adjust the values we wish The first adjuster you are going to connect is an adjuster placed on the pin level drawing that will simulate the setpoi
101. cading menu you obtain by right clicking any blank area in the scheme worksheet Click CH then click where you want the new centre to be on the scheme You may also click the Pan entry in the View cascading menu you obtain by clicking the blank area in the scheme worksheet www BDTIC com ST Chapter 7 Printing the Currently Active Scheme Printing all Project Schemes Viewing Hidden Attributes Working in Schemes Click the File Print sequence in the main menu bar Continue the normal printing dialog and click OK when ready e Set Up the Printer On the File menu click Printer setup The standard Windows Print Setup dialog box opens Refer to your Windows documentation for further information Click OK when you have finished setting up your printer e Choose a Printer Font On the File menu click Printer setup next click Properties and the Font tab For best results use the True Type fonts that come standard with the your Windows environment Click Project and select Print in the drop down menu meses Options Tools ei Continue the normal printing dialog New and click OK when ready Open Close Hardware select Hardware settings Analyse F11 When the shapes and pins that make up a symbol are created attributes can be assigned to them to define additional characteristics These attributes are not visible by default when you design an application since they Zoom In
102. che he he he e e e che he he ke e e e c e e e ehe he he e e e che he he he ke ke e ce eec e ke e e e e e e He ke ke ke he ke ke ce ke ke ke ke e e k ke e e ke k k k stepwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 local labnr test rising edge on the Clock input bittjf Clock nClock E amp labnr bittjt pClock pnClock E amp labnr addition of 2 bytes if tS if tData eq TCONST ld A low Data endif if tData eq TUBYTE or tData eq TSBYTE ld A Data dendif if tData eq TUINT or tData eq TSINT ld A Data 1 endif if tData eq TLONG ld A Data 3 endif if tin2 eq TCONST add A low c5 endif endif if tS eq TUBYTE or tS eq TSBYTE ld S A endif if tS eq TUINT or tS eq TSINT Ay 189 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 ld S 1 A endif if tS eq TLONG ld S 3 A endif if tS eq TUINT or tS eq TSINT or tS eq TLONG if tData eq TCONST ld A low Data shr 8 endif if tData eq TUBYTE clr A endif if tData eq TSBYTE clr A push CC bittjf Data 7 A amp labnr cpl A A amp labnr pop CC endif if tData eq TUINT or tData eq TSINT ld A Data endif if tData eq TLONG ld A Data 2 dendif if tin2 eq TCONST adc A low c5 shr 8 endif endif if tS eq TUINT or tS eq TSINT ld S A endif if tS eq TLONG ld S 2 A endif if tS eq TLONG
103. cheme input change event 95 Subschemes sess 7 85 92 assigning execution conditions to 93 connecting to root schemes 92 Creating RR 68 92 disconnecting execution conditions WOI E 97 introduction To 7 BAV WAG EE 98 Opening 93 placing event symbol in 94 GV MOONS 92 defining new eseseeeeeeese 166 Symbol editor eoennaennnennanenneennnennneenne eenen 165 adding graphics sss 178 adding pins to a symbol 181 assigning attributesl 182 changing graphic properties 179 editing new symbols 176 editing pin attributes 177 241 248 www BDTIC com ST INDEX editing symbol information 180 generating macro headers 175 modifying attributes 185 Opening 165 Symbol libraries re 73 Symbol preferences os neeieennneneeenneeennae 198 Symbols cle 80 103 OG 118 Analog to digital 80 zo w 107 con 107 cio 108 and E 108 2 6 oa Hm 108 attaching atiriluties 182 attributes Te ir gro PERPE CT cc 75 ALSI AEVO EEEE 118 ale Lei 121 silver ACK E 122 Change 108 Eeer 122 Copditton 127 connecting to target
104. ck tClock pClock pnClock ptClock S tS NS tNS and c5 188 248 ky www BDTIC com ST Chapter 11 Defining a New User Defined Symbol e for the main portion of the code the parameter list is Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS and c5 The final macro calls i e the contents of the ASCII file stepper inc will look like this Hd d ke Fe de KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KKK KKK KK KKK KKK KK KKK KKK KK KEK KK KKK KKK KE Ke Ke He He KKK He He ke Ke e e e e KKK 7 S istepperwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 S Description Initialize Word STEPPER Hd d KK KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KKK KK KKK KEK He He Ke ke KK He ke Ke e ke ke e KKK istepwbbww macro Data Data Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 if tNS ld A 0FFH if tNS eq TUBYTE or tNS eq TSBYTE ld NS A endif if tNS eq TUINT or tNS eq TSINT ld NS A ld NS 1 A endif if tNS eq TLONG ld NS A ld NS 1 A ld NS 2 A ld NS 3 A endif endif mend 7 F F k k k e KKK KK KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KK KK KKK KKK KK KKK KKK KK KKK KKK KK KKK He Ke He ke Ke ke e ke ke ke ke ke k k k k k 7 stepperwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 Description WORD stepper 7 F F k k k ke ke Fe ke K Fe de ke e ce e e
105. click Simulate The Simulate Options dialog box opens 2 Click the Logging tab d 161 248 www BDTIC com ST Recording and Reusing Adjuster and Probe Values Chapter 10 The Logging daughter dialog box opens Simulating Logging Enter a log file Browse v Start logging with an empty file after an initialization Select a log file Look ir Cd Heating e ES Play back the lag File name myname Files of type Loa files log Cancel 3 Type the name of the log file you want to create in the start logging box or browse through the appropriate folder 4 Click Open 5 Run your simulation The log file will be recorded while your simulation is running Once you have finished recording simulation information close the log file by clicking M 10 6 14 Reusing Adjuster Values Once you have recorded a log file you can reuse the recorded adjuster values in subsequent simulations In the Simulate Options dialog box 1 Click the Logging tab The Logging daughter dialog box opens as shown on page 161 162 248 www BDTIC com ST Chapter 10 Recording and Reusing Adjuster and Probe Values 2 Type the name of the log file you want to create in the play back box or browse through the appropriate folder 3 Click Open 4 Run your simulation The adjuster values recorded in the log file are input to your simulation while it is running Note that you can also manually ch
106. compiled ST6 or ST7 macro assembler language asm file from the scheme e Generates the compiled binary ST6 or ST7 executable file Depending on whether or not you included the ROS see Section 2 3 on page 5 and Section 5 3 4 on page 63 a file with extension hex or obj respectively is generated for ST6 or with extension s19 or obj for ST7 A hex or s19 file can be directly loaded into an ST MCU while you must link a obj file with another program When the analysing process has been successfully completed a report file is generated This report file gives information about the designation of I O pins a list of the variables used by type and the memory space required by the application ky 11 248 www BDTIC com ST Application Development Steps Chapter 2 Once you have compiled your application you can use ST Simulatorto simulate its behavior generate and view input signals monitor signals that are generated by your application and fine tune it if necessary You design simulation environments in the same way you design schemes except that the design is held in what are called simulation environment files To provide you with greater flexibility you can create or edit your own symbols using ST Symbol Editor You create a symbol by drawing its shape placing pins that represent the variables that are input to and output from the process you are defining then linking it to the macro it represents All the files and def
107. ctions Application Symbol Microcontroller Pin SetPoint adc PC 4 8 bit analog input Temperature adc PC 5 8 bit analog input HeatinglsON digout PB 0 Push pull output ARCP outputlatch TBOC1LR Timer B Register To make these connections follow the instructions for connecting a port device for the Setpoint Temperature and HeatinglsON symbols and the instructions for connecting an on chip peripheral for the ARCP symbol 3 3 11 1 Connecting a port device You re now going to connect the SetPoint input 1 Double click the SetPoint adc symbol The I O Hardware connections dialog box E 5T72212G2 170 Hardware connections Connect resource to UBYTE Setpoint Available resources Connected resources opens listing the available PC Input i HL UO bit analog input pins for the type of PC 1 8 bit analag input e HL A 8 bit analog input SC connection you want to PC 3 8 bit analog input HL A 8 bit analog input make PC 5 8 bit analog input You are going to connect E the first adc to PC 4 8 bit analog input Properties OF Cancel 1 Pin connections depend upon the application and target microcontroller For this tutorial application and our target microcontroller ST72212G2 we have specified the necessary pin connections In order to correctly create your own application you will need to be familiar with the target microcontroller for which it is intended d 39 248 www BDTIC com ST Tuto
108. d An example of a lookup table is _ value EE value According to the above table when the input value is 10 the table symbol will output the value 82 When the input value is not equal to either 10 15 30 or 35 the output value will be equal to O Index tables are single column tables of output values only however each consecutive value has a different indice For example the first value in the table would correspond to the default value the second value would have indice 0 the third to indice 1 etc This allows values to be output sequentially such as would be the case if you had a loop where at each iteration the output value changes An example of an index table is According to the above example if the input value was 2 the index table symbol would output 132 Tables can store values in the Binary Decimal Hexadecimal and Octal formats The first line in a table defines the default output value def This is the value that is output if the input value is out of the range defined by the table 157 99 248 www BDTIC com ST Table Symbols Chapter 7 Once you have placed a table you can either import data from an ASCII text file or enter the data directly into the table The following diagram shows the format of ASCII files note that commas are used to separate table entries ASCII File Contents Table Values y T o 10h 14h 20h 30h 40h 100h ST Realizer store
109. d Output Symbols 103 8 2 Sequential Symbols n nana aaaea ee 105 Bo LOGIC 5 WBbOIS EE 107 8 4 Time Related Symbols 116 8 5 Mathematical Symbols 0 0 ees 118 6 6 Counter SymbDOolS 24 42 26 dca p Ze tree ieee de d erer See dew od ard 120 8 7 Conversion Symbols 121 68 Table SyITDOlS us ocean onere parie Eo etaed rad equae eso perdo 124 8 9 Power Management eee 125 8 10 Constant SymbOolS au ia d ege geg A odo dod dde dep E deg dod 126 8 11 State Machine Symbols lille 126 8 12 Hierarchical Sheet Symbols llle 128 8 13 Title Symbols sss se staota aitia waia MRa a E E E re 128 9 ANALYSING AND GENERATING YOUR APPLICATION 129 OA OVGWICW ar EE hee ead eee ae bee EN ed Bee ead we 129 9 2 Changing the Compile Options 0 0 0 0 cc eee 129 9 3 Executing the Analysis and Compile llle 133 9 4 What to Do if there are Errors Found during Analyse 134 9 5 Viewing and Tracing Generated Messages 135 9 5 1 Viewing the Analyse and Compile Report 135 ky v www BDTIC com ST Table of Contents 10 11 vi 9 6 Printing Reports 0 0 ce RR I eae 138 SIMULATING YOUR APPLICATION leeren 139 10 1 Working with Simulation Environment Files suse 139 10 1 1 Creating a New erkie eee 139 10 1 2 Opening an Existing serie 141 10 1 3 Saving a
110. d call it an appropriate name such as my symbols mac for ST6 or my symbols inc for ST7 Copy and paste the new symbol s ASCII macro i e the contents of the ASCII macro file you created on page 187 either to your newly created library file or to the end of the main library file above Save the library file Note It is always wise to save your new symbol macros and any modified or created 4 libraries to a back up folder or on a floppy disk In the event that you need to reinstall ST Realizer the root folder will be overwritten and all of your customized symbol libraries will be replaced by the ST Realizer default libraries Next save the symbol graphic by copying and pasting the new symbol graphic from within the scheme where you created it to a new blank scheme From this new ky 191 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 scheme containing the new symbol select File gt Save as filename 1ib where filename is the name of the symbol for example stepper l Tip When you save a scheme as a library you will copy all of the symbols in that Lo Nee 22 scheme to the library Therefore to save only the new user defined symbol to the library it needs to be in a scheme by itself d Each time you wish to use the symbols that you have created from within the project where you are working perform the following 1 Select Project gt Hardware settings 2 Inthe Hardware settin
111. d corresponds to a result of 255 B2 3 Software Generation The functional description of the application includes e The analog input through an ADC to read the value issued by the voltage dividers e Key recognition e Transfer of the result to other functional blocks or conditional jumps in a state machine The recognition of the pressed key is achieved by comparing the digitized analog value with the range limits defined in Table B3 However these ranges 0 0 24 26 up to 229 230 are not contiguous thus two comparisons upper limit and lower limit are required to check that a value is within a range This means that more ROM and RAM is used with an higher execution time Thus some extended ranges with common limits are defined as shown in Table B4 Table B4 Recognition ranges 4 217 248 www BDTIC com ST Analog Multiple Key Decoder Appendix B Sample Applications A range limit value is never reached see Table B3 therefore no ambiguous situation can occur The key pressed can then be recognized with numeric comparators and some logical gates as shown in the Figure B8 The output signals generated Key O Key 9 None are logical signals and can therefore be used both as input signals to other functions or as conditions in a state machine Figure B8 Key Recognition by Analog Value Evaluation Key 0 A L Key 1 B Key2 From the voltage divider amp B Analog value entry Key recogniti
112. d group the edit functions Cut Copy and Paste buttons Placing a separator widens the space between two buttons To place a separator 1 In the Active buttons box click the button to the left of which you want to place a separator 2 Click the Separator button then click OK 12 6 3 Changing the Order of Toolbar Buttons 1 Inthe Active buttons box click the button you want to move 2 Click Up to move the button one place to the left or Down to move the button one place to the right 3 Repeat step 3 until the button is in the required position Click OK when you have finished ordering the buttons 12 6 4 Restoring the Default Toolbar 1 Click Default 2 Click OK 200 248 d www BDTIC com ST Chapter 12 Wire Drawing Options 12 7 Wire Drawing Options You can change wire characteristics and snapping distances 1 Inthe Environment Options dialog box click the Wiring tab The Wiring dialog box opens fe Environment options E v Snap to object at v Auto wire Stop auta wiring after Wire color Junction color UK Cancel 2 Tochange the snapping distance click the corresponding check box and overtype the appropriate value in the text box 3 To enable the auto wiring and or auto reroute features click the appropriate check box e With Auto wiring ST Realizer draws the wires by automatically choosing the shortest path between the symbols to be connected creating corners where required e Wi
113. differential between the actual temperature and the setpoint temperature is larger than a preset constant a new condition called Start is met and a signal equal to 1 is sent This signal triggers the transition between the HeatingOFF state and the HeatingON state meaning that the heating system is powered and the pilot LED is switched on To create the HeatingON state we must place a state symbol to which we assign the name value HeatingON and then wire it to the Start condition as shown in Figure 1 Now the pump should operate in such a way that its speed is proportional to the differential observed between the actual temperature value and a preset temperature value In order to do this the pump must be enabled prior to operation The system must change to the PumpEnabled state A new condition symbol SetPump is needed that will trigger the transition between the HeatingON state and the PumpEnabled state Similarly another condition Stop will ensure the transition between the PumpEnabled state and the HeatingOFF state You can see that the same symbol condition is to be used four times the state symbol itself is to be used three times When one symbol already exists in a scheme you can copy it rather than selecting it from the library Since you are now going to place the Start condition symbol you can copy it from the SetupTime condition symbol 1 Click just next to the SetupTime condition symbol to select it SC
114. e I Auto backup every 10 min Selectonbos color Em E dit Ghostbox calor mm Edit OF Cancel Select the backup options that you wish To create a backup file every time you save your work e Check the Make backup on save check box by clicking it This creates a copy of the file before your latest changes are saved If a backup file already exists the new backup file overwrites it To create a backup file at regular intervals e Check the Auto backup every check box by clicking it and enter an interval in minutes in the text box If you want to change this overtype the displayed value This causes a copy of the file to be saved periodically Set Change the screen preferences To change the Ghost box or Selection box colors e Click the appropriate Edit button and select the new color from the displayed palette 3 Click Ok when you have finished 194 248 d www BDTIC com ST Chapter 12 Attribute Display Preferences 12 2 Attribute Display Preferences In this tab you can change the default settings for the display of attributes on the worksheet 1 Inthe Environment Options dialog box click the Attribute tab The Attribute dialog box opens Calor EH Cor Size 2 m m Alignment Horizontal Center BR Vertical Center gt LIF Cancel 2 To change the attribute label color click the Edit button and select the new color from the displayed palette 3 To change the attribute label
115. e an AND2 symbol cannot be used to perform an AND on a BIT and a UBYTE variable Note that the type WORD covers any data type other than BIT 203 248 4 www BDTIC com ST Variable Types and Rules Appendix A Variables and Attributes To define a variable type you attach an attribute with the Tag TYPE and the name of the variable type in the Value field Note A LONG variable uses 4 bytes in RAM while a UINT or SINT variable uses 2 bytes and an UBYTE uses 1 byte To save RAM space it is therefore recommended that you use the LONG variable range only when needed A1 1 Type Inheritance Multiple type pins support type inheritance this means that the output pin type is the same as the greatest of the input pin types The following picture shows how type is inherited by the AND2 symbol Note that if the expected result is outside the expected range you must set the appropriate type for the output pin by placing a TYPE attribute on that pin For example if a multiplication is performed between the values 124 and 245 which are both UBYTE type variables the final result will be 30380 which is a SINT type variable Thus the SINT type must be attributed to the output wire Note Operations between BIT and WORD variables are not allowed d 204 248 www BDTIC com ST Appendix A Variables and Attributes Attribute Types A1 2 Type Overruling You can overrule type inheritance rules By placing an attribute with the Tag TYPE
116. e custom sch in this attribute field with its correct path i e the project folder in which the subscheme file will occur Note Remember that if you enter a filename in this attribute field the path by default will be the path of the project in which you created edited the subscheme symbol To be able to access a particular subscheme from any project we recommend that you copy the subscheme file you have specified for example custom sch to the lt root folder gt Lib folder and using the symbol editor in the filename attribute field enter path and filename of the subscheme as follows lt root folder gt Lib filename sch For example in order to use the subscheme Custom ech in any project we would place a copy of custom sch in root folder gt Lib and using the symbol editor enter root folder gt Lib custom sch in the subscheme filename attribute field Note Theexact root folder path depends on where you installed ST Realizer on your PC By default this path is C Program Files ST Realizen Lib Exit the Symbol Editor saving your changes Repeat the above steps for each new symbol you have included in the scheme 6 While in the subscheme you created in Step 3 i e femporary sch select File gt Save as from the main menu and save the file as a library file 1ib extension in the library folder root folder gt Lib Give the new library a suitable name for example my symbols 1lib Your new subscheme symbols
117. e macros that will define how the symbol functions 11 4 6 Creating the Macro Header In the symbol editor popup menu select Create ve heading The macro header for the new symbol is copied to the le clipboard Edit description Create heading For our example symbol Stepper we generated two macro headers iStepper and Stepper iStepper looks like kc check KKK KKK KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KKK KKK KK KK KK KKK KKK KK KKK KKK KK KKK KKK KKK KK KEK ke ke ke ke e e ck ke e ke ke ke ke ke ke KEK istepperwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 Description Initialize Word STEPPER 5 kc k k kc ce Ke Fe Fe e e ce e eee he he Fe e e e che he he he ke ke e che he he e e e ec e He e ehe he KKK e e che he he ke ke e e ce e eee e e hec e e che ke he he ke ke e ce ke He ke ke e e ecce ke ke ke ke ke ke ke e k In the iStepper macro the wbbww after the istepper is a listing of the inputs and outputs word the Data input pin clock input bit the Clock input pin and the two output pins S and NS are both word types because they were programmed to take the maximum valued input pin type i e the word type See Naming Macro Instructions below for more information on the abbreviations used for data types Once the macro header has been copied to the clipboard create a new ASCII text file using an ASCII text editor and paste the macro header into the text file
118. e ST Realizer system To view or set the compile options 1 Onthe main menu click Options then Project The Analyse options dialog box opens with tabs for you to select daughter dialog boxes Tools vv Project Environment 2 The Code Generation dialog box is the first of the tabs LUN eee die Generate source code Code optimisation option the Invoke assembler and Generate E A LETS final hex code options will W Invoke assembler also be deselected as W Generate final hex code these are suboptions of the code generation process They control respectively the generation of your application in ST6 or ST7 assembler code the creation of the asm file ok Cance and the creation a binary hex version of the code a hex obj or s19 file depending on the microcontroller as described on page 129 Iv Include project data in source code 130 248 ky www BDTIC com ST Chapter 9 Changing the Compile Options ON J Tip Note that you must generate the assembler version before you can produce the binary hex code The first three options must be selected in order to produce the binary hex code you need to load your application into your microcontroller using a programming tool x The final option in the Code generation dialog box is to include project data in the source code If this option is enabled the Analyse report will record how many times Analyse has been performed which is
119. e a 2 6 4 Execution Conditions llle 2 65 Event Symbols lllllllllllelenn 2 How ST Realizer Keeps Track of Time 2 8 Connecting your Application to the Target Device 2 9 Application Development Steps lllllsnn 3 TUTORIAL 526x ua eres ws be ireu ne obese wie rur oe eee ds 3 1 Setting Up Your Project 0 0 ee 3 1 1 Creating the Project File Ls 3 1 2 Choosing a Target Microcontroller 3 1 3 Opening the Main Scheme 3 1 4 The Worksheet Toolbar Less 3 2 Designing and Drawing Schemes 3 2 5 The State Machine Diagram 3 3 Completing the Heating Control Application 3 3 6 What differentiates a main scheme from a subscheme 3 3 7 External Input Conditions 3 3 8 Internal Input Conditions 3 3 9 External Actions llle ST Folders and Sub folders e 2 INTRODUCTION AND CONCEPTS www BDTIC com ST What You Need to Install ST Realizer ll Installation Procedure sRRIRRR Table of Contents 3 3 10 The Creation of a Subscheme for an Internal Event Driven Action 35 3 3 11 Connecting Hardware Ports and Peripherals 38 De EVEN GO sed e420 den dE ea d uci dp Ron deb n dues dob ici eee dw uci 41 9 90 19 SUMMA amp
120. e input Note When the variable delay is started all normal execution process are halted Only the interrupts are still active The watchdog if applicable is not reloaded Sequential Input Symbol Converts if enabled a physical input to a binary value This symbol is meant for time critical operations Name Physical input The user is prompted for the symbolic name In and the input type The connection is Name made to a physical micro controller pin or register and is En Out inputsequence invisible En type Boolean When true the physical input is read Out type Boolean A copy of the En input This output is used for linking the sequential symbols Comment Note When the input sequence is enabled the physical input is read immediately Sequential Output Symbol Converts if enabled a binary value to a physical output This symbol is meant for time critical operations Name Physical output type All The user is prompted for the symbolic name Ol The connection is made to a physical micro controller pin and is invisible HANE E O us aa En type Boolean When true the physical output is written Comment Out type Boolean A copy of the En input This output is used for linking the sequential symbols Note When the output sequence is enabled the physical Output is written immediately 106 248 Kr www BDTIC com ST Chapter 8 Logic Symbols Wal MAME waitsequence En MW out Comment
121. e microcontroller for which the application has been designed lt is therefore imperative that you fully understand the specifications of the target microcontroller before you begin to design your application Datasheets for those ST6 and ST7 microcontrollers supported by ST Realizer are supplied on the ST Realizer CD ROM In addition datasheets for SI microcontrollers can be easily obtained from the STMicroelectronics microcontroller web site http st7 st com The remainder of this chapter will describe the basic concepts behind using ST Realizer to help you generate your embedded application programs ST Realizer was developed by ACTUM Solutions expressly for STMicroelectronics for use in developing embedded applications for ST6 and ST7 microcontrollers In addition to ST Realizer ACTUM Solutions provides a variety of other software products some of which can be used as a complement to ST Realizer to further refine your application For more information please refer to the ACTUM Solutions web site http Wwww actum com d 3 248 www BDTIC com ST ST Realizer Application Structures 2 1 ST Realizer Application Structures Perhaps the best place to start describing ST Realizer is at the final product the generated assembler application that ST Realizer will produce for you It is important to understand how the final generated code is structured before you start designing your application so that you are aware of
122. e of the assembler code behind the symbol e Finally writing the assembler macros that define the symbol s function The above steps are general and it is clear that detailed instruction on how to create a new user defined symbol will vary depending of the symbol function It is not within the scope of this document to give instruction on how to write assembler code so in the steps that follow we will explain using an example how to define a new symbol The example we will show here is a stepper symbol a symbol whose function will be to increase an input value by a fixed increment upon detection of a second signal input signal The stepper symbol will output both the incremented value and its complement ky 171 248 www BDTIC com ST Defining a New User Defined Symbol 11 4 1 Defining the New Symbol 1 Open the Symbol Editor fee Select the symbol properties x Chapter 11 Symbol name 5 tepper Select a symbol C Sub scheme symbol f User defined symbol Select a shape Ge Rectangle Circle Number of input pins 2 Number of output piri 2 Hack Mest gt Cancel 2 Give the new symbol a name In our example above we have named our new symbol Stepper Click the user defined symbol radio button 4 Select the shape you which to assign to the symbol The shape of the symbol can be either rectangular or circular For our example we will choose a rectangle shape Note
123. e properties x Width 2 0 n r Height E Im n r Start at ft degrees End at jo a degrees Line thickness ft m m Color Edit Cancel In this dialog box you can change the dimensions of the graphic the angle if the graphic is a line the line thickness and color and finally you can choose to fill the graphic In our Stepper example we are going to add a small graphic to help identify the symbol 1 3 e n the symbol editor window select i from the Data oc or symbol editor toolbar or select New2Arc in the 2 oc 4 popup menu Glock NS e Using the ellipse drawing tool draw the footsteps as shown e Using Change properties dialog box fill the four ellipses that make up the footsteps 11 4 2 4 Symbol Information m To change the text that describes the symbol when you click the Jf button select Edit design notes in the popup menu and enter the description you wish in the dialog box 180 248 d www BDTIC com ST Chapter 11 Defining a New User Defined Symbol 11 4 3 Adding Pins to Your Symbol The pins you place on your symbol represent the variables that are input to and output from the symbol you are defining To place a pin 1 Click il in the symbol editor toolbar or select New gt Pin in the popup menu fe Create a pin x Input output Input Type Input Llack input Label Passive output Number E Color mE E dil Cancel The Cr
124. ealizer Il 1 INSTALLING ST REALIZER Il 1 1 What You Need to Install ST Realizer Il You must install ST Realizer Il on a PC that meets the following requirements Table 1 PC Hardware Requirements Minimum requirements For Optimum Performance Processor Intel 80486 Processor Intel Pentium 100 MHz Monitor Grey scale VGA Monitor Super VGA 17 Mouse Mouse ST Realizer Il runs under Microsoft Windows 95 98 or NT 1 2 Installation Procedure 1 Boot your PC under Windows 2 Put the ST Realizer CD ROM in your CD ROM drive The CD ROM s autorun function will open the Setup program automatically 3 Follow the instructions that appear in the pop up windows The Installation program will ask you to specify the folder into which you wish to install ST Realizer The folder you choose will be the root folder Either accept the default or enter a new installation folder Installation is now complete To launch ST Realizer click Start 2Programs 2ST Realizer Il 2Realizer d 1 248 www BDTIC com ST Folders and Sub folders Chapter 1 1 3 Folders and Sub folders The installation process creates the following folders and sub folders root folder which contains the system executable files and DLLs The root folder is C Program Files ST Realizer by default root folder Examples which contains examples of ST Realizer projects root folder Help which contains the help files a readme file and PDF docum
125. eate a pin dialog box opens 2 The pin number is automatically generated and displayed in the Number field This is reflected in the structure of the arguments for the assembly macros The pin number sets the sequence of parameters 3 In the Label field enter a label for the pin This corresponds to the variable name 4 In the Input output field select the type of pin you want to place Clock input Input pin that can distinguish between a rising edge a falling edge and a plateau by storing the previous input value and comparing it to the present input value Output Normal output pin There can only be one output pin on a net Passive output Passive output pin An example of a passive output is a state There can be more than one passive output pin on a net 181 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 5 Inthe Type field select the capacity of the pin you want to place this value range Unsigned byte UBYTE Signed byte SBYTE Unsigned int UINT Signed int SINT 2147483648 to Long LONG 2147483647 Any values except BIT Word WORD type values Any No type 6 If you want to change the pin color click the Color box then choose a new color from the palette Click OK 8 Arectangle now appears representing the position of the pin Note that it starts at the left side of the symbol boundary If you want it to start at another side of the symbol boundary click ai Each time y
126. ed using ST Realizer B1 1 Application Overview This application manages a coded lock for a door A secret code is loaded into the lock system to allow the door to be unlocked only if that code is entered When loaded the secret code is stored in the non volatile memory EEPROM embedded in the ST6 or ST7 MCU This ensures that the data is retained even after a voltage cut off and insures security The application includes the following features e Secret code recording 3 digits e Recognition of entered access codes e Door lock control All the described functions of the system are managed in the final application under software control by the MCU Only the core of the application the secret code storage in EEPROM and the code recognition are described as a generic base for various applications Any type of user interface such as keyboard IR or RF could be used while the output signal can activate any kind of circuit For this example it is assumed that the user interface provides the following 4 inputs e Digit reception flag e Digit value 0 9 e Change secret code Lock the door The digits used for the code are received serially and are announced by the activation of a flag 211 248 4 www BDTIC com ST Coded Lock Application Appendix B Sample Applications B1 2 Functional Description Figure B1 below shows the application block diagram Note that the application is restricted to its core operation se
127. eme Subscheme Input signal from MCU pin port or peripheral Output signal to MCU pin or port Additional inputs from MCU pins ports or peripherals are possible Subscheme d 0 248 www BDTIC com ST Symbols Chapter 2 2 4 Symbols Using ST Realizer you design your application by placing symbols and wiring them together in schemes Each symbol may represent e An operation such as converting a physical analog value to a binary value e A piece of information related to the behavior of the application such as a state transition e A system state or condition e An action reflecting a change in the system state or caused by an event such as the occurrence of a timer interrupt Each symbol is associated with an ST6 or ST7 assembler code macro The wires represent the flow of data and are linked to variables and constants You can modify certain attributes of symbols and wires allowing you to customize them for your specific application For example by attaching an attribute of type UINT unsigned integer to a wire you define its value capacity to that of an unsigned integer 0 to 65536 For more details on attributes see Appendix A Variables and Attributes on page 203 2 4 1 State Machine Symbols Within your root scheme you may create a state machine which logically guides the program between different functional states of your application Say for example you had an application which perf
128. eme input change in the left window pane and Subscheme Input click the right arrow or double click the line Change Event Click OK 157 95 248 www BDTIC com ST Subschemes Execution Conditions and Events Chapter 7 Configuring a Periodic Event Note v Tip aa a Configuring a Timed Interrupt Event Configuring an NMI Interrupt Event ST6 devices only 96 248 Select Periodic in the left window pane and click the right arrow or double click the line A new dialog box opens for you to specify the frequency of the code execution for example specify 0 01 s if you want the code to be executed once every one hundredth of a second Click OK Click OK in the events dialog box Lancel Hemember that the time specified in a periodic event should be a multiple of the base clock timer tick value To change the value of a timer tick refer to page 131 Don t use periodic events for time sensitive subschemes where high precision is required Because the execution of the code is not interrupt driven in some instances the precision of the timing may be unacceptable Periodic events are best used to measure long periods of time where precision is less important Select Timed Interrupt in the left window pane and click the right arrow or double click the line A new dialog box opens for you to specify the time interval between two consecutive timer interrupts Click OK Click OK in the eve
129. en a scheme you ve used recently click its name at the bottom of the File LC MM cc Ee Ex um menu a 6 4 Saving Schemes To save the scheme that is currently active click H To save all the schemes that are open click Save allin the File menu To save a scheme under a new name 1 Click Save as in the File menu 2 Specify the new name of the scheme file sch extension 3 Click Save Note You can also set up ST Realizer to save your work automatically at a specified interval See Automatically Saving Your Work and Setting Screen Preference on page 194 for further details ON S Tip Subschemes will not be appear in the Project Viewer until you have performed an Analyse of the project A saved sch scheme file will be placed in the root d directory of the project but you will have to open it manually if does not appear i in the Project Viewer kyy 69 248 www BDTIC com ST Saving Schemes 70 248 www BDTIC com ST Chapter 6 Chapter 7 Schemes and their Components 7 BUILDING SCHEMES 7 1 Schemes and their Components A scheme is a collection of symbols connected to one another via lines named wires Each symbol has input and output pins that allow them to be wired to other symbols The symbols pins and wires in a scheme can be assigned attributes to precisely define their configuration and behavior ochemes are at the heart of ST Realizer By designing schemes you are in fact creating yo
130. ents those that are hardware independent meaning that they are available on all microcontrollers and those that are hardware dependent meaning that they make use of peripherals that are only available on certain microcontrollers Events that are independent of the target hardware device e Upon subscheme input change Code contained in a subscheme is executed each time one of the input signals coming from the parent scheme has changed This is similar to an Eise switch in standard programming algorithms The diagram at right shows a schematic flow diagram of an application with a subscheme having this type of event either as an execution condition or an event symbol 86 248 Reset entry point Initialization Subscheme Code Chapter 7 Normal Code Execution Subscheme input s changed Normal Code Execution www BDTIC com ST Chapter 7 Periodic Events A periodic event or execution condition acts at the level of the main loop Inclusion of a periodic event causes a counter based on the number of base clock timer ticks elapsed in previous main loop cycles to measure a certain period of time Therefore the period specified must always be a whole number multiple of the timer tick s value Once the period of time specified has elapsed the subscheme or periodic code part will be executed and the periodic counter will be reset A periodic event or execution condition is
131. ents about oS T Realizer lt root_folder gt Lib which contains the main symbol library and a number of other libraries root folder TargetHW which contains the definition files for the ST6 and ST7 microcontrollers supported by ST Realizer II 2 248 d www BDTIC com ST Chapter 2 2 INTRODUCTION AND CONCEPTS The founding idea behind ST Realizer was to create an accessible and user friendly software package allowing people at various levels of programming expertise to efficiently design embedded applications for ST6 and ST7 microcontrollers ST Realizer is an application programming package that allows you to create applications ready to be loaded into ST6 and ST7 microcontrollers without having any knowledge of assembler code To do this you use symbols that represent programming functions to create flow diagrams that perform your application functions While the user is assumed to have a good understanding of the microcontroller for which he or she wishes to create an application care has been taken to create a sufficiently broad spectrum of symbols to cover all of your application design needs And should you require a symbol not included in ST Realizer s main library you can design your own using the Symbol Editor function All ST Realizer applications are destined for one of the ST6 or ST7 family of microcontrollers The scope of the application is necessarily limited by the resources available on the target device th
132. equent code is executed Event symbols are most usefully used when you wish to include several events that may control the similar portions of code However certain rules apply when placing more than one event symbol in a single subscheme refer to Section 7 4 5 on page 89 The diagram below shows a schematic example of how event symbols can be used to control how a subscheme is executed Reset entry point Initialization Normal Code Execution Subscheme Code Subscheme Symbol Normal Code Execution In the above example the subscheme code will be executed as follows e f Event 1 is triggered by the event s condition being fulfilled Symbol sequence A will be performed with out1 1 Symbol sequence B will be performed with out2 O Symbol sequence C will be performed unconditionally there are no event symbols connected to this code sequence e f Event 2 is triggered Symbol sequence A will be performed with out1 0 ky 9 248 www BDTIC com ST How ST Realizer Keeps Track of Time Chapter 2 Symbol sequence B will be performed with out2 1 Symbol sequence C will be performed unconditionally e If neither Event 1 nor Event 2 is triggered no part of the subscheme code will be performed Note Even though symbol sequence C is not directly connected to a event symbol by virtue of it being in a subscheme with that contains events it will not be performed unless one of the events is tri
133. equential symbols allow you to sequence inputs and outputs They are a means of sequencing signals in the main loop of the application without introducing an interrupt Micro Delay Fixed Symbol Delays the main loop for a fixed time This symbol is meant for short and time critical operations and does not use the base clock timer tick thereby leaving Timer 1 ST6 or Timer A ST7 free for other uses En type Boolean When En is true 1 the fixed delay will become active Out type Boolean The output is a copy of the En input Een value dme This output is used for linking the sequential symbols ValueTime The time entered in microseconds of the fixed delay wait Note When the fixed delay is started all normal execution process are halted Only the interrupts are still active The watchdog if applicable is not reloaded Ay 105 248 www BDTIC com ST Sequential Symbols Chapter 8 Micro Delay Variable Symbol Delays the complete process for a user defined time This symbol is meant for short and time critical operations En type Boolean When true the fixed delay will become active Time type Word Defines the time to wait The Time input together with the TimeBase will determine the time microdelv to wait Out type Boolean A copy of the En input This output is used for linking the sequential symbols TimeBase The timebase entered in microseconds This time base is used a the timebase for the Tim
134. erature measurements are performed 5 times one polling loop after the other The five temperature values are then averaged to smooth the effect of temporary variations 36 248 d www BDTIC com ST Chapter 3 Tutorial Symbol Functional Category Name Values Values 0 E Symbol add2 None xX Vi Description This is a two input adder with type inheritance OUT IN1 IN2 For details on type inheritance see Type Inheritance on page 204 Mathematical Symbol div Description This is a 2 input divider symbol with type inheritance Q A B R A modulo B Type for A and B can be any type from UBYTE through LONG Type for Q and R is the largest of A or B types For details on type inheritance see Type Inheritance on page 204 Hierarchical sheet Symbol portout Label identifier used to make the connection between this subscheme and the parent scheme Must be the name of the output pin in the sss 7_ 1 symbol that can be found in the main scheme diagram In the example LABEL Out Description This symbol is used to connect an output pin of a subscheme symbol sssx_y from the parent scheme with the corresponding subscheme This symbol is homologous to the portin symbol which describes an input pin in a subscheme symbol 37 248 4 www BDTIC com ST Tutorial Chapter 3 3 3 10 2 Leaving a Subscheme If you are in a subscheme you can return to the root scheme by either of these acti
135. es 5 100 5000 150 DU 00 00 DUU DU 00 00 0005 100 00 00 07 5000 150 00 01 00 0000 600000 75 You can store decimal binary hexadecimal or octal information in Time Table Adjusters To attach a Time Table Adjuster to a pin or wire 1 Select the pin or wire to which you want to connect the adjuster by clicking on it 2 Click AT 3 Click where you want the adjuster to appear The adjuster is now placed in your SEK scheme and connected to the pin or wire Wen you selected In the example at right we MOSI see that the time table adjuster has been CMP2 A connected to the pin called Setpoint ICAP2 A which is also the name of the input EMP1 A symbol Note that the time table adjuster HeatingisON shows the name of the pin whose input the adjuster controls Temperature IC ob P Setpoint UCI B ICAP P CLEOUT 146 248 ky www BDTIC com ST Chapter 10 Setting Adjusting and Viewing Input Values 4 To set the table of values to be input to the pin or wire e Double click the time table adjuster Increase size Of E Decrease size e Right click the time table adjuster and select Properties in the SEN popup menu E The Change time table adjuster dialog box opens showing a table with one row and two columns the first for the time and the second for the input value From this dialog box you can either import them from an ASCII file or enter the table values directly see Table 6 for instructio
136. es and the RAM size to 128 bytes The Max ROM and Max RAM values determine the maximum size of the ST Realizer application The I O pins determine the number of input and output symbols that can be used in the ST Realizer application The EEPROM values determine how much EEPROM can be used by the symbols from the MAINPER LIB symbol library This symbol library contains symbols that use the EEPROM space to store their values 157 59 248 www BDTIC com ST Choosing a Target Microcontroller Chapter 5 5 2 Choosing a Target Microcontroller 5 2 1 Selecting the Target Microcontroller for a New Project When you create a new project just after creating your project rpf file you will be prompted to specify the target hardware for your project 1 Click the Target Hardware folder in the Select Target Hardware window A browsable list of target hardware devices will appear in the window shown below E Select target hardware x Curent ST f2212G2 Two 16 Bit Timers SK RUM 256 Bytes HAM E CN Target hardware devices 4 STE 8 Bit MCU Ej amp y ST 8 Bit MCU H E ST 7210 16 Bit Timer SPI ST f212e Two 15 Bit Timers SFI SEI pof 5T72212G2 Two T Bit Timers OK ROM 256 Bytes ARAM gt ST 221381 16 Bit Timer AK ROM 256 Bytes RAM ST 225 A D Converter Two 15 Bit Timers SFI LA ST YS s A D Converter Two 15 Bit Timers SFI SCI ST 233 A D Converter Two 15 Bit Timers SPI GU EEPROM Cancel 2 Find the t
137. es from the popup menu 11 4 2 3 Adding graphical detail to symbols A Change properties dialog box like the one shown below will open fee Change properties X Input output Output sl Type Label 5 Number 3 Color Em Edit Cancel In our example we will change the pin 4 S data type to MAX1 this option takes the data type of input pin 1 The data types available in the cascading menu are the most widely used but they not the only data types available For a complete list of data types refer to Appendix A Variables and Attributes on page 203 Perform the same operation to the NS pin pin 4 setting the data type to Max1 as well When finished your symbol should now look as pictured at right You can add simple graphics to symbols to help identify them Basic drawing functions are available from the popup menu or from the symbol editor toolbar refer to page 177 To draw an ellipse or a circle 1 Click i on the symbol editor toolbar or select New 2Arc in the popup menu 2 Click once where you want the centre of the ellipse to be A Move the cursor in any direction An ellipse shape appears that is based on the relationship between where you clicked and the current cursor position 178 248 Kr www BDTIC com ST Chapter 11 Defining a New User Defined Symbol ly Tip Note that the position of your cursor in x and y coordinates appears in the ee ON c iaa status bar at the b
138. essenseceeeeeeeeceeessessaneas 1 Software ooo eee ceccccceecccceceessneeeeeeesssseaeeeeees 1 Reusing adjuster values 139 160 probe values 139 160 p m 65 Root scheme introduction To 7 YOOL e Weed RR 2 See 63 RTICK variable Variables Ka 64 Running the simulation 158 S Saving DIOISGGIS aocssnimqumec meet 57 SGC TINGS eege p epus s DU docu 69 simulation environment file 142 slang Me 203 kyy www BDTIC com ST Scheduled event 87 SCHEME attribute 208 OGlIelTiGS uu ci rui cci sauce eekleg 7 analysing nssssnnnnsnnnnnnnnnnnnnsennnnneennni 129 eli rilgre RR Im 67 creating subschemes 68 introduction to 7 Opening 69 placing symbols sssss 72 placing Dlesm 84 PIE EN RR 83 root scheme 7 SAWING WE 69 simulating sesseseseee 139 Subschemes s osssnnsennissnesernnnnerrnssnreen 7 viewing options seeeeeeeeee 82 WOFKIN ln iion iei onn inns 82 Screen Preferences ceeeieeineeneeeieeennas 194 Setting numeric adjuster opttons 145 numeric adjuster values 22 2 144 square wave adjuster values 150 time table adjuster values 146 up PINTO E 83 Simulated signals monitor
139. eturn from Interrupt TIMER IRQ In other words a timed interrupt is triggered directly from the hardware clock for example Timer 1 or Timer A measuring out the timer ticks rather from the evaluation of main loop variables such as rtick which count the number of timer ticks elapsed in the previous main loop cycle Therefore no matter what the main loop is doing when the specified time has elapsed the main loop is interrupted and the timed interrupt code or subscheme is performed immediately 88 248 ky www BDTIC com ST Chapter 7 Subschemes Execution Conditions and Events Event that are hardware dependent are e Peripheral interrupts These are interrupts that occur when a specified peripheral has signalled the application in some way An example would be an SCI peripheral which uses an RS232 protocol transmission If you specify an SCI interrupt the interrupt would occur independent of the main loop when the end of the transmission has occurred 7 4 4 Execution Conditions Execution conditions can be applied to subschemes such that the subscheme is only executed when certain conditions are met such as a timed interrupt or upon a subscheme input change Subschemes with execution conditions allow you to perform tasks in addition to the main loop if the execution condition is met In this way subschemes with execution conditions are analogous to subroutine operations While a root scheme runs in a co
140. f the chosen device is displayed Select the ST microcontroller ST72212G2 by clicking once on it 3 Click OK to confirm You may also double click the line showing the device 4 Once you have selected your target hardware the Project window will open as shown below i Project heating Ie heating sch Libraries E 4 Target hardware E ST 221282 Two 16 Bit Timers OK ROM 255 Bytes RAM This window will list all of the components of your project schemes libraries and target hardware Notice that ST Realizer has already created an application scheme file called heating sch by default Next we ll learn how to design the application scheme ky 15 248 www BDTIC com ST Tutorial 3 1 3 Opening the Main Scheme Chapter 3 Now that you have created your project and specified the target microcontroller you must draw the main or root scheme This is the sheet on which you design the main part of your application The main scheme file has already been created by ST Realizer and is called heating sch by default To open the main scheme 2 ST Realizer Beta heating File Edit Search View Project Options Tools Window Help Dw led numeroso mss gts EMI C Program Files ST Realizer E xamples Heating heating sch Root 1320 0000 ST6265C 4K ROM 128 bytes RAM 3 1 4 The Worksheet Toolbar In the Project window shown on page 15 double click neating sch located under the Schematics folde
141. f the main loop Macros that are linked to ST Realizer symbols must have headings that are in a specific format To link a macro that s executed at initialization e n the ICODE macro name field enter i lt macroname gt where macroname is the name of the macro For our example the ICODE macro name is iStepper To link a macro that s executed as part of the main loop e n the CODE macro name field enter macroname where macroname is the name of the macro For our example the CODE macro name is Stepper To link a macro that s executed at the end of the main loop e n the OCODE macro name field enter o macroname where macroname is the name of the macro For our example we do not wish to generate an OCODE macro Note Recall that names in ST Realizer are case sensitive Click Next to continue ky 175 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 10 The Generate the symbol dialog box opens Click Finish to confirm bes Generate the symbol E Creating user defined symbol Stepper with 2 input pins with 2 output pins Click Finish to generate the symboal Back Finish The new symbol will appear in the scheme similarly to our example symbol shown at left We can see our two 2 input pins and two output pins The next step is to edit the symbol in order to give the pins names that are more descriptive to change the pin data types if necessary and to add some gra
142. g Size 15 m m i sl Alignment Value Horizontal Right e Vertical Batom F Direction Normal sl Visibility IT Tag jv Value Cancel Under Visibility uncheck the Value box Click OK The pin number will disappear from the symbol In a similar manner make all of the pin numbers Data or disappear from the symbol Our stepper symbol will now wn e appear as at right lock 8 Step Value 1 vlr Tip You can make attributes invisible as we just did for the pin numbers but they are still present in the symbol To view invisible attributes select View Invisible attributes from the main menu or from the popup menu d Note You may also change existing symbol attributes directly from the ST Realizer worksheet where your scheme has been loaded See Changing a Symbol s Attributes on page 75 Recall from page 171 that there are four steps to complete the creation of a new user defined symbol We have now completed the first two steps in the creation of our Stepper symbol e The definition of the graphic aspect of the symbol including assigning the required number of input and output pins naming these pins and assigning pin data types and attributes e Editing the new symbol to further refine its appearance 186 248 d www BDTIC com ST Chapter 11 Defining a New User Defined Symbol The next step is to create a macro header for the symbol and then write in assembler th
143. g on the identified key a direct signal activation can be achieved or a selective jump in the program flow can be performed B2 2 The Keyboard The serial resistors are selected in order to give an equal distribution of voltage between Vdd No key pressed and Vss Last key pressed for each switch combination in order to give the best noise margin between keys For n keys the resistor values should be selected so that the voltage for the second key from top is Vdd n for the 3rd 2Vdd n for the 4th 3Vdd n and for the nth n 1 Vdd n The maximum number of keys is limited by the precision of the resistors that provide a voltage value for each key pressed within a margin of error either side of the theoretical value For a 10 key system the values in Ohms given in Table B2 are used for the resistor network Taking into account 2 resistors the voltage values and conversion results given in Table B3 can be obtained Vmin is obtained when the serial resistors are at their minimum value and the pull up resistor Rp is at its maximum value Vmax is obtained when the serial resistors are at their maximum value while the pull up resistor Rp is at its minimum value Table B2 Used Resistors m m m m m s m w m m Table B3 Voltage at the ADC input and 8 bit conversion result 5V supply Keyo oo jeo on 216 248 d www BDTIC com ST Appendix B Sample Applications Analog Multiple Key Decoder The condition no key presse
144. ggered The golden rule is that you cannot mix events with root scheme symbols meaning those symbols that are performed as part of the main loop or normal code When you place symbols in a subscheme which contains one or more events either in the form of event symbols or an execution condition those symbols cannot be considered as part of the root scheme 2 How ST Realizer Keeps Track of Time ST Realizer ll differs from its predecessors because the final code that it produces will only contain timer initialization code if there are time related symbols or events in the application However if your application includes either time related symbols or events ST Realizer will generate something called a base clock timer tick in the following manner e Every ST6 and ST7 microcontroller has a timer called Timer 1 ST6 or Timer A ST7 which if there are either time related symbols or events in the application is used as the base clock to measure out units of time called timer ticks You can choose to set the value of the timer tick this is described on page 131 e All time related symbols and events are based on timer ticks This means that one timer tick is the smallest increment of time that can be distinguished e Timer ticks may be used to control the processing time of a main loop cycle The time required to perform one main loop cycle is called the Processing Cycle Time By default the processing cycle time is variable Howeve
145. gnal It uses the interrupt sensitive inputs of an ST6260 microcontroller It will filter the measured frequency so that a readable value is obtained It converts these values into viewable data and then drives a 4 digit 7 segment LED display Figure B17 shows the basic block diagram symbols that represent the subschemes The next diagrams show the 4 sub schemes in detail Parts of these sub schemes are used in the first part of this application note Please note that they are all made using ST Realizer Il In Section B4 2 the Realizer Report File FASTCNT RPF is shown It informs the designer what resources are used in which way In addition the code generated by Realizer is shown with some comments added for your convenience Figure B17 Overview of the Fast Counter Application Main scheme he overvievy Fiker Limi In O Input Sch The o creme shown in Figure B18 calculates the moving average over 4 samples every 3 seconds Figure B18 Fast Counter Input section C lacking value inia D t Ay 225 248 www BDTIC com ST Fast Counter Application Appendix B Sample Applications Figure B19 Fast Counter Filter and Limit section Processing section Filter and limit the measured value Execution conditions Periodic 3 Sec The subscheme shown in Figure B19 counts under interrupt The counter value is latched every second The edge detection symbol is needed to de assert the Clr input during the high time of the o
146. gs dialog box in the Include file field ensure that the library that you saved your symbol to appears in the list of files e root folder gt Lib st72lib mac for ST6 or root folder gt Lib st72lib inc for ST7 if you saved your symbol to a main library e root folder gt Lib filename mac for ST6 or root folder gt Lib filename inc for ST7 where filename is the name of the new symbol library you created above 192 248 d www BDTIC com ST Chapter 12 12 CUSTOMIZING ST REALIZER A number of ST Realizer features can be customized to suit your way of working These include e Automatic work saving e Screen preferences e Worksheet layout preferences e Printing options e Symbol layout preferences e Wire drawing options e Attribute display preferences e Toolbar contents To customize these features proceed as follows 1 Select Options gt Environment from the main menu bar The Environment Options dialog box opens showing a number of tabs that direct you to the following daughter dialog boxes e Advanced e Attribute e Page e Print e Symbol e Toolbar e Wiring ky 193 248 www BDTIC com ST Automatically Saving Your Work and Setting Screen Preference Chapter 12 12 1 Automatically Saving Your Work and Setting Screen Preference ST Realizer can back up and save your work automatically This option can be chosen in the daughter dialog box accessed by clicking the Advanced tab 1 W Make backup on sav
147. h any drawing package before you can modify an object or a group of objects you must first select them To select items you must be in selection mode the cursor is in the form of an arrow This is the default mode However if you need to activate 73 248 www BDTIC com ST Symbols Chapter 7 selection mode e Click Kx An object is selected when it is outlined by a red box You may select one or more objects as follows e Select one object by clicking it Take care not to click a symbol attribute as this will open the dialog box for the attribute e Select a group of objects by dragging a box around them Put the cursor at one corner of the area you wish to select Keeping the left mouse button pressed move the cursor diagonally across the area you want to select until the whole area is outlined by a red box When you release the mouse you will see that each individual object found in the area you outlined has been selected e Select multiple objects by pressing SHIFT while simultaneously clicking each object one by one Each item you select is surrounded by a red box indicating that it is selected To select all segments of a connected wire double click one segment of the wire Copying a Symbol You can copy a symbol in two ways 1 Right click the symbol to be copied A popup menu will open Select Copy shape Drag and drop the ghost box of the symbol Rotate V Mirror Copy shape where you want to
148. hange the value of the Constant symbols Or m L you a may also click the Value entry in the popup menu that is specific to this type of symbol The same Edit the value dialog box opens Changing the You may also change the manner in which an Symbol Attribute attribute is displayed on a symbol Rotate Preference Settings Right click the attribute field in the Tag symbol of interest Value A popup menu opens Paint of Effect e Select Properties Properties 76 248 ky www BDTIC com ST Chapter 7 Mirroring a Symbol or Group of Symbols Rotating a Symbol or Group of Symbols 157 Symbols The following dialog box opens bes Change properties ES Color edit Tag SIZE AU m m Comment Alignment Value Horizontal Left Purnps peedControl Vertical Center gt b 4 F Direction Noma e Visibility Tag Iv Value Cancel e Change the preference settings to the desired values Select the appropriate Alignment and Direction settings in the corresponding drop down lists To change the color of the text click Edit and select the new color from the displayed palette To have tag name and value displayed on the scheme check the appropriate box e Click OK to confirm the changes you have made in the preference settings Select the symbol s then click y S 1I You may also use the Mirror option in the popup menu associated with the symbo
149. haracteristics of the PC you are running ST Analyser on For this reason in our application example see Section 3 3 10 on page 35 we specified a periodic sampling every 0 01 seconds so that our simulation would not be too slow If you find that the simulation takes too long to respond to changes in input values you may need to change the periodic sampling time d 93 248 www BDTIC com ST Tutorial 54 248 www BDTIC com ST Chapter 3 Chapter 4 Project Files 4 CREATING OPENING AND SAVING PROJECTS 4 1 Project Files Each application you design is stored in a project It is recommended that each project have its own folder ST Realizer stores all schemes and subschemes associated with the application in the project folder Once your have created and specified your project folder ST Realizer will create a project rpf file that contains project specific path settings the projects scheme names target hardware information and compiler settings The project rpf file is in ASCII text format 4 2 Creating a New Project To create a new project 1 Click Project gt New in the cascading menu The Create a New File dialog box opens If you haven t done so already you may create a new folder for your project by clicking on the new folder icon shown Create a new file kd ES 3 Heating Ss el B Save In Click here to create a new folder Click here to move up one folder level Type the name of your new
150. hat connect to condition symbols in the state machine that have the same name For example when the bit value 1 is received from the B gt A output of the comparator it signals the Start condition by outputting the value 1 to the state machine 3 3 2 Wires Occasionally you must attach data type attributes to wires to control the outputs For example you must attach attribute TYPE SINT to the wire connected to the output pin of the sub2 symbol in order to be able to evaluate both positive and negative temperature differentials To attach a type to a wire proceed as follows 1 Click the wire with the left mouse button 2 Click the right mouse button imi Edit the value A list box displays with 3 attributes Type Init Label 3 Click Type The Edit the value dialog box opens with a scrolling Uk Cancel list of data types to choose from ok EE SZ 31 248 www BDTIC com ST Tutorial Chapter 3 4 Select the type SINT and click OK SINT stands for Signed Integer 3 3 8 Internal Input Conditions There are two internal input conditions that must be met e Enough time must pass to allow temperature values to be acquired and filtered before the temperature differential is measured When this has happened the SetupTime condition is met e Once the HeatingOn state is active the pump must be enabled prior to being put into operation by activating the SetPump condition The diagram is shown below Interna
151. he event symbol in the appropriate location in the subscheme e You will be prompted to provide values for the attributes Comment and Name The Name attribute will identify the event in the subscheme In the example shown below the value of the Name attribute is My Event e Wire the event symbol to the rest of the subscheme diagram 94 248 www BDTIC com ST Chapter 7 Subschemes Execution Conditions and Events e Right click the symbol area A popup menu opens Rotate i e Select Connect Mirror The Events dialog box for the current Copy shape target microcontroller opens ST72212G2 in the example It shows the list of events that can occur during the main loop execution and cause a specific action to be performed namely the execution of the code in the subscheme that follows the event symbol This list depends on the target device be ST 7221262 Events Ka Connect event to Mu Event Sort by event Attributes Edit Available events Connected events Elter sch Timed interrupt 0 01 Sec My Event Upon sub scheme input ch Upon sub scheme input change Penodic Timed interrupt TimerB Capture 1 interrupt Timer Compare 1 interrupt TimerB Capture 2 interrupt Timer Compare 2 interrupt Timer Overflow interrupt Properties UK Cancel In the example ST72212G2 the event Upon subscheme input change has been associated with the event My Event Configuring a oelect Upon subsch
152. he new target hardware device desired Click once to select it Analyse F11 Frint fee Select target hardware x Curent ST 72212532 Two 16 Bit Timers SK ROM 256 Bytes HAM CN Target hardware devices HL ST 210 16 Bit Timer SPI iie J 5T 212x Two 15 Bit Timers SPI SCI Bech SES Ser T Rit Timer aK ROM z Te Gan J 517225 A D Converter Two 16 Bit Timers SPI I2C 5772312 A D Converter Two 16 Bit Timers SPI SCI ST 7233s A D Converter Two 16 Bit Timers SPI SCI EEPROM Cancel 4 Click OK to confirm You may also double click the line showing the microcontroller Note that the name of the current microcontroller is displayed on top of the dialog box 1 If you add a new target hardware device to a pre existing project you may have to update the hardware connections by reconnecting I O symbols to the appropriate hardware ports and peripherals For more information refer to Connecting Input Output Symbols to Microcontroller Pins Ports and Peripherals on page 80 ky 61 248 www BDTIC com ST Hardware Configuration Chapter 5 5 3 Hardware Configuration 5 3 3 Accessing Hardware Settings Dialog Boxes Follow these steps 1 Click Hardware Settings on the Project menu The Hardware Settings dialog box for the specified target microcontroller opens This dialog box shows a number of tabs that direct you to the following hardware configuration daughter dialog boxes e General tab for configu
153. heme where the error occurs will appear in the scheme window Error 609 amp state input Start is not connected to a net An input pin must always be connected to a net Warning 2 Mat all sumbals are analysed total symbols 44 analysed symbols 40 Message ST Analyser Beta results of Mon Apr 12 13 38 40 1338 1 Warning and 2 errors 3 Correct the errors and re compile the application by clicking on Analyse under the Project menu SZ 45 248 www BDTIC com ST Tutorial Chapter 3 3 4 16 Viewing the Analyse and Compile Report Once you have analysed your scheme and compiled your View Project Options Tools program code you can view the report generated by ST Realizer pum during the analysis and compilation process This report provides you with useful information such as the input and output inei merete connections you made and gives an overview of how much Refresh view Ctrl F memory is used by the application Invisible attributes To see the report on the View menu click Report A portion of our application report is shown below ST72212G2 Realizing Unit V4 00 c 1990 98 Actum Solutions Report file of project C Program Files ST Realizer Examples Heating heating rpf Scheme Version 1 00 Report timestamp Wed Apr 14 13 14 40 1999 Analyze results No errors C Program Files ST Realizer Examples Heating heating sch Scheme C Program Files ST Realizer Examples Heating Filter sch Event Timed interrupt 0 01
154. hen you run the simulator the adjusters you placed generate the input values your application performs its processing and where appropriate the results are displayed by the probes you placed While the simulator is running the simulation time is displayed in the status bar at the bottom of the screen ky 157 248 www BDTIC com ST Running the Simulator Chapter 10 10 5 11 Starting Stopping the Simulation You can initialize start or stop the simulation process and proceed to the recording or displaying of information about this process If you have already run the simulator and you want to initialize it to its original state Click d Or In the Simulate menu mn IE jns wvindtc To initialize the simulator click Initialize blu pas Initialise Ctrl F 11 Start F11 Ealse FI Record Ctrl F 1 2 Information To run the simulator Click Or In the Simulate menu click Start To temporarily stop your Click d Or simulation In the Simulate menu click Pause 1 Open a log file see Recording and Reusing Adjuster and Probe Values on page 160 2 Under the Simulate menu click Record or To record simulation information click e 3 The red circle changes to a red square To display information about the Under the Simulate menu click Information current simulation session 10 5 12 Setting Run Options Before you run your simulation you should consider which run options you want to set
155. hine probes cannot be connected to pins wires or any symbol other than stateinit 2 Click ps 3 Click where you want the probe to appear The probe is now placed in the scheme and connected to the state machine you selected In the example shown at right the state machine Cw gt probe is connected to a stateinit symbol in a state R machine diagram The symbol name is called Init hence the name of the probe is also Init The value of the probe corresponds to the value of the state which is currently active in our example the active state is called HeatingOFF HeatingOFF To enable disable the state history list and set its length 1 Double click the probe or right click the probe TENEROS and select Properties from the popup menu shown at right Bees errs Properties 156 248 Kr www BDTIC com ST Chapter 10 Selecting Adjusters and Probes The Change state machine probe dialog box opens fee Change state machine probe Show a history list of E items Cancel To change the length of the history list enter a new length in the Show a history list of field 2 Click OK 10 4 Selecting Adjusters and Probes Instead of using the buttons in the tool bar you may select any adjuster or probe via the Object menu Just click Adjuster or Probe and select the appropriate object Dptions indo Numeric SINE Wave SQUEE WAWE Time table 10 5 Running the Simulator W
156. iables and Attributes on page 203 For our example we will assign the following properties e For input pin 1 label Data and type WORD Input e For input pin 2 label Clock and type BIT Clock Input Click Next 8 A dialog box opens for you to specify the im Select the output pin properties x output pin data types Choose data types for Pin 3 label 5 Type etr sl Output sl each of the output pins Pin 4 label NS Type BIT pro In our example the data type we wish to assign Max1 doesn t appear in the pull down menu which only contains the most common data types For the time being assign any data type for example NNNM e For output pin 3 lt Back Next gt Cancel label S and type BIT Output e For output pin 4 label NS and type BIT Output We will modify the data types on page 178 once the symbol has been created Click Next 174 248 ky www BDTIC com ST Chapter 11 Defining a New User Defined Symbol 9 A new dialog box opens to prompt you for the code properties of the new symbol bes Select the code properties ICODE macro name JiStepper LODE macro name Stepper OCODE macro name Back Hest gt Cancel Use this dialog box to link your symbol to the macro s it represents You can link three macros to a symbol each with a different execution time e At initialization e As part of the main loop e At the end o
157. ication If any messages are generated during the analysis and compile you can view them and trace them back to their origin ST Realizer includes hardware specific characteristics which you must configure prior to analyzing and compiling your code They cover general hardware memory and peripheral information See Section 5 3 on page 62 for further details 9 2 Changing the Compile Options Before you analyse and compile schemes using ST Realizer you can set the following compilation options Whether or not you want to generate source code Whether or not you want to invoke the assembler e Whether or not you want to generate final hex code e Whether or not you want to include project data this can be useful for version control Whether or not you want to generate code that uses a constant sampling time you must ky 129 248 www BDTIC com ST Changing the Compile Options Chapter 9 choose this option if your scheme includes the mathematical symbols integral and differential If you choose this option the duration of the main loop is constant e The frequency of the base clock tick for the timer symbols By default this is 0 01 seconds 10 milliseconds To generate in a single run executable code that can be embedded in an ST device you must use the default settings Each ST device needs its own assembler and target compiler to create the final executable file These elements are standard components of th
158. ications Hardware connections Fast Counter Application Symbolic name H W name Digit O lsd PB O Digit 4 PB 1 Digit 2 PB 6 Digit 3 msd PB 7 a segment PA 0 b segment PA 1 c segment EA d segment PA 3 e segment PCsZ f segment DC A g segment PO Variable overview Description 20 mA sink open 20 mA sink open 20 mA sink open 20 mA sink open 5 mA sink open mA sink open mA sink open mA sink open mA sink open mA sink open mA sink open CH XE U UO CH dg drain drain drain drain drain drain drain drain drain drain drain output output output output output output output OHUDHE output output output Total used Total used Total used Total used Total used Total used Total used bits events unsigned bytes Signed bytes unsigned integers Signed integers longs Memory overview Total used Total used RAM ROM 73 byte OQ00H gt 03FH 085H gt 08CH 1714 byte 0080H gt 0732H of UFODE Note The pins that are not connected are defined as digital input with pull up The timer pin is configured as an output 4 www BDTIC com ST 229 248 Fast Counter Application Appendix B Sample Applications B4 3 Generated Code Code generated for the sample application discussed in this section ST Realizer Beta 3 V4 00 generated ST6260 Code Hide Scheme Version Date Used variables Used functions VERO USTD62607 ROMSIZE 4 LAE ON LIST 0 C Program Fi
159. ing 151 WIG WING EMT 151 Simulating your application 000000000 139 Simulation Te UE 142 displaying information aaeeaaaeeana 158 environment file Cl CATING EEPE 139 OPOMIN EE 141 SAVINO ME 142 initialising eeeseeeeeeeee 158 input values nnnnnnnnsnnnnnannsennnnnnennnane 142 0 0 0 lt gt 151 recording eccsecceccsssteccesssssaeeeeessnaeeees 158 recording and reusing adjuster and probe values 160 recording information 158 PUN ele lee acies use Spes tuse dau bassa MEE 158 running eeeseseeeeeeneennnnnns 158 starting and stopping 158 57 Sine wave adjusters ssnaeenaenaaeeeaeeeea 148 sig re 203 Software requirements ssssse 1 Specifying the Target Hardware Device 59 Square wave adjusters 150 sssp q Symbol 92 Jp 59 ST6 users NOO TP cp 59 Ip 59 SEET 129 error MESSAQES osonnononnoonnieeaoeeenneeaaen 129 State history Iert 157 State machine 156 State machine probes AULA MT To RE E 156 Steps in application development 11 ST Microelectronics internet address 3 Stopping the simulation 158 ST Realizer application structures 4 Subroutnes 64 ST Simulator eeeeene 139 PCT TAG NO CR 157 Subs
160. initions that pertain to an application are stored in project files The following diagram shows the ST Realizer application development process Application Idea Compile the code and generate the report 2 ER y ST Simulator Load the code into anST microcontroller 12 248 d www BDTIC com ST Chapter 3 Tutorial 3 TUTORIAL The following tutorial is designed to help you fully understand both the principles behind creating applications using ST Realizer and how to create applications using ST Realizer In this tutorial you ll learn how to create an ST microcontroller application The application you will create manages a heating control system The ambient temperature is periodically measured filtered and compared with a preset value When the measured temperature is lower than the control value the heating system is started while the pump speed is adjusted proportionally to the temperature differential A pilot LED lights up to show that the heating is on When the measured temperature exceeds the control value the heating system is stopped This tutorial application runs in stand alone mode using an ST72212G2 microcontroller However note that the same application could be applied equally to an ST6 microcontroller such as the ST6265 with little modification The goal of this tutorial is to demonstrate in a general manner how to use ST Realize
161. input type I type carefully as some types use more of the microcontroller s available RAM than others Index table Symbol The input value is used as an index in the table The table is stored as an ASCII file defined by the TABLE attribute Each table begins with a default value that is used when the input value is out of range To create indextable or change a table double click the symbol type WORD Ql type Any type BIT LONG See also pitable persistent index table Lookup Table Symbol The input value is the search argument to find the output value The table is stored as an ASCII file defined by the TABLE attribute Each table begins with a default value that is used when the input value is out of range To create or change a table double click the symbol type WORD Ql type Any type BIT LONG lookuptable 124 248 d www BDTIC com ST Chapter 8 Power Management Ramtable Symbol Converts the input to a non linear output value found within the table The input is used as an index to address the constant value from the table You can ramtable change the table by clocking in the Data input at the volatile RAM position pointed to by the In input Data In type WORD BlockSizelnUnits size of the table Index table symbol for a table stored in persistent non volatile memory The input value is used as an index in the table You can change the table by clocking in the Data input at
162. ire SCK ISO hia 5i OCP A which is also the name of the input Sea ICAP2 A symbol Note that the numeric adjuster TEA shows the name of the pin whose input Heatingls ON the adjuster controls Temperature CAI B Set po int OCMP1 A DH IC oz B CLEOUT 4 Setthe value input to the pin or wire If the pin or wire input is analog you can change its value by either ETE a Clicking the displayed value in the Numeric Adjuster and entering a new value in the Change numeric value dialog box shown at right Clicking the or buttons on the Numeric Adjuster Numeric Adjuster Button Action Decreases the input value by the fast step increment value see below Increases the input value by the step increment Increases the input value by the fast step increment value If the pin or wire input is binary you can change its value by clicking the displayed value in the Numeric Adjuster icon The value toggles between 0 and 1 Decreases the input value by the step increment see below Tip You may also open the Change numeric value dialog NE E box to change the value of the numeric adjuster as aa shown above by right clicking the adjuster and Increase size selecting Value from the popup menu at right Decrease size Properties 144 248 A www BDTIC com ST Chapter 10 Setting Adjusting and Viewing Input Values If you select the Properties option in the popup menu a large
163. is is a word constant value symbol that inputs the value 10 o Description This is a multi purpose comparator It returns three bit values that depend on the three inputs B gt A 1 when B is greater than A B A C 1 when B is equal to A and C B lt C 1 when B is smaller than C There is one occurrence of this symbol It indicates the Start condition when this condition is met by outputting 1 This condition is met when the differential between the control temperature and the actual temperature is greater than 1 degree C It indicates the Stop condition output 1 on this pin when the differential between the control temperature and the actual temperature is negative d 30 248 www BDTIC com ST Chapter 3 Tutorial State machine Symbol stateout Name HeatingON name gt several additional occurrences of this symbol can be found in other main scheme diagrams Description This is an example of a state output symbol State output symbols are connected to state symbols by their names When the system switches to the specified state the processing that follow the state output symbol is performed In the example the processing simply consists of enabling the pump State machine Symbol statein There are two occurrences of name this symbol in this diagram Name Start Name Stop Another instance of this symbol can be found in the Internal Input Condition diagram Description These are state input symbols t
164. is range from requiring a delay period or a timed operation to providing an oscillating signal These symbols can be used in the main loop and will run off of the default microcontroller timer They do not interrupt the main loop Time related symbols use the timer tick to evaluate whether their conditions in exactly the same way that periodic events do refer to page 87 for a description of how periodic events evaluate time Delay Fixed Symbol An ON or OFF input bit is delayed a specified fixed time The TIME attribute format is gt T IT B dd hh mm ss xxx where dd is the number of days hh is the number of hours mm is the number of minutes ss is the number of seconds and xxx IS a fraction of a second and O types BIT Delay Fixed Off Symbol An OFF input bit is delayed a specified fixed time The TIME value format is gt OT B dd hhimmiss xxx where dd is the number of days hh is the number of hours mm is the number of minutes ss is the number of seconds and xxx IS a fraction of a second and O types BIT Delay Fixed On Symbol An ON input bit is delayed a specified fixed time The TIME value format is T 0 hee SUME Ww l dd is the number of days hh is the number of hours mm is the number of minutes ss is the number of seconds and xxx S a fraction of a second and O types BIT Delay Variable Symbol An ON or OFF input bit is delayed a variable time The Time input defines the number of cl
165. itable for our tutorial application To view or set the compile options 1 Onthe main menu click Options then Project The Code Generation dialog box in the Analyse Options window opens The default settings are suitable for our tutorial application Click OK VM Project Environment v Generate source code v Invoke assembler v Generate final hex code Iv Include project data in source code UK Cancel d 44 248 www BDTIC com ST Chapter 3 Tutorial 3 4 15 Executing the Analysis and Compile You may execute the ST Analyser from any of the New application windows Open On the Project menu simply click Analyse The ST Clase Analyser Status window will open and you will see the Analyse function checking your application step by step Hardware select Hardware settings ST Analyser Status Status Ma errors Creating Metlst Creating Cross Reference Analysing Generating Final Code Executing Target Compiler Creating Report File If there are errors 1 A dialog box will open showing the status of the compilation with the number of errors and warnings Click OK 2 Adescriptive list of the errors will be shown in the Analyzer messages window at the bottom of the scheme window You can view each error by either double clicking on its message in the window or by clicking the previous message or next message icons on the toolbar The area of the sc
166. ition Right Cade Last digit The management of the serial flow of the digits entered 0 9 is carried out using a received digits counter Figure B3 This stores the 1st 2nd and 3rd digits received in the case of a 3 digit code in associated memory locations When the 3rd digit is received the counter is reset In addition the reception flags of the 1st digit and 3rd digit are used in the state machine to initiate the code recognition and conclude the Secret code entry respectively Figure B3 Management of Digit Reception 1st Digit ol One digit received 2nd Digit 3rd Digit Last digit 4 213 248 www BDTIC com ST Coded Lock Application Appendix B Sample Applications B1 4 Secret Code Storage in the EEPROM ST Realizer enables the EEPROM non volatile memory to be managed as a standard bi stable component R S Latch D Latch Shift Register or Counter Each EEPROM location is identified by a specific D Latch component providing the non volatility feature This component provided within the ST Realizer library has the advantage of being multitype This means the same symbol can be used whatever the input type Bit Byte Word Integer or Signed variable The data input comes directly from the interface as the digit value in one byte The number of D Latches must be equal to the number of digits used for the secret code that is 3 There is a specific clock for each of the 3 D Latches controlled b
167. l right click the symbol To mirror a group of symbols select the group then ie click with the right mouse button L uplicate Rotate A popup menu displays Choose Mirror Mirror Select the symbol s you wish to rotate then click e The selected symbol will be rotated by 90 counterclockwise You may also use the Rotate option in the popup menu associated with 77 248 www BDTIC com ST Symbols Chapter 7 the symbol clicking the symbol with the right mouse button To rotate a group of symbols select the group then Copy click with the right mouse button Duplicate A popup menu displays Choose Rotate Rotate k Mirrar Viewing Symbol Select the symbol about which you want to view information Information Click 1 An information box opens When you have finished viewing the symbol information click OK 7 2 2 Wiring Symbols Together and Connecting Application Inputs Outputs Almost all symbols have at least one input and one output pin to which you connect wires the only exceptions are some subscheme symbols Wiring two symbols together creates the data flow between them By default the input pin s are to the left of the symbol and the output pin s to the right This section describes how to wire symbols together control the attributes of wires and how to connect external application inputs and outputs to the appropriate target microcontroller ports or peripherals Drawing Wires To wire
168. l Input Conditions HeatingON 9 SetPump Timer lo a1 zb SetupTime 0 05 Setup Timer Name Time related Symbol timf Name Timer Time 0 05 GI 1 o Comment Setup Timer Time Comment Description This is a simple timer The output signal is 1 until the time specified has elapsed and then the output becomes 0 This symbol allows enough time for the application to acquire and filter temperature values Symbol inv None This symbol also occurs later in the application Description This is a multi type bit wise inverter The 0 output from the timer is reverted to 1 triggering the Setup Time condition d 32 248 www BDTIC com ST Chapter 3 Tutorial 3 3 9 External Actions External actions generate output signals relating to the current state in the state machine The output signals are e The signal to switch on the Pilot LED A PWM signal generated by the Auto Reload Timer to control the speed of the pump 3 3 9 1 Pilot LED Monitoring As long as the state of the system is HeatingOFF the Pilot LED should be OFF The corresponding diagram is Switching the Pilot LED On HeatinglsON Pilot LED ON u Description This is a two value binary OR function symbol with type inheritance If either the HeatingOFF or Init states are active the Pilot LED will be remain off However if neither of these states is active the LED will be ON Input and output
169. les ST Realizer Examples Fastcnt Fastcnt asm 1 04 Tue May 18 14 06 27 1999 52 100 INPUT T Fastcont ine INPUT C Program Files ST Realizer lib ST6260 inc INPUT C Program Files ST Realizer lib st62lib mac INPUT C Program Files ST Realizer lib st62xx mac INPUT C Program Files ST Realizer lib st62eepr mac LIST 1 ORG 00080H RROMST ASCIZ Fastcnt ASCIZ 1 04 Reset LDI IOR IOR_MASK LDI HWDR OFFH LDI DRBR O10H LDI EECTL OOOH PerInit initialize PORTB events Enable interrupt on PORTB 2 POILIDLti LDI DDRA OOFH LDI ORA 000H LDI DRA OOFH LDI BUDRA OOFH LODI EE ER LDI ORB 004H LDI DRB OC3H LDI BUDRB 0C3H LDL DDRC OICH LDI ORC 000H LDL DRC UIGH 230 248 d www BDTIC com ST Appendix B Sample Applications LDI BUDRC UICH Rtornit LDL gie ELE LDI ICR O0CFEH LDI TSCR O06DH Clk I LDI IOR IOR MASK RETI RamInit ICK LDI A 0 LDI X 000H LDI Y RamInit LD X INC X DEC X JRNZ RamiInitl iconstw vlin7 2 4 p o2 1 A O10H LeOnSstb vand a 57 170 ldltohwbww vznl0 4 v2nll 2 1 y2n9 4 0 0 LCOnstw von2z0 2 10 lconstw vonl9 2 100 lconstw vsnls 4 1000 JP RIS05301l1 LDL IOR IOR MASK 195030114 BYTE OOOH BYTE O7EH BYTE OOTH BYIE 0 30H e BYTE 002H BYTE O6DH BYTE 003H BYIE 079H BYTE 004H BYTE 033H BYIE 005H BYTE 05BH BYTE 006H BYIE O1FH EIS0SUII RealMain RtC LD A TICK CLR TICK LDI
170. ling hardware dependent interrupts than as an all purpose condition trigger 157 89 248 www BDTIC com ST Subschemes Execution Conditions and Events Reset entry point Initialization Normal Code Execution Subscheme Symbol Normal Code Execution Subscheme Code Chapter 7 If we revisit the flow chart shown in Section 2 6 5 we can see how different event symbols can be incorporated in the same subscheme and how they influence how and under which conditions the code in the subscheme is executed In this schematic example we have placed a subscheme symbol in the midst of our normal code loop i e the root scheme that references a subscheme containing two event symbols If neither of the conditions defined by the event symbols are met the subscheme is ignored However if either or both of the events are triggered meaning that their conditions are met then the code in the subscheme executed in the following manner e f Event 1 is triggered by the event s condition being met Symbol sequence A will be performed with output signal equal to 1 out 1 In other words the symbol sequentially following the Event 1 symbol will have the binary value 1 as its input signal and the rest of code sequence A will be executed in accordance Symbol sequence B will be performed with output signal equal to 0 out2 0 In other words the symbol sequentially following the Event 2 sy
171. mbol will have the binary value 0 as its input signal and the rest of code sequence B will be executed in accordance 90 248 www BDTIC com ST oymbol sequence C will be performed unconditionally there are no event symbols connected to this code sequence Chapter 7 Subschemes Execution Conditions and Events e f Event 2 is triggered Symbol sequence A will be performed with out1 0 Symbol sequence B will be performed with out2 1 Symbol sequence C will be performed unconditionally f neither Event 1 nor Event 2 is triggered no part of the subscheme code will be performed 7 4 6 Compatibilities Between Types of Events and Certain Symbols There are certain rules concerning which types of events can be placed together in the same subscheme because some types of events have priority over others and furthermore some types of events are incompatible when placed together in the same subscheme Event types that may be placed together in the same subscheme e Any number of peripheral interrupts When these interrupts occur simultaneously the program will give priority to the peripheral in accordance with the IRQ settings e A timed interrupt and any number of peripheral interrupts Once again execution priority is given in accordance to IRQ settings e Periodic events and upon subscheme input change events may be placed together in the same subscheme Execution priority has less importance because neither of these e
172. me will start at O s and end at 0 001 sf OCNF1 B aw E Heating s OH Temperature Setpoint EAP B d 50 248 www BDTIC com ST Chapter 3 Tutorial 1 Double click the Oscillator probe once it is placed The Change Oscilloscope Probe dialog box opens bes Change oscilloscope probe x KH ULMP1_E Channel Top 5 000 Battam T Time Begin at OO OO DO 0000 hh mm ss ms End at OO OO D OO 0 ber mm ss ms Mode Trigger Trigger on a Rising edge when the value equals 0 000 elei Sel Cancel In the Y axis Bottom field enter 0 In the Y axis Top field enter 5 In the Begin at field enterog 00 00 0000 In the End after field enter 00 00 00 0010 Select the Mode value Trigger Select Trigger on a Rising edge Click OK O N Oo C FP W N Now go to the view of the root scheme by selecting heating sch under the Window menu To see what the signal values are in the various connection wires you should place Numeric Probes in the main scheme diagram 1 For a complete description of oscilloscope parameters and how to control them please refer to Section 10 3 9 on page 153 ky 51 248 www BDTIC com ST Tutorial Chapter 3 Since the heart of the heating control application is the state machine it is useful to check that each input condition has the required effect on the state machine and that the state machine takes the appropriate actions To see what the current
173. me symbol s Open the scheme where the new subscheme symbol is re Open the local symbol library by clicking a Create a new blank scheme in the project by selecting File gt New gt Scheme Call it any name you wish for example temporary sch Using the local symbol library select and place the new subscheme symbol s that you wish to save to a library in the blank scheme Now you must edit the new subscheme symbol s Right click the new subscheme symbol and select Edit from the popup menu The symbol editor will open Double click on the subscheme filename attribute at the bottom of the symbol i e in the above example we gave the value custom sch to this attribute but by default it is left as a At this point you have to make a choice depending on how you wish the default usage of the symbol to be e If you wish to leave the subscheme file generic leave the in the field Every time you use the symbol in the future you will have to remember to fill in this attribute value specifying the filename of the subscheme and it s path if it is not located in the project folder Alternatively if you double click the symbol once placed in a project scheme you will be prompted to create a new subscheme Ay 169 248 www BDTIC com ST Defining a New Subscheme Symbol Chapter 11 e If you always wish your new subscheme symbol to reference the same subscheme file enter the name of the subscheme file for exampl
174. n SEF File riae tia diaa haa a a a a a na 142 10 2 Setting Adjusting and Viewing Input Values a na naana aaaea 142 10 2 4 Setting Fixed Input Values 0 0 00 eee 143 10 2 5 Setting Variable Input Values 0 0 0 cee ee 146 10 2 6 Setting Sinusoidal Input Signals 0 00 ee 148 10 2 7 Setting Square Wave Input Signals 000006 150 10 3 Monitoring Signals with Probes 151 10 3 8 Viewing Signal Values Numerically 152 10 3 9 Viewing Signal Values Graphically 153 10 3 10 Viewing State Machine Gates 156 10 4 Selecting Adjusters and Probes 0 0 ccc es 157 10 5 Running the Simulator 0 0 eee 157 10 5 11 Starting Stopping the Simulation 158 10 5 12 Setting Run Options 0 0 0 cc ee 158 10 6 Recording and Reusing Adjuster and Probe Values 160 10 6 13 Recording Adjuster and Probe Values 00005 161 10 6 14 Reusing Adjuster Values 162 CREATING YOUR OWN SYMBOL 165 MES TI ATTE 165 11 2 Running the ST Symbol Editor 165 11 3 Defining a New Subscheme Symbol 0 0 00 eee eee 166 11 3 1 Adding Your New Subscheme Symbol toa Library 169 11 4 Defining a New User Defined Symbol 2 0 00 cc eee eee eee 171 11 4 1 Defining the New Symbol 0 0 00 cee 172 11 4 2 Editing the New Symbol 0 0 00 ce ee eee 176 11 4 3 Adding Pins to Your Symbol 0 0 00 eee 181
175. n the adjuster and selecting Properties Decrease size from the popup menu shown at right qmm 150 248 ky www BDTIC com ST Chapter 10 Monitoring Signals with Probes The Change square wave adjuster dialog box opens fee Change square wave adjuster Botton T Top 65535 Frequency 1 000000 Hz Duty cycle 50 000000 Cancel 5 To set the bottom range of the wave amplitude edit the value in the Bottom field To set the top range of the wave amplitude edit the value in the Top field To set the wave frequency edit the value in the Frequency field To set the duty cycle that is the percentage of time that the signal is at its top value edit the value in the Duty cycle field 6 Click OK 10 3 Monitoring Signals with Probes When you simulate an application you can monitor the signals it generates using probes This enables you to experiment with and fine tune your application You connect probes to any wire pin or symbol whose signals or states you want to monitor ST Realizer lets you connect four types of probes Numeric Probes which let you view the current signal value of the pin or wire in the Binary Decimal Hexadecimal and Octal number bases e Oscilloscope Probes which let you view the signal value of the pin or wire as a graph e State Machine Probes that let you view the value i e current state of the initial state symbol in a state machine The following paragraphs describe how
176. ng an ordinary scheme with one exception a subscheme has connections to its root scheme via a subscheme symbol The subscheme symbols are named sssp q where p indicates the number of inputs you need for your symbol and q the number of outputs For example sss2 1 is a subscheme with two inputs and one output SZ 7 248 www BDTIC com ST Events Chapter 2 When you want to use a subscheme you must therefore first think about its connections what inputs does the subscheme need to deliver its output Once you know this you can choose the correct subscheme symbol from the main library However subschemes like the root scheme can be modified at any time Section 7 4 on page 85 describes how to create and modify subschemes 2 6 Events Events are conditional triggers similar to If Else statements that can be applied either to an entire subscheme or simply to a sequence of code Like an If Else statement events are always triggered by an input of some sort The input may be e An interrupt such as a timed or hardware interrupt e An input value change When an event is applied to an entire subscheme it is called an execution condition because it defines the conditions by which the subscheme will be executed However events can also be made to apply to just a sequence of symbols within a subscheme using event symbols These symbols act as switches if the condition that they represent is met the code that follows them can be
177. ng the lt gt lt lt gt gt buttons on the analog numeric adjusters The lt and gt buttons decrease and increase the values by 1 respectively and the lt lt and gt gt buttons decrease and increase the values by 10 respectively Table 4 on page 49 shows a list of suggested values designed to allow you to view how the application reacts by starting or stopping the heat pump depending on the difference between the Setpoint and Actual temperatures When you want to stop running the simulator click To run again the simulator click 4 Note that before re running the simulator you can initialize it by clicking d 3 6 Now it s Up to You You ve now completed the tutorial In this tutorial you learned the three major steps involved in creating your own application using ST Realizer e How to draw the application e How to analyse your scheme and compile your application code e How to simulate your application Furthermore you learned what most of the ST Realizer symbols do and how and where to place them You are now ready to start developing your own bug free applications for the ST6 or ST7 families of microcontrollers using ST Realizer If you want to look at more examples refer to Appendix B Sample Applications on page 211 1 Simulator time does not necessarily elapse at the same rate as real time the time on your watch The simulator time is generally slower than real time depending on the hardware c
178. ngs s nnsssnnnnneenananennnaann 142 F Files cj E 129 gl PEIE EN EE 11 129 Ta 56 O VE 160 Geet 11 129 SZA www BDTIC com ST jo m PH 55 uo eee 11 129 SO eer a 67 EE EE S 139 WIT EE 67 142 importing into tables 101 ro WE 139 ST macro assembler language 129 Folders created by Gl Healzer 2 Fonts for printer E 83 G Generated code example 230 Generated report file example 228 Ghost DOX CO OES uissaevsss eser saa breite 194 H Hardware see Target Hardware heating control system tutorial 13 l ICODE attribute esssesssss 208 Importing files into tables 101 Initialising the simulation 158 Input interrupt event ssssesesesse 97 e 181 simulated values 142 EE eege 80 variables used by ST Realizer 64 inputlatch symbol 80 Installation folders created 2 L LABEL attribute 208 Libraries adding new subscheme symbol to 169 adding new user defined symbol to 191 placing a symbol from 73 Symbol 73 jeje S 139 Melct 203 M
179. nput Signals If you wish to the input signal to vary sinusoidally you must attach a Sine Wave Adjuster to the appropriate input pin or wire Sine Wave Adjusters let you set the signal amplitude and frequency that is input to the pin or wire Note You can only attach Sine Wave Adjusters to wires or pins with analog input To attach a Sine Wave Adjuster to a pin or wire 1 Select the pin or wire to which you want to connect the adjuster by clicking on it 148 248 ky www BDTIC com ST Chapter 10 2 Click 3 Click where you want the adjuster to appear The adjuster is now placed in your scheme and connected to the pin or wire you selected In the example at right we see that the sine wave adjuster has been connected to the pin called Setpoint which is also the name of the input symbol Note that the sine wave adjuster shows the name of the pin whose input the adjuster controls 4 Set the signal amplitude and frequency by e Double clicking the adjuster Or Setting Adjusting and Viewing Input Values SCE hMISU hU sl OChPz A ICAPZ A OChMP1 A Heatingls ON Temperature Setpoint ICAP B e Right clicking on the adjuster and selecting Properties from the popup menu shown at right The Change sine wave adjuster dialog box opens fee Change sine ware adjuster ICAP1_B DCMP1 B a Increase size Decrease size Properties Bottom T Top 65535 Frequency 1 000000 Hz
180. ns fee Change time table adjuster x me air TI OO UO UO UO 0 000 Import Cancel Table 6 Entering and Editing Time Table Values To change the value of a table cell Double click the entry you want to change then edit its value in the Change value dialog box Press the Insert key on your keyboard then enter the new time and value Import values from an existing file Click Import and choose the file you want to import Note The smallest possible time interval between two entries in the table is 0 0001 seconds However make certain that the smallest possible interval that you enter is superior to the value of the base clock timer tick refer to page 131 To Insert a new table row of cells ky 147 248 www BDTIC com ST Setting Adjusting and Viewing Input Values Chapter 10 ON J Tip Note in the example shown below that in addition to being able to view the table of values at left you can also see a graphical representation of the time output values in the right hand area of the dialog box When you select one of the values in the table the point in the graph corresponding to the value pair to which the selected value belongs will turn red x bes Change time table adjuster X time 00 00 00 0000 00 00 00 0000 SS wid E DUE DIOE 2 0000 OU 00 04 UU 00 00 06 0000 hu DUR DILL Import Cancel 10 2 6 Setting Sinusoidal I
181. nstant loop from the time the application starts to when it stops subschemes are only performed when specified by the execution conditions There are a variety of execution conditions that one can assign to a subscheme and these can vary depending on the target microcontroller for which the application is designed and furthermore upon which of the microcontroller s peripheral have been enabled for use by the application 7 4 5 Event Symbols Event symbols are analogous to execution conditions but while execution conditions apply to an entire subscheme an event symbol is placed within a scheme and acts to trigger only certain portions of the subscheme When the conditions necessary to trigger an event symbol are met the event symbol outputs a binary value of 1 When the event symbol s conditions are not met i e the event is not triggered the event symbol outputs a binary value of 0 However if none of the event symbols in a subscheme are triggered the subscheme is effectively invisible to the rest of the program and no code within it is executed Event symbols are assigned in much the same way as execution conditions all of the same options are available However because more than one event symbol can be included in a single subscheme they can be used as a means of imposing a range of conditions on the same or similar sequences of code Because of this functionality event symbols were conceived more as a means of control
182. nt Time Setup The incrementation clock Up input of the symbol is duplicated through an OR gate with an external clock Setup signal for Hour or Minute setup Any activation on this clock increments the content of the counter by 1 Figure B15 ky 223 248 www BDTIC com ST Clock Design Appendix B Sample Applications Figure B15 Current Time Setup with a Duplicated Clock Setu A int 0 type bit gt CKout B3 9 Alarm Time Setup As for the Current Time setup the Alarm Time setup is achieved by incrementation of two Modulo N counters one for minutes and one for hours Each of them has its own input clock controlled by the combination of the keys ALARM SETUP HOURS and MINUTES A feedback loop is still needed to reset the counter when the maximum value is reached but its Implementation can be more simple than in the Current Time counting blocks A precise synchronism is not mandatory and a basic solution can be used Figure B16 Figure B16 Alarm Time Setup Min Setup gt gt Min Alarm SS Hour Alarm Hour Setup gt gt d 224 248 www BDTIC com ST Appendix B Sample Applications Fast Counter Application B4 Fast Counter Application B4 1 The Application The following description of an application is added to this appendix to illustrate the new features that come with ST Realizer Il The application is a pulse counting device used to measure the frequency of a digital si
183. nt temperature that is input to the application To do this you will need to place a digital numeric adjuster on the Setpoint pin 1 Click the Setpoint pin on the pin level Masi drawi ng DCMP2 A Setpoint ICAPZ A 2 Click Ga EE SES Heating ls QN 3 Click where you want the Numeric Temperature ICAP1_B Adjuster to appear You may decrease Setpoint OCMP1_B the size of the adjuster by right ICAP2 B CLKOUT clicking on it and selecting Decrease size 4 Enter the temperature value 0 At the pin level temperature values are expressed in Volts rather than in C A simple conversion formula links the two quantities Tor 10 ELO DBB OV Tiy Therefore 0 C 2 0 V 5 Now connect a numeric adjuster to the Temperature pin in the same manner also setting the value to 0 A list of temperatures in C and their corresponding values in Volts is shown in Table 4 Table 4 A list of temperature values in C and their corresponding values in Volts Setpoint Temperature Setpoint pin Actual Temperature Temperature pin 0 1 L3 o f 39 2 5 7 0 09 d 49 248 www BDTIC com ST Tutorial Chapter 3 Connecting a Probe In addition to adjusters which fix input values we also need to connect probes to view output values In this application we will use all three types of probe to evaluate the response of our application During our simulation it would be helpful to know whether the heat pump is r
184. nts dialog box Cancel Timed interrupts are a very precise means of timing events and can be applied to short delays The execution of the code generated by the subscheme is triggered by the occurrence of a non maskable software interrupt Select NMI Interrupt in the left window pane and click the right arrow or double click the line Click OK www BDTIC com ST Chapter 7 Configuring an Input Interrupt Event Configuring a Timer Overflow Event Configuring Other Peripheral Dependent Events Disconnecting a Subschemes Execution Conditions and Events The code generated by the subscheme is executed when an interrupt occurs on an input line Select the appropriate input Interrupt in the left window pane and click the right arrow or double click the line Click OK The code generated by the subscheme is executed when a timer overflow occurs Select the appropriate line in the left window pane and click the right arrow or double click the line Click OK The code generated by the subscheme is executed upon the occurrence of an event interrupt specific to the peripheral for example end of SPI data transfer ARTimer Compare interrupt etc Note that the peripheral must be enabled refer to Section 5 3 6 on page 66 before these specific interrupts will appear in the Execution Conditions or Events dialog boxes Select the appropriate line in the left window pane and click the right arrow o
185. o the new location of the symbol To move a symbol or a group of objects e Select the symbol or group of objects Place the cursor on the selected group and drag and drop the ghost box with the four headed arrow pointer to the new location of the symbol Note that the wire connections attached to a symbol are moved with the symbol oelect the symbol or the group of symbols Click m or press the Del key Note that you delete also all other objects in the group such as wires To delete a symbol and place it in the clipboard select the symbol and click P l Symbols can have a variety of attributes that depend on the symbol type When you place a Rotate symbol on a scheme from the symbol library you elt are prompted to specify these attributes Copy shape However they can be changed at any point Attributes To do this e Right click the symbol A popup menu opens Connect Edit 75 248 www BDTIC com ST Symbols Chapter 7 Click Attributes The Select an Attribute dialog box opens eDouble click the line of the attribute you want to change An Edit the Value dialog box opens fee Select an attribute CODE limt Value Top 255 ValueB ottom U bes Edit the value E4 MAME Myname Cancel Den The field label in this dialog box NAME in the example depends on the value to be changed for the specified attribute e Enter the new value then click OK v Tip To c
186. ocessing Cycle Time By default the processing cycle time is variable with the shortest fastest possible processing cycle time being 1 timer tick However in this dialog box you can choose to fix the processing cycle at a specific number of timer ticks of your choosing by selecting Fixed processing cycle time and then specifying the number of timer ticks that you wish to correspond to a single processing cycle Note Timer ticks and the code needed to generate them are ONLY created if you use either time related symbols or events that require a timer in your application Otherwise the processing cycle time will be variable If your application uses any symbols or events that require the measurement of time the timer symbol for example the default timer Timer 1 or Timer A will be used to measure that time using timer ticks In addition all time related symbols or events such as a periodic event that are based on the timer tick can also be controlled using the default timer However if you require a further timer that will NOT be based on the timer tick as is the case for example when you wish to generate a pulse width modulated PWM signal you will have to enable one of the peripheral timers on the microcontroller if it exists make certain that the microcontroller you have chosen can provide all of the peripherals you require To give an example of how the timer tick is used imagine that you decide that you set the val
187. ock TR 4T delv ticks for the delay default 10 ms Time type WORD Time and O types BIT 116 248 d www BDTIC com ST Chapter 8 Time Related Symbols Delay Variable Off Symbol An OFF input bit is delayed a variable time The Time input defines the number of clock gt OF TO delvoff ticks for the delay default 10 ms Time Time type WORD and O types BIT Delay Variable On Symbol An ON input bit is delayed a variable time The Time input defines the number of clock T o C delvon ticks for the delay default 10 ms Ti Time type WORD and O types BIT Fixed Time Oscillator Symbol The TIME attribute format IS dd hh nm ss xxx time s where comment dd is the number of days hh is the number of hours mm is the number of minutes ss is the number of seconds and xxx IS a fraction of a second Note that the frequency in Hz is 1 2 TIME O type BIT Variable Time Oscillator Symbol The Time input defines name the number of clock ticks default 10 ms Note that the frequency in Hz is 1 2 TIME Time Q TIME type WORD comment O type BIT Fixed Timer Symbol A rising edge on the input pin causes Name a pulse to be generated The TIME attribute format is bs d e da nhemm sesg xxx Time where Comment dd is the number of days nn is the number of hours mm is the number of minutes ss is the number of seconds and xxx IS a fraction of a second
188. ol is moved Auto rerouting Both these options are enabled by default For details see Wire Drawing Options on page 201 Select the wire to be copied Click CH I Drag and drop the ghost box of the wire where you want to place it Note that attribute values are also copied To copy a wire to the clipboard click Click then drag and drop the ghost box down to the new location of the wire Select the wire click once on it and drag and drop the ghost box with the four headed arrow pointer down to the new location of the wire Select the wire or the group of wires Click T or press the Del key Note that you delete also all other objects in the group such as symbols To delete a wire and place it in the clipboard select the symbol and click S Select the wire then click JEAt 79 248 www BDTIC com ST Symbols Rotating a Wire Changing a Wire s Attributes Connecting Input Output Symbols to Microcontroller Pins Ports and Peripherals Note 80 248 Chapter 7 Select the wire then click e The selected wire is rotated by 90 counterclockwise Click the wire with the right mouse button Type A popup menu opens ni Click the name of the attribute you want to change 2 An Edit the Value dialog box opens Enter the new value then click fee Edit the value ES OK LABEL viabel co Application input and output symbols must be connected to the ST6 or ST7 microcontroller
189. oller have been enabled For this reason it is important to enable all of the peripherals that your application needs to function see Connecting Input Output Symbols to Microcontroller Pins Ports and Peripherals on page 80 before you define the execution conditions in any subschemes Mew VIe i Properties 93 248 www BDTIC com ST Subschemes Execution Conditions and Events Chapter 7 E ST 7221262 Execution conditions Ea Conditional execution of Filter sch Sat by conditions Available conditions Applied conditions Upon sub scheme input change Penodic Timer Capture 1 interrupt TimerB Compare 1 interrupt TimerB Capture 2 interrupt H TimerB Compare 2 interrupt TimerB Overflow interrupt Properties OF Cancel In the example the microcontroller ST72212G2 has had one of its peripherals Timer B enabled The resulting choice of execution conditions are Each time there is a subscheme input change Periodically by specifying a fixed time between each consecutive execution According to a timed interrupt According either one of five Timer B interrupts these are only available because the Timer B peripheral has been enabled Placing and By placing an Event symbol in the subscheme the execution of the Configuring an entire subscheme or part of it can be triggered by an event determined Event Symbolina by a specific symbol within the subscheme Subscheme Place t
190. on B2 4 Possible Improvements The inputs A and C of the comparators are interpreted as variables to which fixed values are assigned the range limits Even though this does not have any importance for the application process itself it must be taken into account in some cases Some RAM locations usually dedicated to variable storage are used to store these constant values This reduces the RAM space available for the surrounding application Data processing I O control etc This can be improved by creating a specific comparison symbol where the reference values are defined as constant Thus the limit values are stored in the ROM and not in the RAM space While doing this it is also possible to fine tune the symbol function for the application The new symbol is defined as follows The variable input value is compared to 2 reference values Bot Top attached to the symbol instance providing 3 output e Input gt Top e Bot lt Input lt Top e Input lt Bot Only 5 comparators and one RAM location are used by the digitized representation of the voltage value instead of 11 in the previous case input value plus 10 border values 218 248 yy www BDTIC com ST Appendix B Sample Applications Analog Multiple Key Decoder The symbol customisation feature provided by the ST Realizer environment thus enables a more simple graphical description to be created only 5 comparators while optimizing the memory requirements Figure B
191. on there is a symbol editor function that allows you to modify an existing symbol or create an entirely new symbol and save it to the library Most symbols in ST Realizer s main library have attributes which you must specify These attributes allow you to specify many parameters such as e Giving the symbol an application specific name in order to identify it elsewhere in the scheme e Assigning the input or output data type e Specifying a time period in a time related symbol ky 71 248 www BDTIC com ST Symbols Chapter 7 The above list is by no means exhaustive The modifiable attributes depend on the type of symbol In Chapter 8 on page 103 you will find a complete list of all of the symbols in the ST Realizer main library complete with the modifiable attribute values available for each one Earlier we mentioned that each symbol is in fact a graphical representation of a portion of assembler code called a macro Later in Chapter 11 on page 165 we will take a closer look at customizing symbols using the Symbol Editor and at the assembler macros that define each symbol The remainder of this chapter will concentrate on how to manipulate symbols and their attributes and how to wire together symbols to create an application scheme Note With ST Realizer object naming is case sensitive In addition spaces are interpreted as characters Ensure that all object names are used consistently otherwise errors will result when
192. on the output wire you can set the output of a symbol to a specific variable type This feature can be useful when you use the MUL symbol to multiply two values When you multiply two SINT variables an overflow may occur 2000 1500 becomes 14656 instead of the expected 3000000 By putting a TYPE LONG attribute on the output wire of the MUL symbol this overflow is prevented the value 3000000 can easily fit into a LONG variable For example Another example of type overruling is where the DIV symbol divide is used to divide two SINT variables This results in a value that fits onto an SBYTE variable By using the TYPE attribute a smaller variable type can be defined generating more efficient and faster code A2 Attribute Types The following tables list the types of attribute that you can place on pins and symbols and describe the available values and meanings ky 205 248 www BDTIC com ST Attribute Types Appendix A Variables and Attributes A2 1 Pin Attributes Pin numbering 0 x Specifies the parameter sequence TYPE Specifies the variable type of a pin The following table lists the available values for TYPE tags and their ranges Value Range EVENT 0 1 BIT 0 1 UBYTE 0 255 SBYTE 128 127 UINT 0 65535 SINT 32768 32767 LONG 2147483648 2147483647 WORD any type except BIT When one of these values is specified the connecting wire must be of the same type For input pins the attribute TY
193. only refer to parts of mm zoom out the symbol itself ST p Full view l Connect Realizer enables you Refeshview to view hidden Properties attributes Ean Click the Invisible attributes entry in the View cascading menu Invisible attributes 83 248 www BDTIC com ST Working in Schemes Chapter 7 you obtain by clicking the blank area in the scheme worksheet When the Invisible attributes option is selected all attributes are visible Placing a Titleinthe 1 Right click any blank area in the scheme Scheme A popup menu appears 2 Select the New Attribute options The Create attribute dialog box opens fee Create attribute x Color mm Edit Tag Size 2 m m TT E Alignment Value Horizontal Center E Vertical Center B Direction Hommel e Visibility M Tag Iv Value 3 Specify the following options e TAG TXT Enter the title text in the Value edit box e Under Visibility there are two options If you wish only the title text that you typed to appear select Value only If you wish the attribute tag to appear as well in this case TXT title text select both Tag and Value 4 You may specify color size or alignment values for the title 5 Place the heading by dragging it where you want and click OK 84 248 ky www BDTIC com ST Chapter 7 Subschemes Execution Conditions and Events 7 4 Subschemes Execution Conditions and Events Subschemes are exac
194. ons e Click Close in the File option of the main menu or e Click with the right mouse button any blank position in the subscheme A popup menu opens with five options Click here to return Select Leave to the root scheme You will be returned to the root scheme 3 3 11 Connecting Hardware Ports and Peripherals Once you have finished drawing your application schemes the next step is to connect the application inputs and outputs to the ST6 or ST7 microcontroller input and output hardware ports or peripherals In our heating control application the input output symbols are Analog Input Control temperature acquisition in sem A External Input Conditions diagram BS Temperature Analog Input Actual temperature acquisition in T External Input Conditions diagram DUNT Temperature HeatinglsON in External Actions HeatinglsON diagram Pilot LED ON Loading ARCP Compare Register in E External Actions diagram n PumpspeedControl 38 248 d www BDTIC com ST Chapter 3 Tutorial Therefore there are four input output symbols and they need to be connected as shown in Table 3 The four input output symbols represent two types of devices e Three ports namely Setpoint PC 4 Temperature PC 5 and HeatinglsON PB 0 e One on chip peripheral ARCP Timer B to be activated in Auto Reload mode with PWM generation via the TBOC1LR Timer B Output Compare 1 Register Table 3 Application Microcontroller Conne
195. ontroller s datasheet because ST Realizer reserves a portion of the available RAM memory for its own use For example for ST7 devices ST Realizer uses 12 bytes of RAM memory 2 If the values in these fields are changed there will be an impact on the application s variables and on the generation of the code 157 65 248 www BDTIC com ST Hardware Configuration Chapter 5 5 3 6 Enabling Peripherals Each peripheral belonging to the target microcontroller has an associated tab in the Hardware settings window If you wish to use one or more of the peripherals in your application you must enable the peripheral which allows it to be initialized and configured To do this 1 Click the appropriate tab to open the dialog box that describes the peripheral to be configured The peripherals available vary depending on the target microcontroller device 2 Check the Enable box at the top of the peripheral s dialog box The peripheral is now enabled and may be configured using the rest of the options in the dialog box as you wish For details on the peripherals available and their configuration options refer to the Microcontroller data book See also Chapter 8 The Main Symbol Library on page 103 66 248 ky www BDTIC com ST Chapter 6 Schemes 6 CREATING OPENING SAVING SCHEMES 6 1 Schemes Once you have created or opened the project on which you want to work you must create or open a scheme A scheme is the sheet on which yo
196. or select the File menu and click Open The Open simulation environment dialog box opens Open a file Look in CH Heating cl Sc Files of type Environments set Cancel 3 Inthe list double click the name of the sef file for example main sef then click Open All of the simulation views contained in the sef file will open for example the pin level drawing of the target microcontroller and or the project schemes You are free to run or modify the simulation at will ky 141 248 www BDTIC com ST Setting Adjusting and Viewing Input Values Chapter 10 10 1 3 Saving an GEF File You should save the modifications you made on a sef file at regular intervals and of course once you have finished all your work on the file You may also make a duplicate of an existing sef file under a different filename if you wish to have several different simulation versions To save an sef file e On the File menu click Save To make a duplicate of an existing sef file 1 Onthe File menu click Save as The Save file as dialog box opens 2 Browse to the folder in which you want to create the duplicate file 3 Type the new file name in the File name field then click OK Note You may save your file as a WMF Windows Meta File type file This will enable you to export the drawing to any word processing or publishing project file that accepts this format 10 2 Setting Adjusting
197. orms the following functions e Turning a motor on e Setting the motor speed e Turning the motor off In a state machine you would define a state using a state symbol for each functional step of the application above and in addition a state which defines the starting point of the application the initial state The sequence of state symbols would therefore look like e Motor OFF Initial State e Motor ON e Setting Speed e Motor OFF The transitions between each of these states are controlled by conditions Condition symbols act as switches When a condition is met the condition symbol is triggered and the program can progress to the next state The tutorial included in this manual see Chapter 3 Tutorial on page 13 provides an very good example of how a state machine and state symbols can be used in creating an application 6 248 SZA www BDTIC com ST Chapter 2 Schemes 2 5 Schemes When using ST Realizer you design your application in schemes A scheme is like a plan on which you place symbols and draw wires Each application consists of a set of schemes including one root scheme and any number of subschemes Section 7 on page 71 explains how to build and modify schemes 2 5 2 The Root Scheme The root scheme is the starting point of your application program and corresponds to the reset vector of the program The root scheme is where you create the main loop of your application All of the large scale
198. ose or Project gt Close 4 6 Saving Projects Once you have defined your project you should save it so that all of the configuration information you have updated is kept as a part of the rpf file e If you try to close a modified project you will be prompted to save it e Otherwise to save a project under the File menu select Save e If you wish to save your project to another filename for example create a back up copy of the project under the File menu select Save As and type the name of the file that you wish to save the project to i Tip If you save your project to a different folder all of the schemes and subschemes M ON use associated with the project will also be saved to the new folder ky 57 248 www BDTIC com ST Saving Projects 58 248 www BDTIC com ST Chapter 4 Chapter 5 ST6 or ST7 Devices 5 SPECIFYING THE TARGET HARDWARE DEVICE 5 1 ST6 or ST7 Devices Once you have created a new project the next step is to define the ST6 or ST7 device type that the application will be loaded into This will attach the hardware configuration of the ST6 or ST7 device such as pinout and memory capacity to the scheme that will describe your application This hardware data assures that the application is tailored to the target ST6 or ST7 device Note for ST6 users S T Realizer does not support any RAM or ROM paging except for static pages Because of this the ROM size is limited to 4 kilobyt
199. ottom left of the symbol editor window whenever you are in drawing mode ae 4 Click when the ellipse is the size and shape you desire The ellipse is now drawn The status bar displays the ellipse s measurements To draw a rectangle 1 Click CH in the symbol editor toolbar or select New gt Rectangle in the popup menu 2 Click where you wish to place the top left corner of the rectangle 3 Move the cursor downwards and to the right Click when the rectangle is the size and shape you desire The rectangle is now drawn The status bar displays the rectangle s measurements To draw lines 1 Click in the main toolbar 2 Click where you want the line to start 3 Click where you want the line to end You can continue drawing connected lines by placing the cursor where you want the next line to end then clicking 4 Right click when you want to stop drawing connected lines Note When you draw the cursor automatically snaps to an invisible grid If you want to change the spacing between the gridlines on the Options Environment menu click the Symbol tab then specify the appropriate grid value Changing graphic properties 1 Select the graphical object you wish to modify by clicking once on it 2 Right click the mouse A popup menu appears with one options Properties Select it ky 179 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 3 A dialog box entitled Change properties opens lee Chang
200. ou click this button the pin moves anti clockwise to the next boundary 9 Move the cursor to the point of your symbol to which you want to connect the pin then click to place the pin 11 4 4 Assigning Attributes to Your Symbol Attributes allow you to attach extra characteristics to symbols For example attaching an attribute of type DEVICE to a pin extends the macro that is linked with the symbol with additional information The available attribute types are listed in Appendix A Variables and Attributes on page 203 d 182 248 www BDTIC com ST Chapter 11 Defining a New User Defined Symbol To assign an attribute 1 Click ay in the symbol editor toolbar or select NewAttribute popup menu The Create attribute dialog box opens fee Create attribute Ea Color i E dil Tag Size 2 m m TT Alignment Horizontal Center Vertical Center Direction Moma Visibility T ad M Value Cancel 2 Inthe Tag field select an attribute tag from the drop down list For example for our Stepper symbol we d like to add some text Select the TXT tag from the cascading menu 3 Inthe Value field enter the tag value For our Stepper symbol we d like to enter the text Step Value 4 f you want the tag or the value to be hidden click the appropriate check box in the Visibility box When the boxes are checked the tag or values are visible Hidden tags and values can be made visible by choosing
201. pays to keep things simple in the main scheme and to only include diagrams that represent the large scale sequential running of the application All of the highly detailed acquisition filtering and comparison programs are better put into subschemes so that the application will be easier to de bug or update later There are two good guidelines to keep in mind when deciding when to put something into a subscheme rather than in the main scheme e Size and complexity of the diagram the larger and more complex the diagram the more reason to put it into a subscheme by itself e If the function that the diagram performs runs in parallel to other functions for example a sampling program that periodically reads external inputs continuously it must be put in a subscheme The entire main scheme of the heating control application is shown below Only one subscheme for the internal event driven action described above will be created after we finish the main scheme State Machine Diagram Internal Input Conditions Switching the Pilot LED On HeatingON gt SetPump Timer Init O A 1 ze SetupTime mmm Amen Ewe 0 Setup Timer TYPE SINT ARCP PumpEnabled En PumpSpeedControl External Input Conditions We have already completed the State Machine Diagram top left The remainder of the main scheme diagrams are described in the following paragraphs d 27 248 www BDTIC com ST Tutorial Chapter 3 3 3 Extern
202. phical detail to better distinguish the symbol 11 4 2 Editing the New Symbol Once you have generated the new symbol it will appear as above in a symbol editor window that is called by the name of the new symbol In this environment you can further edit the visual appearance of the symbol and refine its attributes d 176 248 www BDTIC com ST Chapter 11 Defining a New User Defined Symbol 11 4 2 1 Accessing Editing options from the Symbol Editor window e Inthe scheme right click the symbol you wish to edit s Neu The symbol editor popup menu will appear as at right allowing a number of options Most of these options also View appear in a toolbar which floats in the symbol editor window Edit design notes The figure below shows how you can use either the popup Create heading menu or the toolbar to edit the symbol Symbol editor tools x z T WEN a m E eU to edit description create heading to define a new pin Rectangle to draw a rectangle an ellipse dit design notes Arc E Create heading 11 4 2 2 Editing pin attributes 1 Select the pin whose attributes you wish to modify 2 Right click the mouse with the pin selected A popup menu will appear as below Rotate Type H Label Properties 4 ky 177 248 www BDTIC com ST Defining a New User Defined Symbol Chapter 11 3 Select Properti
203. picture is frozen e Trigger mode The signal is continuously displayed such that each time a rising edge falling edge or a specified value is detected by the probe the displayed signal restarts at the graph s origin e Wrap around mode The signal is continuously displayed such that once the X value time equals the End at value or multiple of the displayed signal restarts at the graph s origin To set the display mode Right click on the oscilloscope probe in the simulation view A popup menu will appear as at right Select Add Replace D ecrease size channel 2 and select a Add Replace channel 2 Increase size To add another signal to the second enannel second signal either a wire Information or a pin for the second Properties channel The oscilloscope probe will now display two signals one from each channel ky 155 248 www BDTIC com ST Monitoring Signals with Probes Chapter 10 10 3 10 Viewing State Machine States You can view the states of a state machine by attaching a State Machine Probe io the initial state machine symbol You can choose to see either the current state only or the current state and a set number of previous states To attach a State Machine Probe to a state machine 1 Select the initial state symbol to which you want to attach the probe by clicking on it Note You may only attach State Machine probes to initial state symbols in scheme views of the simulation State Mac
204. place it You will be Attributes prompted to specify new attribute values for IPIE SEEN the symbol Edit ON Tip The choices shown on the popup menu can vary depending on the type of symbol For example for Constant type symbols a Value option is also displayed or for symbols connected to microcontroller output pins such as digout a Connect option will be shown 2 Select the symbol to be copied Click a lt i Drag and drop the ghost box of the symbol where you want to place it Note that attribute values are also copied To copy a symbol to the clipboard click l 74 248 ky www BDTIC com ST Chapter 7 Copying a Group of Symbols Pasting an Object from the Clipboard Moving a Symbol or Group of Objects Deleting a Symbol or Group of Symbols Changing a Symbol s Attributes Symbols You may copy either a group of symbols or a scheme portion or entirety Note that you will also copy all other objects in the group such as wires 1 Select the group of symbols to be copied 2 Click ar in the toolbar i 3 Place the ghost box where you wish to place the copied objects To copy a group of symbols to the clipboard select the group then click with the right mouse button Lopy Duplicate The pop up menu shown at right will appear Select Soch notate Copy To copy the selection to the scheme page choose Duplicate Mirrar Click then drag and drop the ghost box down t
205. ppendix B Sample Applications 0 00 cee es 211 B1 Coded Lock Application eee 211 B1 1 Application Overview 211 B1 2 Functional Description 212 B1 3 Sequencing Control aaa aa eae es 212 B1 4 Secret Code Storage inthe EEPROM 214 B1 5 Access Code Entry and Recognition 214 B2 Analog Multiple Key Decoder 0 0 0 0 eee 215 B2 1 Application Overview 215 p22 dl hu ele e sue dus mea eh ined ee ee REOS bel gees as eu dod iv 216 B2 3 Software Generation 217 B2 4 Possible Improvements liliis 218 B3 Clock DoS ua da qobdos mob dimid ER PRIRRRAEPRMRRESEESESUE dd S TREE 220 B3 1 Application Overview lle 220 B3 2 Current Time Counting llle 220 B3 3 Current Time Setup 0 0 00 ce ee 221 B3 4 Alarm Time Setup 0 0 0 cc eee 221 B35 Alarm EIERE dec oon 255 30 3 8 ee 2 8 aia ENEE a ee e 221 B30 TIMCDASE NEE EE EE E EE ede ee dado ds 221 ky vii www BDTIC com ST Table of Contents B4 vill B3 7 Current Time Counting llle 222 B3 8 Current Time enn 223 B3 9 Alarm Time Setup 0 ccc eee 224 Fast Counter Application eee 225 B4 1 The Application ie cd teehee ieee ne eee kee ew ee ee 225 B4 2 Fast Counter Report ie 0 00 cee eee 228 B4 3 Generated Code cc eee 230 237 d www BDTIC com ST Chapter 1 What You Need to Install ST R
206. propriate boxes 3 To change the font click the Select font button and select the new font from the list 4 Click OK when you have finished 4 197 248 www BDTIC com ST Symbol Layout Preferences Chapter 12 12 5 Symbol Layout Preferences In this dialog box you can change the way symbols are displayed on the worksheet 1 In the Environment Options dialog box click the Symbol tab The Symbol dialog box opens Shape color Edit arid 10 m m To ease the creation of your own symbols Realzer can create the macro heading for you Cancel 2 To change the color of symbols click the Edit button and select the new color from the displayed palette 3 To change the grid distance within symbols overtype the appropriate value in the Grid box Each symbol you create is normally linked to one or more macros These macros have headings with a specific format For details see Naming Macro Instructions on page 188 4 To allow pin names to be used in macro headings click the corresponding check box 5 Click OK when you have finished d 198 248 www BDTIC com ST Chapter 12 12 6 Customizing Toolbars Customizing Toolbars Toolbar buttons provide you with quick access to frequently used commands Most of the ST Realizer commands have their own predefined buttons You can change the ST Realizer toolbars by Note Adding or deleting toolbar buttons Placing separators between toolbar buttons
207. quencing the secret code storage in the EEPROM and the code recognition Figure B1 Coded Door Lock Block Diagram Lock the door Change secret code Sequencing Digit reception flag Control IM EEPROM to door Code locking Recognition system O 5 jo Sa o i 2 E O pa LL Digit value B1 3 Sequencing Control The most important feature of this application is the sequencing control of all its operations Two main items must be considered the transition between the different working modes Door locked Access code entry Door unlocked and Secret code entry and the management of the serial flow of the numeric values received from the user interface The transition between the working modes is managed by a state machine which manages four states Door locked e Code recognition e Door unlocked e Secret code entry d 212 248 www BDTIC com ST Appendix B Sample Applications Coded Lock Application Figure B2 Sequencing Control State Machine Wrong Cade Code Door lacked E a recognition E One digit received Secret Code Entry D Change Code The conditional occurrences are generated through either the user interface Lock Change secret code or some functional sub blocks of the application One digit received Right code Wrong code Last digit For example the occurrence of the condition One digit received in the Door locked state initiates the process code recogn
208. r A new blank worksheet opens where you can draw the main root scheme of the application At the top of the scheme worksheet you will see a toolbar with a number of icons How to use these icons will be described as we work through the tutorial but a quick summary of their names and uses is given here 16 248 www BDTIC com ST d Chapter 3 Tutorial x 9 6 Sa N LO g Yd S A ce oo P o e o Los M cU 2 SMP AA SP S x CC SPS SS af OO OD e S N ROS SSNS VD SF a S Q E o9 a O 9 E X SS SY d Ah e e ev 3 2 AN Pe P Ee RPS s SS AC UA e E E due A D c bx TETO Fi s O B at ge g HENNA Note The step by step instructions in this tutorial describe how to operate ST Realizer using the default toolbar setup shown above If while you are doing this tutorial you cannot find a button that is shown in an instruction refer to Customizing Toolbars on page 199 to find out which menu commands correspond to that button 3 2 Designing and Drawing Schemes For the heating control application the microcontroller will require the following inputs and outputs e 2 analog inputs The actual temperature The control temperature e 1 digital output to one pilot LED to indicate the heating system status e 1 digital output to control the speed of the pump In this part of the tutorial you are going to learn how to create the above application by drawing graphical schemes In particular you will learn e Ho
209. r rather than to supply sample applications for a given microcontroller 3 1 Setting Up Your Project In this part of the tutorial you will e Create a new project file for the heating control application e Define the ST microcontroller onto which the application will be loaded e Learn how to open the scheme in which you ll draw the application 3 1 1 Creating the Project File Each application you design is stored in a project When you create a new project the first step is to specify the folder in which you wish to place it It is recommended that you create a separate folder for each new project ST Realizer will creates a project rpf file that contains project specific path settings the project s scheme names target hardware information and compiler settings Once you ve defined your project you ll be able to open a new scheme and start designing your application d 13 248 www BDTIC com ST Tutorial Chapter 3 1 Click Project gt New in the cascading menu The Create a New File dialog box opens Create a new file HEI Save In CH Heating F Click here to create a new folder Click here to move up one folder level Type the name of your new project here Save az type Project files rp Cancel File name heating Create a new folder for your tutorial project called Heating by clicking on the new folder icon shown above 2 Once you have created your project folder type
210. r you can choose to fix the processing cycle at a specific number of timer ticks how to do this is described on page 131 For example by default the base clock timer tick is set to 0 01 s 10 milliseconds This means that every 10 milliseconds the hardware timer Timer 1 or Timer A sends an interrupt to the program which increments a tick variable Time related symbols and events use this tick variable either directly or indirectly to evaluate whether their conditions have been satisfied and whether their actions should be executed or not 1 How different types of time related events use the value of the tick to evaluate their conditions is detailed in Section 7 4 3 on page 85 Time related symbols are described in detail in Section 8 4 on page 116 10 248 d www BDTIC com ST Chapter 2 Connecting your Application to the Target Device The concept of the base clock timer tick is an important one because it appears every time we require a time related symbol or event In our tutorial example we demonstrate how to use both time related symbols and timed events We strongly urge you to take the time to complete the tutorial it is a very efficient way to get up to speed in ST Realizer and the time you spend doing the tutorial will be saved later by having increased your productivity 2 8 Connecting your Application to the Target Device All signal inputs to the application are supplied by one or more of the microcontroller s inpu
211. r Supply Symbolic name H W nameDescription HeatinglIsON PB 0 Push pull output Setpoint PC 4 8 bit analog input Temperature PC 5 8 bit analog input 136 248 Comment Pilot LED ON Temperature in 1 10 degrees Celsius Temperature in 1 10 degrees Celsius d www BDTIC com ST Chapter 9 Register connections Viewing and Tracing Generated Messages Symbolic name H W nameDescription Comment ARCP TBOCILRTimerB output compare 1 low rel PumpSpeedControl List of all used peripherals TIMERB settings Prescaler value 1 2 Output level 1 Low Output level 2 High Captl transition Rising Capt2 transition Falling Output Compare 1 Enabled Output Compare 2 Disabled Forced Output Compare 1 Disabled Forced Output Compare 2 Disabled Initialise compare register 1 Initialise compare register 2 PWM Enabled One Pulse Mode Disabled Variable overview Total used bits Total used events Total used unsigned bytes Total used signed bytes Total used unsigned integers Total used signed integers Total used longs Memory overview Total used RAM Total used ROM 000H 100H 63 byte 0080H 0081H gt 00BEH 892 byte EQOOH gt E37BH of FEDER Note Note that if you add up the RAM memory used in the variable overview and compare it with the value shown in the memory overview there is a disparity This is because the Total RAM includes memory for internal variables used by S T Realizer d
212. r double click the line Click OK If you wish to remove the execution conditions from a subscheme Subscheme fromits perform the following Execution Conditions e In any blank area of the subscheme right click the mouse to bring up the following popup menu e Select Execution Conditions The Execution conditions dialog boxfor Leave the current target microcontroller opens Execution conditions It shows at the right side of the window a list of the applied conditions that have been attached to the subscheme Note that more than one condition can have been specified e Select the event to be removed e Click the left arrow e Click OK Mew View i Properties 97 248 www BDTIC com ST Subschemes Execution Conditions and Events Chapter 7 Returning to the Root Scheme from a Subscheme 98 248 Click the subscheme area out of any symbol with the right mouse button A popup menu opens Select Leave ropertes www BDTIC com ST Chapter 7 Table Symbols 7 5 Table Symbols There are two types of data tables that you can include in your scheme as a way of converting or treating data lookup tables and index tables Both of these table symbols are found in the main library under the Table functional category Lookup tables convert input values to output values by matching their values in the table If the input value is not found in the table a default output value is assigne
213. reate a subscheme 1 Double click on the above symbol in the main scheme diagram 2 A window shown below will appear asking if you wish to create the new subscheme Click OK Warming x K The file C Progran Files s T Healizer E amp amples H eatingsFilter ech does not exists Do vau want to create it A new blank scheme will appear SZ 35 248 www BDTIC com ST Tutorial Chapter 3 3 3 10 1 Temperature Acquisition and Filtering The subscheme diagram is as follows Temperature Acquisition Note We will learn to create this Execution conditions box in Section 3 3 12 on page 41 Timed interrupt 0 01 Sec Hierarchical sheet Symbol portin Label identifier used to make the connection between this subscheme and the parent scheme Must be the name of the input pin in the sss 1 symbol that can be found in the main scheme diagram In the example LABEL In Description This symbol is used to connect an input pin of a subscheme symbol sssx y from the parent scheme with the corresponding subscheme This symbol is homologous to the portout symbol which describes an output pin in a subscheme symbol Symbol loopdel Description In other words the output value of this symbol is the value obtained during the previous polling loop This symbol acts as a one loop delay symbol Type of Z type of Z any type from BIT through LONG In the example this symbol is used 4 times this means that temp
214. rial Chapter 3 2 Inthe Available resources list double click the entry PC 4 8 bit analog input and then click OK Now connect the Temperature and HeatinglsON inputs in the same way When you connect port devices the dialog boxes automatically display input or output pins depending on the type of symbol There is no need for you to configure the ports as input or output prior to connecting them However for on chip peripherals such as the Timer B on the ST72212G2 you need to specify some hardware settings before the appropriate resource appears in the dialog box For instructions on how to specify these settings see below 3 3 11 2 Connecting and Specifying Hardware Settings for an On Chip Peripheral To connect the on chip peripheral Timer B proceed as follows 1 Click the Hardware Settings entry in the Project menu or Click the Properties button in the I O Hardware connections dialog box 2 Inthe Hardware settings dialog box click the Timer B tab The Timer B dialog box opens ee ST72212G2 Hardware settings EJ W Enable Prescale divide fi n sl Resolution 1 000 usec Input Capture Output Compare Capt transition Rising W Enable OCMP1 Level Low sl Capt2 transition Falling sl Enable OCMP2 Level High sl Forced output compare 1 Forced output compare 2 v Initialise Compare register Uu One Pulse Mode Iv Initialize Compare register 0100 M DAM UK Cancel 3 Atthe top of the Timer B Dialog box
215. ring general hardware options Memory tab for setting hardware memory options A tab corresponding to each of the target microcontrollers on chip peripherals allowing peripheral settings to be customized For example the ST72212G2 microcontroller hardware settings dialog box shown below has four peripheral setting tabs corresponding to each of its four on chip peripherals Timer A Timer B SPI and Ports fee OT 7221262 Hardware settings x P Frequency Hz 16000000 Slow mode enable M Use the watchdog v Generate a complete Realize Operating System ROS Assembler options D Include files C Program Files5 T RealizerMib stz 2212 inc C Progr e UK Cancel 2 Click the appropriate tab Note There are two circumstances in which you may want to modify the settings in these windows a when you build a new scheme and b when you want to re compile an existing scheme in order to customize how the program will operate when loaded into the microcontroller In the first case you specify new settings or keep default settings in the second case you modify existing settings 62 248 ky www BDTIC com ST Chapter 5 Hardware Configuration 5 3 4 General Hardware Configuration This is the first tab in the dialog box Note Option bytes are not supported From the General tab you can specify 1 The oscillator frequency of the microcontroller Note This frequency is the external frequency The ST7 uses
216. ription of ST Realizer Events 85 DEVICE attribute sssse 207 digin SyMDO Mh EN NOR CPC 80 238 248 Digital input symbol 80 digout svmbol 80 Displaying simulation information 158 Drawings GvpDOortnmg 142 in symbol shapes 178 E Earlier versions of Realizer opening projects from 56 Editing table data 100 EEPROM d enti eite durius irit ennt 65 Environment options 193 Error messages EE 129 eventenable svmbol 80 SE 85 COonfgurinmg 95 description of esseesesssssse 85 input interrupt eseseeeee ss 97 introduction Io 8 introduction to event symbols 9 introduction to execution conditions 8 NMI signal seeseeessssssse 96 periodic eeeseeeeesee 87 95 peripheral interrupts 89 peripheral specific 97 scheduled osnnoonnnenonneeennnnnnennnsnnnnene 87 subscheme input change 95 zs 80 SVImDOILs eiie ede ters 9 85 89 target dependent 96 timed interrupts nnoenneeeenneeenaaennnneenn 88 upon subscheme input change 86 Execution Conditions 8 85 Exporting drawi
217. rning and 2 errors 3 Correct the errors and re compile the application by clicking on Analyse under the Project menu 9 5 Viewing and Tracing Generated Messages The information in the Analyser messages window is saved after you run ST Analyser and can be displayed at any time View Project Options Tools 1 Click Project Eloge or Analyser m Select Analyser messages in the View menu Retest view St Inese athibites The Analyser messages window for the last analysis opens 2 Double click any displayed message to view its origin 9 5 1 Viewing the Analyse and Compile Report Once you have analysed your scheme and compiled your View Project Options Tools program code you can view the report generated by ST Realizer Se during the analysis and compilation process This report provides you with useful information such as the input and output Analyser messages connections you made and gives an overview of how much l i i Refresh view Ctrl F memory is used by the application 8 Invisible attributes To see the report on the View menu click Report An example of an application report is shown on the following pages d 135 248 www BDTIC com ST Viewing and Tracing Generated Messages ST72212G2 Realizing Unit V4 00 Chapter 9 c 1990 98 Actum Solutions Report file of project C Program Files ST Realizer Examples Heating heating rpf Scheme Version 1 00 Report timestamp Analyze results
218. ro parameter list with a reference to a ROM table the number of records in the ROM table and the default value of the table table nrOfrecs defval The tag TABLETYPE can also be used with the value INDEX or LOOKUP to generate an indexed table or a lookup table respectively The TABLE attribute defines the filename of the table 208 248 d www BDTIC com ST Appendix A Variables and Attributes Attribute Types See DEVICE See DEVICE VALUExxxx The values of attributes with the tag VALUE are added after the pin parameters VALUEx x is used to create a constant FAMILY FAMILY ST623 used to identify hardware specific symbols This string is compared with the device string when there is a partial compare the symbol is excepted by the analyzer Ay 209 248 www BDTIC com ST Attribute Types 210 248 Appendix A Variables and Attributes www BDTIC com ST Appendix B Sample Applications Coded Lock Application APPENDIX B SAMPLE APPLICATIONS B1 Coded Lock Application Applications generally include more and more security features These aim to insure data confidentiality access control or identify users Non volatile memory is usually required to store the identification or secret code With the embedded EEPROM provided on the ST6 or ST7 MCU one chip solutions can be developed with the associated cost and density advantages The following example shows a coded lock system that was develop
219. s and outputs Portin Symbol This symbol is used to connect the subscheme symbol pins from the parent scheme with the label gt gt subscheme nets The LABEL attribute is used to make the connection between the subscheme symbol pin and this symbol Portout Symbol This symbol is used to connect the subscheme symbol pins from the parent scheme with the label subscheme nets The LABEL attribute is used to make the connection between the subscheme symbol pin and this symbol Subscheme symbol with x input pins and y output pins The symbol column shows an example of a subscheme n1 with 2 input pins and 1 output pin The SCHEME attribute Out Ze defines the filename of the subscheme portin and portout In SSSX_Y symbols are used to make the connection between the actual subscheme and the pins of the subscheme symbol Several types of subscheme symbols are available in the main library Seel 1 sss1 O0 sss1 1 sss1 2 sss2 1 sss2 2 filename 8 13 Title Symbols The title symbol is used to enter information about the scheme you are working on for archiving purposes Symbol Symbol Name Description Title block used for archiving purposes There are numerous Eng d Projects PF Number 7 0 tevin did o bd Up for to record information about the scheme the circumstances of its creation and the project d 128 248 www BDTIC com ST Chapter 9 Overview 9 ANALYSING AND GENERATING YOUR APPLICATION 9
220. s table data in ASCII text files that have the extension TAB Inserting a Table The Index and Lookup table symbols are named Symbol indextable and lookuptable and are stored in the main library under the Table functional category an SINT table Changing table data Double click inside the table symbol format The Table editor dialog box opens Select the format you want to use from the drop down list in the Radix combo box Click OK Editing table data Double click inside the table symbol The Table editor dialog box opens The figure below shows the lookup table used as an example on the previous page fee Table editor Radix Decimal EB CL ox ow def 100 248 ky www BDTIC com ST Chapter 7 Importing files Into tables Note Table Symbols Double click the cell whose value you want to change To insert a new row click where you want to insert the row then press the Insert key on your keyboard For more rows press Insert again Click OK Note that the Table editor dialog box shows an area for the graphical representation of the table X axis is the input or index axis Y axis is the output axis The smallest Y value is on the bottom border the highest Y value is on the top border the first value is on the left border the last value is on the right border Double click just next to the table The Table editor dialog box opens Click the Import button The Import file dialog box opens
221. s with Probes The Change numeric probe dialog box opens Change numeric probe Radix Decimal B Binar Decimal Octal Cancel 2 Select the appropriate number base from the drop down list and click OK 10 3 9 Viewing Signal Values Graphically To view variable values in graphic form you must attach an Oscilloscope Probe to the appropriate pin or wire Oscilloscope Probes let you view the value of the pin or wire as a graph You can also adjust the top and bottom levels of the Y axis of the displayed graph and the time scale within which the value is displayed To attach an Oscilloscope Probe 1 Select the pin or wire to which you want to attach the probe by clicking on it 2 Click 3 Click where you want the probe to appear The probe is now placed in your pin level drawing or scheme and connected to the pin or wire that you selected ky 153 248 www BDTIC com ST Monitoring Signals with Probes In the example at right we see that the oscilloscope probe has been connected to the an output pin called OCMP1 B in the pin level drawing Note that the oscilloscope probe also shows the name of the pin whose output signal the probe is monitoring SCE hdl 0 Ven m m zou MOSI as OCMP2 A rir V d lx ICAP2 A OCMP1_A Heatingls OH Temperature ICAP1 B Setpoint ChlPi B ICAPZ_B CLEOUT To change the Y axis time scale and time mode of the displayed graph 1
222. scillator The subscheme shown in Figure B20 converts the integer value into 4 bytes that carry the data for the 7 segment displays It is executed only when the input changes Figure B20 Fast Counter Conversion section Convert section Creating the information for each digit pen In E TYPE U BYTE ET evi TYPE LIEYTE Sen ED EE Zei a E T Get Execution conditions Woon sub scheme input change The subscheme shown in E s B21 takes care of the multiplexing of 4 7 segment displays It runs under interrupt control every 10 milliseconds d 226 248 www BDTIC com ST Appendix B Sample Applications Fast Counter Application Figure B21 Fast Counter Display section Display section Oriving the display in multiplexed mode Di B1 B2 EJ Ez Gd Ec Br Digi buacsd pig ui JEE kat than Execution conditions Timed interrupt DU UA Sec 4 227 248 www BDTIC com ST Fast Counter Application Appendix B Sample Applications B4 2 Fast Counter Report File Here is the Report File generated for the sample application discussed in this section ST6260 Realizing Unit V4 00 0 1990 99 Actum Solutions Report file of project C Program Files ST Realizer Examples Fastcnt FastCnt rpf Scheme Version 1 04 Report timestamp Tue May 18 14 06 28 1999 Analyze results No errors C Program FilesNST RealizerNExamplesNFastcntNFastcnt sch Scheme C Program FilesNST Realizer
223. simulate must have its own simulation environment sef file before it can be simulated A simulation environment file contains copies of the project schemes with adjusters and probes added where required You can save and reuse simulation environment files as you can do with any other type of file 10 1 1 Creating a New sef File The first step in simulating your application is to create an associated simulation file Simulation files are based on schemes and are created by ST Simulator To create a new simulation environment file 1 If you are in ST Realizer make sure that the project you wish to simulate is open 2 Click Simulator on the ST Realizer Tools menu ieee Window Help Simulator zn bal Editor Ct L oS T Simulator will open in a separate window Sp rit cvm ky 139 248 www BDTIC com ST Working with Simulation Environment Files Chapter 10 3 In ST Simulator select the Y m e SE cmulatian environment File menu and click New SUE E Open Ctrl O Text In the cascading menu that loss appears select Simulation Save Cre environment Save ae Sawe all Erit EEE Frinter setup Exit Alt F4 The Create a file dialog box opens letting you specify the name of your 296 Sy Heating BINE new simulation aa Main sel environment sef file Create a new file File name Save as Hype Environments sel sl Cancel 4 Type the name of the sef file
224. ssaeeaeeees 209 Type inheritance variables 204 243 248 www BDTIC com ST of a 0 ee 206 overruling variables 205 TYPE attribute ooaaaannnnaanonnnnnnanneennnnnnnnenn 206 U UB ak aa ee SS 203 By 203 UNITTYPE attribute 209 V VALUE attribute 209 Value of a constant symbol 76 Variables zi 203 gFe cm 203 non volatile eesssssss 207 SA 0 estet etna 203 sig EEN 203 type inheritance 204 type overruling sseenesssesneseosnneeeeseeeen 205 UBYT E uirum eui irure i 203 Su 203 WORD 203 244 248 View hidden attributes 83 Viewing simulated signals 151 symbol information 78 W Wires changing attributes 80 OO WAG 79 deleting 000 eee eccecceesesseecesseeesssseeeeesseeees 79 drawing DIOTENEI 78 mirroring eeseseeesee enne 79 LO VITIO coemeterium Men es E EUM EE 79 v tiljem 79 OU NMG NEN 80 Wiring symbols togeiher 78 automatically sssssess 79 1110 D 203 Z ZOOM VIOI 82 www BDT
225. t pins ports or peripheral control registers Similarly the application s final output must also be sent to an output pin or a port In general each ST6 and ST7 microcontroller has a variety of digital and analog input output pins as well as ports for serial or parallel data The number of pins and ports of course depends on the microcontroller in question However peripheral support can vary largely depending on the microcontroller to be used Any application design must obviously bear in mind the resources available on the microcontroller To link inputs and outputs between the application and the microcontroller you must connect pins ports or peripheral control registers to input or output symbols in the application s schemes Note that peripherals must be enabled before they can be used by the application Once enabled each peripheral used must usually be configured to meet the hardware requirements of your application hardware setting dialog boxes are designed for this purpose These hardware settings are used by the ROS to initialize the microcontroller properly 2 9 Application Development Steps Once you have designed your application using ST Healizer you analyse and compile it using ST Analyser oT Analyser performs the following tasks e Analyses your scheme by creating the netlist creating cross references analysing and generating final code Providing no fatal errors are encountered ST Analyser generates a non
226. t of symbols that are copied from these libraries The list of the symbols actually selected constitutes the local library attached to the scheme Note that when you copy a scheme you also copy the attached local library ii Double click the name of the symbol you wish to place or select the symbol by clicking once on it right click the mouse without moving it from the library dialog box and select P ace iii A square box will appear next to the cursor indicating the size and position of the symbol you have chosen Move the cursor to where you want to place the symbol then click once 2 Make a copy of a symbol that a ready exists in the open scheme symbol from the local library heating sch i Click HE i Place A dialog box having the name of the Info open scheme in the title opens It Delete contains a list of all the symbols used in that scheme ii Select the symbol you want to place Click Place You may also double click the name in the list ii Drag and drop the ghost box associated with the symbol down to the new location of the symbol You can obtain information about the symbol by clicking Info prior to placing it Refresh The local library attached to a scheme can be saved for further use For example to enrich the set of symbols available for another scheme To do this click the Save as option in the File menu and specify a lib file type keeping the original name of the scheme As wit
227. th Auto reroute ST Realizer automatically reroutes wires when a symbol is moved 4 To change the color of wires or junctions click the appropriate Edit button and select the new color from the displayed palette 5 Click OK when you have finished d 201 248 www BDTIC com ST Wire Drawing Options 202 248 www BDTIC com ST Chapter 12 Appendix A Variables and Attributes Variable Types and Rules APPENDIX A VARIABLES AND ATTRIBUTES This appendix provides you with quick access to the type of information you ll need when you create ST Realizer applications This information includes e A list of the type of variables you can define and the rules that apply to variables e A list of the attributes you can place on symbols and wires A1 Variable Types and Rules ST Realizer lets you define the following data types Table A1 Data Types ri i a LUS SINT 32768 32767 Signed integer LONG 2147483648 2147483647 Signed long Represents any type except BIT Any except Boolean 1 through 4 Most of the symbols included with ST Realizer support multiple type pins This means that any variable types can be assigned to these pins For example the AND2 symbol can be used as an AND or either two BIT or two UINT variables UINT 0 65535 Unsigned integer S T Realizer handles multiple type variables in two groups e The BIT variables e The UBYTE LONG WORD variables You cannot mix these variable groups for exampl
228. the name of the project heating in the File name field ST Realizer will add the rpf extension automatically Click Save You have just created the heating rpf file in which the main settings related to your project will be recorded at the end of the ST Realizer session They will be used the next time you open the project 3 1 2 Choosing a Target Microcontroller The next step is to choose the ST microcontroller on which the application will be loaded After you create a new project a window will open prompting you to select the target hardware This application is going to be loaded on an ST72212G2 d 14 248 www BDTIC com ST Chapter 3 Tutorial 1 Click the Target Hardware folder in the Select Target Hardware window A browsable list of target hardware devices will appear in the window shown below E Select target hardware EJ No target hardware selected E amp Target hardware devices 4 STE 8 Bit MCU Ej amp y ST 8 Bit MCU H E ST 210 16 Bit Timer SPI STP212 Two 15 Bit Timers SFI SEI z CoU A D Converter SFI PO PS 7221262 Two 15 Bit Timers OK ROM 256 Bytes RAM P SES 341 16 Bit Timer AK ROM 256 Bytes RAM 4 577225 A D Converter Two 15 Bit Timers SPI 12C ST fs s A D Converter Two 15 Bit Timers SFI SCI ST 2338 A D Converter Two 15 Bit Timers SPI GU EEPROM Cancel 2 Find the desired ST microcontroller ST72212G2 by clicking the device icons in the list until the name o
229. the position pointed to by the In input Data In type WORD Ql type Any type BIT LONG See also indextable pitable persistent library only 8 9 Power Management Power management symbols allow you to control the power consumption of the microcontroller by changing between normal slow stopped and wait modes Slow mode symbol Sets the microcontroller clock frequency lower Refer to your target microcontroller s datasheet for information on controlling its clock frequency settings Stop mode symbol Sets the microcontroller to standby Requires a reset or external interrupt to wake up the microcontroller ky 125 248 www BDTIC com ST Constant Symbols Chapter 8 Wait mode symbol Sets the microcontroller to sleep mode The microcontroller can be woken up by any interrupt 8 10 Constant Symbols Constant symbols are useful when you need to compare a signal value to a fixed value Constant bit symbol Values 0 and 1 are allowed OUT type BIT Constant word symbol The value can be specified in the range 2147483648 to 2147483647 Values can be in decimal binary hexidecimal or octal types The value is a decimal value by default OUT type WORD determined by the value specified 8 11 State Machine Symbols otate machine symbols are used to create state machines for the application State machine symbols define and control the progression of the various states of your application Ini
230. the simulation a time of 10 seconds will take 10 seconds This mode is less accurate than the target time mode 10 6 Recording and Reusing Adjuster and Probe Values You can record the values generated by adjusters and read by probes while a simulation is being run ST Realizer records this information in Log files This information can be useful for viewing the exact adjuster and probe values at any given time during the simulation You can view log file information by opening the log file in any word processor application 160 248 ky www BDTIC com ST Chapter 10 Recording and Reusing Adjuster and Probe Values The format of log files is as follows These are the adjuster and probe names Time Start Voltage Current MaxCurrent Charge time Ready BusyHigh High BusyLow Low Ready Oscillator 5 1 9 10 100 0 Ready 0 00000 9 1 9 10 100 0 High 0 1 0 1 0 0 15 1 9 10 100 0 Low 1 O 0 1 0 0 22 1 9 10 100 38000 Low 0 1 1 0 0 0 These are the adjuster and probe values that were 112 1 9 10 100 2999 Low 0 1 1 0 0 50 read each time a value 209 1 9 10 100 2998 Low 0 1 1 0 0 49 changed 306 1 9 10 100 2997 Low 0 1 1 0 0 48 You can also reuse recorded adjuster values in subsequent simulations in order to recreate identical conditions 10 6 13 Recording Adjuster and Probe Values 1 Before running the simulation whose values you want to record on the Options menu
231. tial state symbol in a state machine Every state machine must have one and only one stateinit symbol stateinit This symbol can only be connected to condition or state symbols When in the persistent non volatile library this symbol named pstateinit shows an M in its design pstateinit d 126 248 www BDTIC com ST Chapter 8 State Machine Symbols State symbol used within a state machine Can be used in conjunction with a stateout symbol within a scheme See also stateout The state symbol can only be connected to condition state or stateinit symbols within a state machine Condition function symbol for state machines This symbol can only be connected to state or stateinit symbols in state machines The NAME attribute is used to make a connection with a statein symbol in schemes See also state State input symbol This symbol connects a BIT variable to a condition symbol within a state machine The connection is performed by assigning the condition and statein symbols the same name In type BIT State output symbol This symbol extracts a state from a state machine and converts it to a BIT variable The connection is performed by assigning the state and stateout symbols the same name See also state Out type BIT d 127 248 www BDTIC com ST Hierarchical Sheet Symbols Chapter 8 8 12 Hierarchical Sheet Symbols Hierarchical sheet symbols are used to represents subschemes and their input
232. tly what their name implies additional schemes that are subservient to the root scheme Their appearance is similar to the root scheme in that they also contain symbols and wires However subschemes exist apart from the root scheme and are only executed when called upon via a subscheme symbol in the root scheme As previously discussed there are three reasons to create a subscheme e To include complex portions of the main loop thus saving space in the root scheme and making it easier to reuse processes In this case the subscheme is executed as if it were a part of the main loop e To include parts of the application that are event driven Events can never be placed in the root scheme Subschemes can be assigned either a single execution condition which will apply to the entire subscheme or alternatively can include any number of event symbols More will be said about execution conditions and events shortly e To save functional parts of your application analogous to subroutines that you may wish to reuse in other applications Subschemes are saved in their own files sch files and can be easily copied to other ST Realizer projects and reused You may also save customized subschemes symbols to a library to be accessible by all projects Subscheme symbols are described below Designing a subscheme is no different than designing an ordinary scheme with one exception a subscheme has connections to its root scheme via a subscheme
233. to 4 above If you find that the symbol is too small and you want to zoom in on it click aQ then select the area around your symbol If you make a mistake and can no longer see your symbol click Li to see the whole scheme then reuse e to zoom in on your symbol Now you are ready to place the first condition the Setup Time condition that is activated for the first time when the start button is pressed Active conditions are signalled by sending the value 1 a signal value equal to 0 indicates that the condition is not active 3 2 5 2 Placing a Condition To place the Start condition 1 Inthe main library dialog box under the category State machine scroll down the list until you find condition then double click it 2 Move the cursor to where you want to place the symbol i e to the right of the stateinit symbol as shown in the diagram below then click 3 The Edit the value dialog box opens Type SetupTime in the field then click OK Your scheme should now look like this SetupTime If it doesn t select the incorrect symbol by clicking next to it then delete it by pressing the Delete button on your keyboard and redo steps 1 to 3 above d 20 248 www BDTIC com ST Chapter 3 Tutorial You are now going to wire the initial state and the SetupTime condition together This forms a logical link between the two symbols All symbols have pins to which you connect wires 3 2 5 3 Wiring Symbols To wire
234. to Digital Converter ADC is to decode keys through one I O port pin The keys are connected to the converter input using a resistive voltage divider This method is useful since it only requires one I O pin whereas a traditional matrix keyboard requires a high number of I O pins B2 1 Application Overview The basic circuit of the decoder consists of a pull up resistor connected to the ADC input with the first key directly switching to ground The following keys are then connected in sequence to the ADC input through serial resistors The combination of the pull up resistor the serial resistors and the pressed key form a resistive voltage divider Figure B6 Figure B6 Analog Keyboard Resistor Key Matrix When a key is pressed the voltage at the ADC input is given by the activated voltage divider generating a different voltage at the ADC input for each key that is pressed If the top key is pressed the voltage measured is zero while the default voltage at the ADC input if no key is pressed is Vdd This analog voltage is converted by the ADC and the digital output value is used to determine which switch is closed If more than one key is pressed at the same time the key detected is the key in the chain closest to the ADC input This allows the keys in the keyboard to be prioritized Figure B7 215 248 4 www BDTIC com ST Analog Multiple Key Decoder Appendix B Sample Applications Figure B7 Multiple Key Press Dependin
235. type values Z NOT A OR B OR C OR D OR E OR F OR G OR Hi Two value binary OR function symbol with type inheritance Z AORB A type Any type BIT LONG B type Any type BIT LONG Z type The largest A or B type Note ORing a BIT type value and a WORD type value is not allowed O Ul ZS et S S D E F G H Three value binary OR function symbol only applicable to BIT type values A Z A ORBORC B sl a Four value binary OR function symbol only applicable A to BIT type values Z A ORB ORC ORD B A x L 114 248 Kr www BDTIC com ST Chapter 8 Logic Symbols Symbol Six value binary OR function symbol only applicable to BIT type values Z A ORB ORC OR DORE ORF n m Oo zx Ex I I o nm Oo gt ES s Rising Edge Detector Symbol A rising edge on input causes an output pulse to be generated In type BIT Out type BIT Set reset Flip flop Symbol A high level on S causes output Q to be set to 1 Q 0 Eight value binary OR function symbol only applicable to BIT type values Z A OR B OR C OR D OR E OR F OR G ORH 2 UI A high level on R causes output Q to be set to 0 Q 1 All types BIT When in the persistent non volatile library this symbol R 5 named psrff shows an M in its design Si 115 248 www BDTIC com ST Time Related Symbols Chapter 8 8 4 Time Related Symbols Time related symbols perform functions where the concept of time is required Th
236. u design your application When you have finished working on a scheme remember to save your work You can export schemes in the Windows metafile WMF format so that you can import them into drawing or word processing packages This section describes how to create a new scheme open an existing scheme and save your work 6 2 Creating a New Scheme When you create a new project an empty root scheme is created by default taking the same name as the project For example if you created a new project called Heating rpf the root scheme called heating sch will be created by default 3 Project heating E Ins heating sch SS Libraries E y Target hardware A default root scheme is m ST7221282 automatically created by pay ST Realizer for each new project ON Tip If you wish to change the root scheme right click on the scheme in the schematics folder and select Change root schematic You will then z be prompted to select by browsing the new scheme which will become the new root scheme for the project 6 2 1 Opening the Root Scheme The root or main scheme is the sheet on which you design the main part of your application and is created by ST Realizer when you create a new project To open the root scheme e In the Project Viewer shown above double click the root scheme for example heating sch as shown above located under the Schematics folder ky 67 248 www BDTIC com ST Creating a
237. ue of the timer tick at 0 01 seconds When you start running your application the default timer Timer 1 or Timer A will count out the number of ticks each tick being equal to 0 01 s At the beginning of the second main loop cycle the total number of timer ticks that have elapsed during the first main loop cycle is recorded i e the number of elapsed timer ticks is written to a variable called rtick This recorded value is used to evaluate all 1 Some time related events use the timer tick differently to evaluate elapsed time more precisely For more information refer to Timed interrupts on page 88 132 248 Af www BDTIC com ST Chapter 9 Executing the Analysis and Compile second main loop cycle Simultaneously the timer resets and begins counting the number of ticks that elapse during the running of the second main loop cycle At the beginning of the third main loop cycle the number of timer ticks that have elapsed during the running of the second main loop cycle is recorded and this recorded value is used during the execution of the third main loop cycle If you choose to fix the processing cycle time the number of timer ticks elapsed during each main loop cycle remains constant i Tip Please note that there is one golden rule when it comes to timers the quantity nii of time that you are measuring either using a timer symbol or a periodic event must be substantially greater than one tick Because these time rel
238. um value has to be anticipated For example the Hours Modulo 24 counter is reset if the two following conditions occur contents equal 23 and input clock transition In parallel the resulting Reset signal is issued as output clock to increment the next stage as shown in Figure B12 in the case of a Modulo 5 counter Figure B12 Clock synchronism principle CLKout Each Modulo N block is based on a Counter component provided within the ST Realizer standard library This symbol presents the advantage of generating a numeric variable as 222 248 Ky www BDTIC com ST Appendix B Sample Applications Clock Design output This means that any numeric or arithmetic operation can be directly performed on that variable without modifying its binary representation The detection of the maximum value is achieved with a comparator symbol The comparator output is entered into the feedback loop at the falling edge of the input clock This avoids any parasitic Reset during the High level of the input clock when the comparator output switches to High level In parallel the counter incrementation is prevented by forcing the Up input of the counter to Low level Finally each Unit Counter is represented in the ST Realizer environment as shown in the Figure B13 Figure B13 Unit Counter Description G CKi ds CKin 5 n in a Der mes Z init 0 type bit B s gt CKout Figure B14 Current Time Counter Waveforms B3 8 Curre
239. unning or not Recall that we included a Pilot LED that would turn on when the heating came on By connecting a Numeric Probe which lets you view the value of the output in the Binary Decimal Hexadecimal and Octal number bases to the HeatingISON pin we can view whether the LED is ON voltage 5 0 V or OFF voltage 0 0 V To connect the numeric probe proceed as follows cook Select the output pin called HeatinglsON Click N 3 Click where you want the Numeric Probe to appear i e close to HeatinglsON n addition to seeing if the heat pump is running or not we would also like to see its power rating In our application recall that the pump s power is directly proportional to the positive temperature differential between the actual temperature and the setpoint temperature To view the input power to the heat pump we can attach an Oscilloscope Probe which allows you view the value of the output as a graph 1 Select the Timer B output pin called OCMP1 B 2 Select the Oscilloscope Probe by clicking on the toolbar 3 Place the probe where you wish it to appear Your pin level diagram should now look something like the diagram at right MIS UO Once the Oscilloscope Probe is uuu placed you need to set the variable or display range as 0 to 5 and the SERRE D display time to 0 001 s meaning that the Y axis on the graph displayed in the oscillator probe will start at O V and end at 5 V and the X axis Ti
240. ur application code In each application you create you must have a root or main scheme This is the scheme which contains the main body of your application the core of the program which controls the sequential running of the application In addition to the root scheme most applications also include subschemes that represent specific processing in your application Subschemes usually contain those actions which must be performed in addition and sometimes conditionally to the actions in the root scheme In particular subschemes may be connected to events such as timer interrupts periodic events hardware external input changes and peripheral operation Subschemes can also be used to mask more complex operations so that they do not clutter the root scheme 7 2 Symbols oymbols are the basic building blocks used to create an application with ST Realizer In essence each symbol is a graphical representation of a portion of assembler code usually representing a function or a short subroutine Symbols can represent many coded entities such as mathematical logical conversion and power management functions constants tables subschemes hierarchical sheets states input devices output devices and sequential counted or time related events The main symbol library in ST Realizer see Chapter 8 on page 103 encompasses all of the main functions required in assembler code and should you need a very specialized symbol for your applicati
241. ute results in the following macro call extensions If the TIME attribute exists time Itime timer Itimer tick Ttick If the TIMEPIN attribute exists timer I timer tick Ttick Examples timf timv symbols DEVICE MICROSEC is used to create a micro second delay using timebase with the attribute TIMEBASE x DEVICE COUNTER which extends the macro argument list with an additional variable and its type This variable is used as an internal variable the counter value The type of the internal variable is defined by the COUNTPIN x attribute where x a pin number Examples countf countv symbols DEVICE SHIFT which extends the macro argument list with an additional variable and its type This variable is used as an internal variable the shift value The type of the internal variable is defined by the SHIFTPIN x attribute where x a pin number Example shift symbol ICODE Defines a macro that is executed once before the main program loop is executed to initialise the symbol s properties Enter the macro name preceded by i in the Value field LABEL Used to link two wires by means of a name or to name an object NAME See DEVICE OCODE Defines a macro that is executed at the end of the execution loop Enter the macro name preceded by o in the Value field SCHEME Subscheme attribute specifies the name of the file sch associated with the subscheme SHIFT PIN see DEVICE TABLE Extends the mac
242. ution Condition to a Subscheme Subschemes Execution Conditions and Events You may always add subscheme symbols to the root scheme even before you have created the subschemes themselves For example you could place the subscheme symbol name it using the same name you intend to give the subscheme file Then to create the subscheme all you need to do is double click the subscheme symbol A warning message will display 3 The file C reale3 Heatingsssname sch does not exists Do wou want to create t Click Yes A new scheme window will be opened and you can begin drawing your subscheme To open a subscheme whilst in the root scheme e Double click its symbol in the scheme To open a subscheme from the Project Viewer e Click on the name of the subscheme under the Schematics folder To assign an execution condition to a subscheme you must be in the subscheme e n any blank area of the subscheme right click the mouse to bring up the following popup menu e Select Execution conditions The Execution conditions dialog box for Leave the current target microcontroller opens Execution conditions ST72212G2 in the example shown below It shows the list of events that can occur during the main loop execution and cause a specific action to be performed namely the execution of the code generated by the subscheme This list depends on the target microcontroller and also which peripherals on the microcontr
243. vents are independent of the main loop i e each event is triggered by a value that is augmented incrementally with the base clock timer tick If both events occur simultaneously the event symbol closest to the upper left hand corner of the subscheme will be treated first Event types that may never be placed together in the same subscheme e More than one timed interrupt e A periodic event and a timed interrupt e A periodic event and a peripheral interrupt e An upon subscheme input change event and a timed interrupt e An upon subscheme input change event and a peripheral interrupt Note If any of the above event types are placed separate event symbols in the same subscheme an error message will result when you run ST Analyser Compatibilities between Events and Time Related Symbols e Periodic events and time related symbols are completely compatible because they both count elapsed time in an identical manner ky 91 248 www BDTIC com ST Subschemes Execution Conditions and Events Chapter 7 7 4 7 Subscheme Operations In the remainder of this section we will describe how to create a subscheme and assign execution conditions to tt Creating a Subscheme Connecting a subscheme to a symbol in the root scheme 92 248 You can create your subscheme just a you would create a new scheme refer to Section 6 2 2 on page 68 Once you have opened the new scheme window design your subscheme with these guidelines
244. w to place symbols e How to edit symbols e What the principal symbols do and when to use them e How to connect the pins e How to handle events The schemes associated with the application include symbols that describe A State Machine diagram e Conditions that is conditions that are transmitted to the application from external sources such as temperature records or that are internally determined for example when the ky 17 248 www BDTIC com ST Tutorial Chapter 3 system switches to a specific state e Actions that is actions that are output from the application such as putting on the pilot LED or actions that are internally determined for example those resulting from a timer interrupt The following section will explain how to draw the heating application using symbols fulfilling the above roles 3 2 5 The State Machine Diagram Each time a condition changes as a result of the signals received from the microcontroller input pins the state machine selects the appropriate state The state defines the signals that are sent to the microcontroller output pins The overall management of the heating control system is carried out by a simple state machine with four states nit HeatingOFF HeatingON and Pump Enabled SetupTime Start SetPump and Stop conditions trigger state transitions A specific action is associated with each state The following table summarizes the relationship between events or inputs
245. will be stored in this library file accessible to all projects I Tip When you save a scheme as a library you will copy all of the symbols in that Uc scheme to the library Therefore to save only new subscheme symbols you have created to a library they need to be in a scheme by themselves a 7 Exit without saving the project in which you have created and modified you new subscheme symbols If you save the project all of the modifications you made to your new subscheme symbols to apply to the project you performed them in Now each time you wish to use your subscheme symbol s in a new project simply open the library file you created and select and place the symbols as you would normally do from any other symbol library 170 248 d www BDTIC com ST Chapter 11 Defining a New User Defined Symbol 11 4 Defining a New User Defined Symbol You can use the symbol editor to create your own symbol using the User Defined symbol option Note Defining a new user defined symbol will require programming ability in the assembler language There are four steps in creating a new user defined symbol e The definition of the graphic aspect of the symbol including assigning the required number of input and output pins naming these pins and assigning pin data types and attributes e Editing the new symbol to further refine its appearance e The creation of an assembler macro header essentially the declaration lin
246. y create a new subscheme symbol 1 Open the Symbol Editor fee Select the symbol properties E3 Symbol name lass Select a symbol Sub scheme symbol C User defined symbol Select a shape Rectangle C Circle Number of input pins j Number of output pins Cancel 2 Give the new subscheme symbol a name An sssx y type name is recommended to be consistent with standard subscheme names that can be found in the main symbol library An sssx y subscheme has x inputs and y outputs 166 248 ky www BDTIC com ST Chapter 11 3 Click the Sub scheme symbol radio button Note Defining a New Subscheme Symbol 4 Select the shape you which to assign to the symbol The shape of the symbol can be either rectangular or circular The shape of the symbol represents but does not affect the process that is behind it Symbol shapes should not cross the square box in the ST Symbol Editor window this represents the physical limits of the symbol 5 Specify the number of input and output pins li Tip d All of the above options can be modified later using the Symbol Editor 6 Click the Next button A new dialog box opens where you specify labels for the subscheme input pins bes Select the input pin properties x Fin 1 Label In Pin 2 Label In2 Pin 3 Label Jing Back Next gt Click Next when you ve finished 167 248 www BDTIC com ST Defining a
247. y the sequencing control module Data can be written Clock activated to a D Latch only if the active mode is Secret code entry and if the received bit corresponds to this location Figure B4 The clock is generated through an AND function between the Secret code entry mode and the ranking of the received digit This ranking is issued by the counter used for serial flow reception Figure B4 Digit Storage in EEPROM Digit Value To 2nd and 3rd EEPROM storage Secret Code Entry amp St 1st Digit EEPROM B1 5 Access Code Entry and Recognition The digits are received serially as in the Secret code entry mode and stored in Volatile Memory locations RAM The RAM locations are described with standard D Latch symbols The input output of this component are exactly the same as for the non volatile components allowing a clear analogy between the functional description of the two modules The data input channel is the same while the clocks are logically validated except if the Secret code entry mode is activated Figure B5 Figure B5 Digit Management for Code Recognition Digit Value To 2nd and 3rd digit stage Secret Code Entry 1st Digit Code recognition is performed by a one to one comparison between the values stored in EEPROM and RAM 214 248 Ky www BDTIC com ST Appendix B Sample Applications Analog Multiple Key Decoder B2 Analog Multiple Key Decoder One of the main uses of the ST on chip Analog
248. ymbols are there They will not include details on how to place edit and wire the symbols that are there Table 2 shows a summary of the editing functions that you can use to create the remaining diagrams Table 2 Summary of Editing Functions To do this Do this Select a symbol Choose the select mode by clicking on the toolbar Keeping the left mouse button pressed drag a box around the symbol or click near the symbol with the left mouse button Move a symbol Select the symbol then drag and drop it where you want to place it Copy a symbol Select the symbol Click qt on the toolbar Click where you want to place the copy Change the name of a symbol Double click the name that is currently displayed with the symbol The Edit the Value dialog box opens Type the new name Click OK d 25 248 www BDTIC com ST Tutorial Chapter 3 To do this Do this Delete a symbol Select the object Press the Delete key on your keyboard Wire two symbols together Select the wiring mode by clicking Se Place the cursor next to the output pin on the first symbol A crosshair snaps onto the pin when it comes into snapping distance Move the cursor to the appropriate pin of the other symbol This is an input pin Click when the crosshair is snapped onto the symbol s pin The two places where you clicked are now connected by a wire Click the right mouse button or press the ESC key to finish wiring 3 3 Completing the
249. ype BIT LONG B type Any type BIT LONG Z type The largest A or B type Note NANDing a BIT type value and a WORD type value is not allowed Three value binary NOT AND function symbol only applicable to BIT type values Z NOT A AND B AND C Four value binary NOT AND function symbol only applicable to BIT type values Z NOT A AND B AND C AND D 111 248 www BDTIC com ST Logic Symbols Chapter 8 Six value binary NOT AND function symbol only applicable to BIT type values Z NOT A AND B AND C AND D AND E AND F Eight value binary NOT AND function symbol only applicable to BIT type values Z NOT A AND B AND C AND D AND E AND F AND G AND H Two value binary NOT OR function symbol with type inheritance Z NOT A OR B A type Any type BIT LONG B type Any type BIT LONG Z type The largest A or B type Note NORing a BIT type value and a WORD type value is not allowed 112 248 d www BDTIC com ST Chapter 8 Logic Symbols Three value binary NOT OR function symbol only applicable to BIT type values Z NOT A OR B OR C Four value binary NOT OR function symbol only applicable to BIT type values Z NOT A OR B OR C OR D Six value binary NOT OR function symbol only applicable to BIT type values Z NOT A OR B OR C OR D OR E OR F 113 248 ky www BDTIC com ST Logic Symbols Chapter 8 Eight value binary NOT OR function symbol only applicable to BIT
Download Pdf Manuals
Related Search
Related Contents
DVR-3064 Mobile Vehicle Video Recorder Note on Using Multi-Function Timer Pulse Unit 3 (MTU3) MANUEL D`INSTRUCTIONS Von Manualen zu virtuellen Bibliotheken: Eine Aerocool Strike X ONE Anleitung NEU SC4plus SC4pro JCM Page 1 Page 2 はじめに ドサトロンの作動の仕方について 給水ラインに Copyright © All rights reserved.
Failed to retrieve file