Home
ST-Realizer ® II USER MANUAL Release 1.1
Contents
1. 103 124 probe values 103 124 simulation information 122 Report analyse and compile 99 file example 192 DANING o rente cS US 102 Requirements hardware iiec easet bitu ot 9 SOW AES race hector Sead ete tas Gh endende 9 Reusing adjuster values 103 124 probe values 103 124 ge 31 Root scheme I trOgU HOP TO nter etie ee reden 15 FO OD 29 RTICK variable Variables ANOK EE 30 Running the simulation 122 S Saving eec rhom a eA 23 anc 35 simulation environment file 105 Sidi crm 167 Scheduled event sss 53 SCHEME attribute sssss 172 SCHEMES eiee A A 15 AnaS NO ER N 93 erige e 33 creating subschemes 34 IFO GUGTIO NO RTT DE NM EN 15 OPENING eec 35 placing symbols sssss 38 placing TSS M aco ot ttn 50 FITTING eee PE 49 OOL SCIIOITIO ounces esci M dpa ded 15 SAVING ER RE ET 35 SMUAIN G eerie 103 subschemes uolui dp pese a op Nb iue 15 viewing options eeeeeeeee 48 WORKING Tl acaiitiqs tp cubat eite 48 Screen Preferences nisana 158 Setting numeric adjuster options
2. Ce ep eee ee ae ese 46 67 0 9 LAMP NN ae ti NEED 82 Analog to digital 46 cH E 71 Igor EN ete 2 71 zor HE 72 zo T 72 ELE e antedios tar te eek ee een e doubt 72 attaching attributes 146 attributes eding xossmistebotm uu epe abdo A E REGOLE 41 average einoka a Nie NIE 82 eji ce 85 DUNDACK NE RERO 86 virgo M T 72 CONO e 86 COMI Moscs A 91 connecting to target hardware device 46 CONST T A 90 CONSID aro erent naret eeeeereee 90 COM SIV auta Mam tosta te da 90 COMVGISION sacot sessi eem ato ene ln aed 85 CONV Cll oaeee Qin nea ix verear m EIE 86 COUTET x uoo eH abiecta pe debe h hate 84 COUNT IDCOLDPIG oett hr i v ete 84 COUNTV pcountv essesesese 85 creating your OWN seeeeee 129 defining a new subscheme symbol 130 defining new user defined symbols 135 deleting s pode iile esae titt 41 defann 80 dello erroa 80 9 21 6 9 Renee oe E E 80 8 bY Rie eee ete mee Ine ne te ee Pee eRe 80 6 21h 19 PNE ERN 81 e 19 ERR ERU ERREUR TEN CERRERORON 81 dik PaM Pr Rr URN 73 CITIS CIE ce dom tr EE ral 73 CUT SRE nile centixu testa utu aUas 82 donasin TED 46 67 GIG OUI E eub E 46 67 Cc bM MAU ML LE 82 dato Mareea OMEN 73 drawing shapes in 142 206 209 COC aeea 79 OVE eaaa aa ae 46 68 eventenable eeen 46 68 hierarchical
3. 66 209 Chapter 6 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 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 Chapter 7 Input and Output Symbols 7 THEMAIN 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 Sequential Logic Time re
4. 109 numeric adjuster values 108 square wave adjuster values 114 time table adjuster values 110 HD 61d a Eon osos tete Qu ent 49 Simulated signals FIOM ONIN G eie Y 115 LV 11 711 eei een eee ee tuf 115 Simulating your application 103 Simulation adus tO S used disces ortus vm t RS debt 106 displaying information 122 environment file CRE AUG PERI E 103 ODE DING PNE TURO MORTEM 105 SAVING succi M mra dise ive RE Ded 105 Tauireutjlare eee 122 I DUE Valle soie totns rad tmd esc indes 106 DODES POTETE 115 recording sicer 122 recording and reusing adjuster and probe values 124 recording information 122 FUD ODIHOTIS sonnigen edo te Deiode 122 PUANIN ptt 122 starting and stopping 122 Sine wave adjusters sssse 112 SIN ec E 167 Software requirements sussse 9 Specifying the Target Hardware Device 25 Square wave adjusters 114 SSSD g SVITIDOL ioi ate bn ole dod es 58 57 STO eia A RO esas 25 ST6 users NOIE TO san apeeren tener re e Sactatut i epu ner 25 Ipae X 20 ST AnalySQl ies Ure te tita dist alitiodes s 93 error messages e a 93 State NSOV NIST uoc uia tia tees 121 orate mache soseta copie teet aloe PD RUE 120 State machine probes UL AG INN p
5. 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 ARCP Controlling 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 EE 116 209 kyy Chapter 9 Monitoring Signals with Probes The Change numeric probe dialog box opens E Change numeric probe Radix Decimal Decimal Hexadecimal Octal 2 Select the appropriate number base from the drop down list and click OK 9 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 Se
6. J lt 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 O 0 1 Input value 1 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 type 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 75 209 Logic Symbols Chapter 7 Six value binary NOT AND function symbol only A applicable to BIT type values Z NOT A AND B AND C AND D AND E AND F Db amp L E E Eight value binary NOT AND function symbol only A applicable to BIT type values Z NOT A AND B AND C AND D AND E AND F AND G B AND H s cM A nand8 E F 5 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 5 76 209 Chapter 7 Logic Symbols Three value binary NOT
7. fal C Program Files ST Realizer E xamples Heating heating sch Root 1320 0000 STG265C 4K ROM 128 bytes RAM 5 2 2 Creating Subschemes and other Schemes 1 Click O 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 vi Tip A new subscheme will not appear under the Schematics list in the Project aaa E c 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 58 If the new scheme is not a subscheme it can only be connected to the project if it is declared as the root scheme 34 209 lt Chapter 5 Opening a Scheme 5 3 Opening a Scheme 1 Click im You may also click File 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 i Tip To open a scheme you ve used recently click its name at the bottom of the File uc ui ee menu em 5 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
8. 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 ST 7221262 Hardware settings Frequency Hz 16000000 Slow made enable v Use the watchdog v Generate a complete Realizer Operating System ROS Assembler options BE Include files C Program FilessS T RealizerMibsstz2212 inc C Progr LK 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 28 209 A3 Chapter 4 Hardware Configuration 4 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 a internal frequency which is half the external frequency Fi Fg 4 2 2 Whether or not the Watchdog f
9. LDI DDRA 00FH ADI ORA 000H LDI DRA OOFH LDI BUDRA OOFH EOL DDRB O0CSH LDI ORB 004H GOT DRB OCSH LDr BUDRB QCSH EDT DIDECUICH LDI ORC 000H LOT DRCOTCH 4 194 209 Appendix B Sample Applications LDI BUDRC OICH Rtcinit LDI PSC 015H LDI TCR OCFH LDI TSCR O06DH CLR I LDI IOR IOR MASK REDI RamInit LOK LDI A0 LDI X 000H LDI Y RamInit LD X INC X DEC Y JRNZ RamiInitl iconstw vlin7 2 4 l1cOnstb X2nm45 9 105440 pdlochwbuww v20l0 4 2V2Dll2 2054 2109425070 LCOnStw vOr202 10 LCOMS iw Von Zo LOO lconstw vsnls 4 1000 JE BESOSOITII LDI IOR IOR_MASK oO Oaks BYTE OOOH BYTE O7EH BYTE OO1H BYTE 030H BYTE 002H BYTE O6DH BYTE 003H BYTE 079H BYTE 004H BYTE 33H BYTE 005H BYTE 05BH S BYTE 006H BYTE O1FH EISOSQLLs RealMain RtC Lb AUTOR CLR TICK LDI IOR IOR MASK LD RTICK A RT IMEND LD A RTICK ky 2 0 1 A O10H O10H Fast Counter Application 195 209 Fast Counter Application JRNZ IRTCOO0023 JP RTCSKIP TRTCOOU 3 Decrement 16 bit timers JRS 7 03 rH RTCO0O003 s b2www 097 H 4 RIICK 2 037H 4 EICODOSS RTCSKIP RINPEND moved to TIMERI interrupt CALL SUBOO002 LDI IOR IOR MASK copyww y2n9 4 v0n5 4 LDI IOR IOR MASK O10H moved to PORTB interrupt CALL SUBOO002 check for time out JRR 7 AT00001 UNIOOO0 LI ATCOOUOOlS0 EDT ATOOOOLlXIl 4 3 CALL SUBO0O001 UNI0000 Input
10. The user is prompted for the symbolic name Ol The connection is made to a physical micro controller pin and is invisible En type Boolean When true the physical output is written 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 outputsequence z 70 209 Chapter 7 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 wal MAME waitsequence En type Boolean When true the physical input is En VV dut continuously read until the physical value equals the Val Comment 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 7 3 Logic Symbols Logic symbols perform logical functions essential to most programs With these functions you can control a program s path
11. To save a scheme under a new name 1 Click Save asin 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 158 for further details ON J 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 directory of the project but you will have to open it manually if does not appear in the Project Viewer 35 209 lt Saving Schemes 36 209 Chapter 5 Chapter 6 Schemes and their Components 6 BUILDING SCHEMES 6 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 your application code In each application you create you must have a root or main scheme his 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 als
12. ky 3 209 Table of Contents 4 2 2 Changing the Target Microcontroller usns 27 4 3 Hardware Configuration aaaea aae e 28 4 3 8 Accessing Hardware Settings Dialog Boxes 28 4 3 4 General Hardware Configuration 0 0 0 0 cee eee eee 29 4 3 5 Memory Configuration aa eae 31 4 3 6 X Enabling Peripherals llle 32 5 CREATING OPENING SAVING SCHEMES else 33 Ol OCNeCMNGS eed baked hot ese reae eth ee nee eet eee an eee anes 33 5 2 Creating a New Scheme llle tenes 33 5 2 1 Opening the Root Scheme 0 0 0 eee 33 5 2 2 Creating Subschemes and other Schemes 34 5 3 Opening a Scheme wi xotg idco Dee EI oe bo Rs a AOR RE RY DR Dee 35 5 4 Saving Schemes a E a rh nns 35 6 BUILDING SCHEMES 5 3939 ataca aux Rd ade Gu ewe m et Rae tease 37 6 1 Schemes and their Components 0 aaea ee eee 37 612 OYIMDOIS feiss diel ee a eee Soe ee eee ee ee oh os 37 6 2 1 Placing and Controlling Symbols 0000 eee 38 6 2 2 Wiring Symbols Together and Connecting Application Inputs Outputs ces dnc wu Lowes dus Gadd Cane 9 E 9 eO aw anes bees 44 6 9 Working in SCHEMES i ges dex ur LR oe C GR Oe ode a oR te ade 48 6 4 Subschemes Execution Conditions and Events llus 51 6 4 8 Description of ST Realizer Events 0 0000 c eae 51 644
13. 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 4 154 209 Chapter 10 Defining a New User Defined Symbol endif if tData eq TSBYTE or tData eq TSINT clr A push CC bittjf Data 7 G 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 10 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 and 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 151 either to your newly created library file
14. 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 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 136 209 ky Chapter 10 Defining a New User Defined Symbol l Tip All of the above options can be modified later using the Symbol Editor 6 Click the Next button 7 Anew dialog box opens for you to specify the input pin data types fee Select the input pin properties Pin 1 Label Data Type WORD Input Fin 2 Label Clock Type BIT Clock In 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 137 209 lt Defining a New User Defined Symbol Chapter 10 For a pin A this value Choose this data type 0 or 1 Bit BIT 32768 to 32767 2147483648 to 2147483647
15. Execution Gondllioflis 23 eC REGE exa e Rees 55 645 EventSymbolS se dud dese er Rcx or Sede dX XAR RU RARO 55 6 4 6 Compatibilities Between Types of Events and Certain Symbols 57 6 4 7 Subscheme Operations 0 0 0 ee ees 58 6 5 Table Symbol s3 4 wa whee thee ARS au een owe Ghee ee Sted 64 7 THE MAIN SYMBOL LIBRARY 00 00 cece eee ees 67 7 1 Input and Output SyimbolS 222 255 d02d00506466 068494 dee Swe e des 67 2 Sequential Symbols 244445468 ote Saeed ee peed koa pee ES ERE YE 69 Yon LOGIC SY MDOlS use mic eee RE RE EAHER ERRORES E ROLE ESO WEIT guicarie ric 71 7 4 Time Related Symbols clle 80 7 5 Mathematical Symbols scele 82 76 0 hter SY MOONS aen deg e M rer debis Sepe eed ce Bde eed eed eet GD be ere 84 1 Qonversiom Symbols xe acce reco ER pee NO M ERE eee ee eee se 85 78 Table Symbols 2h ua dat opo eel Doc REOR OS UL IOS see Bees 88 4 209 Table of Contents 7 9 Power Management eee hrs 89 LAO Constant SYMBOLS i43 uci urd Geom cR a DLS Rol EGE cE eee OS SS 90 7 11 State Machine Symbols 0 0 0 eee ees 90 7 12 Hierarchical Sheet Symbols 0 ccc eee 92 PAO PIE SymbolS fe bette tea d aoc nt d toc A ad Sneed e aee bod et 92 ANALYSING AND GENERATING YOUR APPLICATION 93 oT OVOIVIOW 4 22 5 8 ome aceite M32 acm dee MIRA 24 odo Me do cdd Mte od oed eae ei amp 93 8 2 Changing the C
16. 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 amp B I MJ gt S CHin CKin d MENS Lp A Init gt gt amp z init type bit B CKout Figure B14 Current Time Counter Waveforms B3 8 Current 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 187 209 Clock Design Appendix B Sample Applications Figure B15 Current Time Setup with a Duplicated Clock Setu intt 0 tvpe bhit 3 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
17. 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 shows an M in its design 5 84 209 Chapter 7 Conversion Symbols countv pcountv 7 7 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 O 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 Conversions symbols allow you to convert between different data types within the application ky 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 85 209 Conversion Symbols Chapter 7 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 va
18. ie temporary 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 will be stored in this library file accessible to all projects l Tip When you save a scheme as a library you will copy all of the symbols in that 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 3 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 z 134 209 Chapter 10 Defining a New User Defined Symbol 10 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 r
19. 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 If you want to change the vertical and horizontal alignment select the A ignment type from in the Vertical and Horizontal drop down lists Ay 147 209 Defining a New User Defined Symbol Chapter 10 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 WW NL appears as red spot in the symbol c Our Stepper symbol should now appear as at right 3 Data og 2 Glock NS 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 S in the symbol editor toolbar or select New2Attribute popup menu The Create attribute dialog box opens fee Create attribute xX Color mm Edit Tag SIZE 20 mm VAL
20. 0v20135 51441 goosvlbib vand bA b pnl copvbb wvan4 5 l pwZnd O0s ret end of interrupt driven sub routine SUBOODS divwwww vO0n7 4 v3n18 4 v3n16 2 v3n10 4 dxvwwww vsnl0 4 v3nl9 2 v9n27 2 912 2 GIVWWWW UWODLZ 2 V3nzUu V90202 V9oll2l 2 Tudvabww Vong ly 2 wvODnll 2490201153970 indtabww v3n26 2 v0n10 2 803011 14 0 indtabww v3n27 2 v0n9 2 803011 14 0 indtabww v3nl6 2 v0n9 2 903011 14 90 ret SUB0004 interrupt driven sub routine stateouth v4n22 1 1 98t0 2 2 stateoutb v4n21 2 1 8t0 2 3 OxXx2DbD wel ly Vane ys D Stateoutb v4nl19 4 1 5St0 2 1 ky 197 209 Fast Counter Application or2bbb wdnl9 4 1 v4nz2l1 2 Ll v4n0 5 2 Appendix B Sample Applications muxzbbwwwww v4n0 5 1 v4nl 3 1 x4n2 2 x4n3 2 x4n4 2 x4n5 2 v4n6 2 bunpackwbbbbbbbb Van Opa Ug 0707 wdnd s 6 Vane fy lan Oy vans lo vn 2 vy oy le Van A 64 45 1 digoutb v4n46 4 1 BUDRC 3 digoutb v4n45 3 1 BUDRC 4 digoutb v4n44 2 1 BUDRC 2 digoutb v4n42 0 1 BUDRA 2 digoutb v4n4 7 771 BUDRA 1 digoutb v4n43 6 1 BUDRA 0 digoutb v4n41 1 1 BUDRA 3 Statceouth v4nl2 95 1 89t052j digoubb samnml2 5 54 l BUDRPB U Srareourbo wvanb3 060 1 9t0 2 digoutb v4nl3 9 y1 BUDRB l Sstateoutb v4nl4 7 1 St0 2 d tgourtb vans d BUDRB 6 sSrateourb vanl50 1l 45t052 dagoutb x4dnl5 051 B DERPB T7 stateminit stO0 2 0 stateminit sSt0 2 1 Statemrirmit St0 2 2 SUdbemlmcrit sU sta enint St02 1 stateinit st0 2 0 state st0 2 0 1 stateend st0 2 0 Stateinit StO 2
21. 1 state StO Zyu yz Stateend st0 2 1 stateinit StUU 2 42 state st0 2 2 3 sStateend st0 2 2 Stareinait St0 2 29 state st0 2429940 stateend st0 2 3 statemend st0 2 4 LD A BUDRA LD DRAYA LD A BUDRB LD DRB A LD A BUDRC Lb DRCy a ret end of interrupt driven sub routine SIE ONDE Rie aay RECinGs BI PSCRy 00 08 bI Ps C50 aA LDI TCR OCFH LDL TSCR U6DH INC TICK Create normal stack push 198 209 T ii A i 1 T O ji i ap Z 1 3 ii Q Appendix B Sample Applications LD LD LD LD LD LD LD LD LD LD LD Decrement interrupt timers JRS 7 T02006 TM1 0004 deew 02006522 JRR 7 T02006 TMI 0004 CALL SUBO0002 TM1_0 Decrement prioritized timers decw AT00004 2 JRR 7 AT00004 TM1 0005 CALL SUBO0004 copyww 2 TCONST AT00004 2 TM1 0 Create normal stack pop LD LD LD LD LD LD LD LD LD LD LD RET sENDG PORTA PORTB interrupt service routine IEC NDE PORILATNT STACRAJA AX STACKX A A Y STACKY A AV STACK LO A W STACKW A A REGO STACKO GA 004 rss A GTAOKD REGO A A STACKW W A A STACKV V A A STACKY D OIACKX JD p D oH D OIACKA I PORTAILnDt Create normal stack push LD LD LD LD LD LD LD ky STACKA A Box STACHKX A A Y STACK A AV STACKV A Fast Counter Application 199 209 Fast Counter Application Appendix B Sample Applications LD A W LD STACKW A LD A REGO DD S TACO A SET 6 v2n12 CALL
22. 1 In the Environment Options dialog box click the Symbol tab The Symbol dialog box opens Shape color i Edit arid 10 m m To ease the creation of your own symbols Healizer can create the macro heading for you 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 152 4 To allow pin names to be used in macro headings click the corresponding check box 5 Click OK when you have finished 5 162 209 Chapter 11 Customizing Toolbars 11 6 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 e Adding or deleting toolbar buttons e Placing separators between toolbar buttons e Changing the order of toolbar buttons e Restoring the default toolbar Note 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 Inthe Environment Options dialog box click the Toolbar tab The Toolbar dialog box opens The Available buttons box lists the toolbar butt
23. 120 Steps in application development 19 STIMicroelectronics internet address 11 Stopping the simulation 122 ST Realizer application structures 12 S UD KOU CS is os ci ct erate dettes Arten 30 STSOUTUIBEOE uec dvi aa 103 PUNTA LO usus oce ote assa uoi 121 oubscheme input change event 61 SUDSCNEMES wos cu ese ebat 15 51 58 assigning execution conditions to 59 connecting to root schemes 58 CY SUA isis 34 58 disconnecting execution conditions FOM aot releciestneie open eoe 63 Introd clio TO eto bits d 15 IO AV ING isset lale dues Re esie Lu beets 63 OD MING m S 59 placing event symbol in 60 SYDOST 58 defining new esses 130 SVITIDOLOdHOP s iicet etia 129 adding drabhiC6S unici toe deest 142 adding pins to a symbol 145 assigning attributesl 146 changing graphic properties 143 editing new symbols 140 editing pin attributes 141 editing symbol information 144 generating macro headers 139 modifying attributes 149 ejer ingroc neecneneem ne ne Roe Ween 129 Symbol lIDratles icc i 39 SyMbol preferences 162 205 209 INDEX Symbols
24. Long LONG Any values except BIT type values Word WORD For a detailed description of data types and attributes refer to Appendix A Variables and Attributes on page 167 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 output pin data types Choose data types for Pin 3 label 5 Type BIT gt Output each of the output pins Pin 4 labe NS Type BIT p MM 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 Oe 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 142 once the symbol has been created Click Next 138 209 ky Chapter 10 Defining a New User Defined Symbol 9 Anew dialog box opens to prompt you for the code properties of the new symbol lee Select the code properties ILODE macra name JiStepper CODE 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 dif
25. Note Take care to choose the data 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 Q lI type Any type BIT LONG lookuptable 5 88 209 Chapter 7 Power Management Ramtable Symbol Converts the input to a non linear output value found within the table The inputis used asan 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
26. 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 lt 71 209 Logic Symbols Chapter 7 Eight 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 OR G OR H A E C L D x1 F E H Three value binary OR function symbol only applicable to BIT type values 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 A Z A ORBORC B wz s Four value binary OR function symbol only applicable A to BIT type values Z A OR BORCORD D 44 x 9 L 78 209 ky Chapter 7 Logic Symbols Six value binary OR function symbol only applicable to BIT type values Z A ORBOR COR DORE ORF n m OoOU sx 24 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 OR H I o nm ood gt s Rising Edge Detector Symbol A rising edge on input causes an output pulse to be generated H In type BIT f Out type BIT Set reset Flip flop Symbol A high level on S causes
27. OSX MERE NT 64 172 91e dU o NUMEN N 64 172 R ON ea 172 Target Hardware Ghanglrigaleusditeniiod moo adsis date 27 Configuring the scu na 28 regulremielilS icon e reti Tees nibo ped 9 SENGS MTM RR INN NO NM 28 specifying device 25 Target Microcontroller see Target Hardware Target dependent events 62 TME ARDU scii iom nre enr 173 Time table adjusters 110 Timer ticks changing the value of 95 introduction to sueesssssse 18 TNA PE a IEEE 18 ODDIOTIS Socio nitide ipti iei tid ue Eds 95 Toolbar DULIOES ear posto bees tibiis 163 TOT CA UFIDU S iode Ee e Oen eo ethos 173 Type inheritance variables 168 OAD ened UN E 170 overruling variables 169 TYPE attribute eeeeseesssse 170 U Si tee UR RIPE TRE 167 207 209 IN T cT 167 UNITTYPE attribute 173 V VALUE attribute 173 Value of a constant symbol 42 Variables BT ashes dentine ged di Ned mta a ud 167 Bec 167 ronmsvolallle iussis sott iat maletes 171 SBY TE saen 167 SIN Tuenti aN 167 type inheritance 168 type overruling 169 UB Y TE ss
28. Programming using Symbols 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 tables subschemes hierarchical sheets states input devices output devices and sequential counted or time related events z 12 209 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
29. SUBOO02 RES 6 v2n12 Create normal stack pop LD A STACKO LD REGO A LD A STACKW LD W A LD A STACKV LD NI LD A STACKY LD LD LD LD RETI ENDC D OIACKX ox PK D OTACKA RROMEND ORG OFFEH JP Reset ORG OFO9EH JP Reset ORG OFFOH JP Rtcint ORG OFFCH NOP REDI ORG OF POH JP PORTAint ORG OFF4H NOP RETI JORG ORFEZH NOP RELI 4 200 209 Symbols xz 1114 10 0 PEE 170 nive M 93 NEX T O 2 isse Patras ta dort dt ad ld 19 93 AAE ES aa 22 Mole MG rena rm 124 SOD IC E AA tegen 19 93 Niel TEE TR 21 2S S TIO siesta dub ua du DOS Sete tota oaa uds 19 93 SS eb f 33 sef files Greal saeco iene tne 103 ODENIN P TE 105 F214 a0 RN 105 ORBI NR UT EE 33 106 A ACTUM solutions Initelriel addres S aaia 11 ade SVIMVDO henii ufelesttudebeci uu ute bo esee 46 AdUStE enn cmt Dose ees 106 NUMEN aiaa OO 107 atta CLIE TG apsossopeudes a a dbavis 107 OPUN cpm RN 109 setting values 108 SING WIV E nanie bas te GM UE B ER 112 DIACING etes t ONT S 112 SQUSre WaVe sasies t a setetramas tineis 114 PLACING SP RI ERR Neston TT E ECRIRE 114 setting values 114 time table serrenda 110 DIGGING e 110 setting values 110 values FEC ONONAG ds csucsts ea cents 103 124 FOUSING os cista tons bete pire Dentes 103 124 ALLOCATEBLOCKIN attribute 171
30. TEM heading The macro header for the new symbol is copied to the wiew d clipboard Edit description For our example symbol Stepper we generated two Cre macro headers iStepper and Stepper iStepper looks like Hid d k k e de ke ke Ke KKK KKK KK KKK KKK KK KKK KKK KKK KKK KKK KKK KKK KK KK KK KKK KKK KK KKK KKK KK KK KKK KK KKK KEKE KKK KE He He He ke Ke He e ke ke e ke ke k k istepperwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 Description Initialize Word STEPPER Hid d k k KKK KK 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 KKK KKK Ke ke He He ke ke He e ke ke e ke ke k 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 10 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 requi
31. TIME PIN see DEVICE TXT opecifies ASCII data to be entered as plain text UNIT TYPE Type of a variable from BIT through WORD and also MIN and MAX 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 173 209 Attribute Types 174 209 Appendix A Variables and Attributes 4 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 SI7 MCU one chip solutions can be developed with the associated cost and density advantages The following example shows a coded lock system that was developed 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 i
32. amp Mathematical f Counter C li ck i Conversion Table Power management The main lib and mainper lib if it El Constant exists for the target microcontroller State machine dialog box es open The symbols f pm ced sheet 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 File2Open menu sequence by specifying the appropriate lt filename gt 1ib file ST Realizer has with a number of symbol libraries in the root folder MLib directory including a some that are microcontroller specific lt 38 209 Chapter 6 v Tip e v Tip Esci qii Selecting a Symbol Wire or Group of Objects ky 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 set 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 i
33. 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 25 209 Choosing a Target Microcontroller Chapter 4 4 2 Choosing a Target Microcontroller 4 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 fee Select target hardware X Curent ST 221282 Two 16 Bit Timers SK AOM 256 Bytes HAM E 4 Target hardware devices STE 8 Bit MCU Ej amp y ST 8 Bit MCU Jg ST 7210 16 Bit Timer SPI STPA212 Two 15 Bit Timers SFI SEI z i Spre2218 A D Converter SPI MEX Icrp 221282 Two 16 Bit Timers 8K ROM 256 Bytes RAM ott STF2213G1 16 Bit Timer 4K ROM 256 Bytes RAM ST 225 A D Converter Two 15 Bit Timers SFI 120 ST i231 s A D Converter Two 15 Bit Timers SFI SEI ST 233 A D Converter Two 15 Bit Timers SPI SC EEPROM Cancel 2 Find the target ST microcontroller
34. and depending on whether the logical condition is satisfied or not divert the application into different subschemes or subdiagrams Two value binary AND function symbol with type inheritance Z A AND B 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 A Z A AND B AND C ky 71 209 Logic Symbols Chapter 7 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 a ep IN type Any type BIT LONG OUT type BIT 4 72 209 Chapter 7 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
35. 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 5 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 E Project heating A default root scheme is V 1 7221262 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 5 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 n the Project Viewer shown above double click the root scheme for example heating sch as shown above located under the Schematics folder ky 33 209 Creating a New Scheme Chapter 5 A new blank worksheet opens where you can draw the root scheme of the application 2 ST Realizer Beta heating File Edit Search View Project Options Tools Window Help Li ce bed x fil ts oe tio i g POO ae Ntc yt
36. change detection on vOn7 LD A vOn7 0 CP Ay pvOn 7 0 JRZ UNIOOO01 JP EXECOO03 UNIOO01 LD A vOn7 1 CP AIDVOn sl JRA UNTUOO02 JP EXECOO03 UNIOOO2 JP NOEX0003 EXECOO03 CALL SUBO0003 NOEX0003 Disable interrupts for parameter passing LDI IOR IOR MASK copyww vOnl11 2 x4n5 2 copyww vO0n8 2 x4n2 2 copyww vOnl0 2 x4n4 2 copyww v0n9 2 x4n3 2 Enable interrupts LDI IOR IOR MASK O10H moved to TIMERI interrupt CALL SUBOO04 ROUTPEND 196 209 Appendix B Sample Applications 4 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 DBB A LD A BUDRC ED DRO A LDI IOR IOR MASK O10H LDI HWDR OFFH JP RealMain SUBOODOT loopdelwww v0n5 4 svin2 4 vin0O 4 loopdelwww vli1n0 4 pvin0 4 vin1 4 loopdelwww vinl 4 pvinl 4 vin5 4 add2www vOnb5 4 vl1n0 4 vin3 4 add2www vln3 4 vlnl1 4 vin4 4 add2www viln4 4 vln5 4 vin6 4 divwwww vilno 4 viln 2 vin9 4 0 0 lamtiww wing 4 v70n7 4 07 9999 copyww vOn5 4 svln2 4 copyww v1n0 4 pv1n0 4 copyww vinl 4 pvinl 4 ret SGUBODUD2 interrupt driven sub routine so wv2ml3s D L9 00 T0006 edggebbb V n 37 07 Ove Dog ua TTA ds Zr LOODoedDDD CVy2m1l1 2 L129V2pdll 3 l22095344 1 eventb VoL Oyl count fbbbbbbbwh V2nlz2y0 1 5pv2nl2y7 1 w2n4 54klvrypw2n4 0yl V255 9 15 9 2104 59 L4pw2n4 0 1 wv2mnlog4 OD Or cT AO ditenwhww wznb0s4 wv2nll 2 1 y299450 0 QobpVIbb VAZml5 051
37. 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 ky 181 209 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 From the voltage divider Analog value entry Key recognition 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 pro
38. from each channel 4AddReplace channel 2 Increase size To add another signal to the second channel Information ky 119 209 Monitoring Signals with Probes Chapter 9 9 3 10 Viewing State Machine States You can view the states of a state machine by attaching a State Machine Probe to 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 Machine 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 Ooo probe is connected to a stateinit symbol in a state iene 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 ealing OFF To enable disable the state history list and set its length 1 Double click the probe or right click the probe eee and select Properties fro
39. input at 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 7 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 89 209 Constant Symbols Chapter 7 wat Wait mode symbol Wairmodeeviibelcosiemiciaconioloriocicas the microcontroller to sleep mode The microcontroller can be woken up by any 6n om interrupt 7 10 Constant Symbols Constant symbols are useful when you need to compare a signal value to a fixed value ens bitevinbsl Values o add ersiewad bit symbol Values 0 and 1 are allowed 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 7 11 State Machine Symbols otate machine symbols are used to create state machines for the application State machine symbols define and control
40. 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 subsequent 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 6 4 5 on page 55 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 0 Symbol sequence C will be performed unconditionally there are no event symbols connected to this code sequence e If Event 2 is triggered Symbol sequence A will be performed with out1 0 ky 17 209 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 connec
41. 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 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 6 4 on page 51 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 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 Is Execution Condition met Subscheme Code Normal Code Execution The diagram at right shows a schematic example of how a subscheme with execution conditions is used in an application z 16 209 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
42. 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 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 4 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 155 209 Defining a New User Defined Symbol Chapter 10 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 a 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 e 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 2Hardware settings 2 Inthe Hardware settings dialog box in the nclude 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 fol
43. 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 ptions vVncdow 1 On the Options menu click Simulate simulate Environment The Simulating daughter dialog box opens Simulate options Logging simulation made Fin level Hunning made Continuous Timing mode Target time M Enable accurate simulation Enabling this option will result in a mare accurate but slower pin level simulation LIF Lancel lt 123 209 Recording and Reusing Adjuster and Probe Values Chapter 9 Table 5 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
44. sheet 92 madextable eris 88 information EdliD Orepa ausainnwaiulnsghart 144 VIEWING serei ranon en 44 MO o acetate 46 68 input and output sssessee 67 PUUA eri n eee 46 68 inputsequence eeeeeeeeneeennn 70 WATS OMA mer 83 Introd Bcllon tO oet ten s 14 lah URN 14 o e 74 Tug e HORMONE 83 fen e 83 foo c 71 IOOKUIDLADIC ioo otia en oe deny 88 WOOO Gl ME 74 main symbol library 67 mathematleadl e odis i rude S etait 82 Iiletode lees itc E Paid ede 69 MIGTOO CIV m 70 MONN ieu Quite leute etus dead 43 MOVING Seene T imexateenceceenss 41 FUL PEE EET AE E AES 83 MU Pa e a aa 74 810 p CLARUM R 75 INO aeaea 75 ATAO PEN RETE 75 alas UR 75 ARCO RE CERE 76 ATAL lo REED ener Se eT AA FOEDE RETE 76 B9 fL RERO IN oat ER a a 76 NOT SERES 77 OWA Em 77 NOTO sisi incase bite cere nce Ada edet 77 PON RP RR 78 arc E 78 OLO uictis bit iet visas eei 78 I NR NEUEN UT 78 OO on csteeson E fed tee C OE octal SEE 79 OLD os iM he dee as 79 oye 81 OS OV eT 81 OUUTE be tutte 46 OUEDU nn a 46 68 OLUTIDUtlAlCDIs is a ene esent 46 OUIDpUISeQuefiCO is toe i d reet 70 persistent library symbols 67 ADC as p S 89 placing in a scheme 38 DOr o 58 92 porou aessa 58 92 power management 89 programmin
45. that follow it in the subscheme code event event flow 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 thus causing an event driven execution of the scheme famment E type Boolean When TRUE it enables the execution of the event driven subscheme eventenable 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 is invisible Remarks None Input Symbol The NAME attribute is used for connecting this symbol to a hardware port For this double click the UBYTE comment symbol 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 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 SI
46. 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 9 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 to use probes Ay 115 209 Monitoring Signals with Probes Chapter 9 9 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
47. 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 value 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 beg
48. the progression of the various states of your application Initial 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 pstateinit When in the persistent non volatile library this symbol named pstateinit shows an M in its design 5 90 209 Chapter 7 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 ky 91 209 Hierarchical Sheet Symbols Chapter 7 7 12 Hierarchical Sheet Symbols Hierarchical sheet symbols are used to represents subsche
49. 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 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
50. 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 v 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 44 209 ky Chapter 6 Using Automatic Wiring Copying a Wire Pasting a Wire from the Clipboard Moving a Wire Deleting a Wire Mirroring a Wire ky 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 k 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 symbol is moved Auto rerouting Both these options are enabled by default For details see Wire Drawing Options on page 165 Select the wire to be copied Click dE i I Drag and drop the ghost box of the wire where you want to place it Note that attribute values are also M To copy a wire to the clipboard click Click B then drag and drop the ghost box down to the new location of the wire Select the w
51. 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 IN1 TYPE SBYTE SINT No 1000 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 169 209 Attribute Types A2 1 Pin Attributes Tag TYPE 170 209 Appendix A Variables and Attributes Description Pin numbering 0 x Specifies the parameter sequence 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 TYPE 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 la
52. 00 0 High O 1 0 1 0 O 15 1 9 10 100 0 Low 1 0 0 1 0 O 22 1 9 10 100 3000 Low 0 1 1 0 0 O 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 9 6 1 3 Recording Adjuster and Probe Values 1 Before running the simulation whose values you want to record on the Options menu click Simulate The Simulate Options dialog box opens 2 Click the Logging tab 125 209 Recording and Reusing Adjuster and Probe Values Chapter 9 The Logging daughter dialog box opens Simulating Logging Enter a lag File Browse v Start logging with an empty file after an initialisation Select a log file Look ir 3 Heating EN Play back the log File name myname Files of type Log 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 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 9 6 14 Reusing Adjuster Values Once you have recorded a log f
53. 02 209 Chapter 8 4 Chapter 9 Working with Simulation Environment Files 9 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 e 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 9 1 Working with Simulation Environment Files Each project you want to 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 envi
54. 5 B Backup file creating eera e tastes 158 Base Clock changing the timer tick value 95 ze 167 BLOCKSIZEINUNITS attribute 171 201 209 INDEX BUDRx variable Variables BUDR X a s edeibitbaa sie a sen nid 30 Buttons In TOO IDSE sii deiecit eei 163 C Changing table data format 65 Changing the Target Microcontroller 27 Clock InpLt DID ice ineat edeua hs 145 CODE ariDitens siia eem 171 Code generation example OL cundo ap 194 ODHONS terete tena eder 94 SUCIU Sz d 12 GOlOlS Ol DOXOS aiar ter prc 158 COMMENT attribute 171 Compiling changing options seessss 93 execu ena d rationi eiut Si 97 Configuring events essssss 61 Connecting Application to Target Device Tai ge o D eiie iieri REOR MI NN 19 VO SVITIDOIS ronisin etnies a 46 Constant symbol changing value ssss 42 Creating a NEW DT OCC lics ciinsaiiianendedecoesienionr anit 21 PACKUP TG eisin n 158 MacOS aee a 151 guidelines eeeesssss 151 new schemes eeeeesseeeese 33 DOIG ei RET EE 21 simulation environment file 103 your own symbol 129 Customization of ST Realizer 157 D DJerault CLOCK 1 petu ast a 18 Description of ST Realizer Events 51 DEVICE aU bles nace o
55. 9393 Igi tee m ETT MU NM RUM 22 eo e ER EU 124 CO m 19 93 jo pem ETENIM 21 Ibo E T 19 93 SO pb ee se S b Modus eed ebd 33 Sel itat ise tee I EE 103 WETID cogente eee cee 33 106 importing into tables 66 Lao 103 ST macro assembler language 93 OMS TOF DANO asiste apes seme ups 49 G Generated code example 194 Generated report file example 192 GMOST DOX COlOES uctor EP PORE aC 158 H Hardware see Target Hardware ISO DE atttiDUlG users tes bnt tiat 172 Importing files into tables 66 Initialising the simulation 122 Input interrupt event sssssse 62 Dilianuss p EIS EE 145 simulated values 106 SVD era a DEDE 46 variables used by ST Realizer 30 inputlatch symbol 46 L LABEL AbFIDUlO inis idctgetulatena e ides 172 Libraries adding new subscheme symbol to 133 adding new user defined symbol to 155 eec 39 placing a symbol from 39 SVRIDOLs 12 2 29 1 1 i aae afe 39 HOG TIO e P 103 EONO 167 INDEX M Macro eS nie e Anecd Reed 30 Macro parameters eeeeeeeee 152 MaOs Losada ste dent Inte A Et 172 ARO UMMC MS si
56. A rising edge on the input pin causes a pulse to be generated The TIME attribute format is 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 O type BIT lt 81 209 Mathematical Symbols Chapter 7 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 O Time type WORD Hui l O type BIT comment 7 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 S lt IN1 type WORD T IN 2 type WORD co OUT type The largest IN1 or IN2 type Average Symbol Takes average of IN1 and IN2 OUT IN1 IN2 2 average IN1type WORD IN 2 type WORD 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 Out t 2 3 In t In t dt dt 1 3 Out t dt K 2 3 dt Type depends on input type differential Divider Symbol Q A B R A B A B type WORD Q R type The largest A or B type 4 82 209 Chapter 7 Mathematical Symbols Integral Function
57. ALLOCATION attribute 171 Analog to digital symbol 46 Analyse SX SCULION Tasso cubiti aet da a DU bd 97 what to do if there are errors 98 Analyse and compile report 99 L7 Analyse error messages 98 viewing and tracing 99 Analysing and generating your application93 Application development steps 19 Applications IATFOGUCTION TO oce o ertt idu qu 13 SImiulallobuoiacu ceti mime tees 103 SI UGCIUTO OT onion case tiqutera i o tems 12 Apxd variable Variables ADXG cessent a uai bu Iac 30 Arguments for macros se 152 Attaching numeric adjusters to pins 107 Attribute preference settings for symbols 42 Attributes Hf oa nu m tM 170 ALLOCATEBLOCKIN 171 ALEOGAJTIOINN arruntenen 171 attaching to symbols 146 BLOCKSIZEINUNITS 171 Sep LEER 171 COMMEN Toreon r ad etus cedars 171 DEVIGE canis cdit imeem e 171 jS 5 B 172 LABEL 22r nee 172 MY eee E 172 OCODE 172 SOHEME ttti tnu 172 TABLE caius tiated tt aequ 172 TIME enese 173 TA ET 173 i 4 cy eke en terete trict te ee ener 170 INET TGP Be icio otii eaten adn 173 VALUE ntn tole ade at dut 173 viewing BIOO6Dssseitehi ned a Son 49 Automatic wiring eeeeeeeeeee 4
58. C 5 8 bit analog input Temperature in 1 10 degrees Celsius 100 209 ky Chapter 8 Viewing and Tracing Generated Messages Register connections Symbolic name H W nameDescription Comment ARCP TBOCILRTimerB output compare 1 low re PumpSpeedControl List of all used peripherals TIMERB settings Prescaler value 1 2 Output level 1 Output level 2 High Low 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 000H Initialise compare register 2 100H PWM Enabled One Pulse Mode Disabled Variable overview Total used bits PLS Total used events Total used unsigned bytes Total used signed bytes Total used unsigned integers 18 Total used signed integers 2 13 Total used longs Memory overview Total used RAM 63 byte 0080H 0081H 0O0BEH Total used ROM 892 byte EO000H E37BH of FFDFH 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 lt 101 209 Printing Reports 8 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 1
59. Chapter 9 Monitoring Signals with Probes Table 4 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 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 Decrease size channel 2 and select a second signal either a wire or a pin for the second Properties channel The oscilloscope probe will now display two signals one
60. 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 e Door locked Code recognition e Door unlocked e Secret code entry 4 176 209 Appendix B Sample Applications Coded Lock Application Figure B2 Sequencing Control State Machine Wrong Code Code recognition E One digit received Secret Code Entry nn 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 recognition Right Code 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 an
61. Creating Metlist LE Creating Cross Reference OK Analysing LE Generating Final Code LE Executing Target Compiler UE Creating Report File LE 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 8 4 What to Do if there are Errors Found during Analyse 1 lferrors are found the ST Analyser Status window will show a fail message and give the number of errors found Click OK 2 Adescriptive 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 4 98 209 Chapter 8 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 A state input Start is not connected to a net An input pin must always be connected to a net Warring 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 8 5 Viewing and Tracing Genera
62. Machine Symbols llle 14 2 5 SS6HeesS us koe amp ot bleh Bit Do RUE cid odi adi ceo IH co e dod deci et BORRAR 15 252 The ROOLSCNEME xod esu dope eR m docs e acie 15 2 0 9 SUDSCNEINCS 22 25 98 4 UR REIR RURALES e bc i deco 15 20 EVENS 4 61948 x06 ade HEUS REPE eoa a eae IEEE qp edd a E M bd 16 2 6 4 Execution Conditions 0 0 oaea aa eee 16 26 0 Event 5ymbolS usa 050404548 mt hal ne SERS ee Nee deci 17 2 How ST Realizer Keeps Track of Time 2 0 00 ee 18 2 8 Connecting your Application to the Target Device 19 2 9 Application Development Steps 0 0 0 eee 19 3 CREATING OPENING AND SAVING PROJECTS 21 Sal IrO CCUPICS a 20 cheurad tha wa heures ha we ed oth awe ed ed ha wee eds Bore Wate 21 3 2 Greatind a NEW Projecl 2 34 doe d dup d DR EU Sb ebac xb edd dembd 21 3 3 Opening an Existing Project 0 0 ccc eee 22 3 4 Opening Earlier Realizer Version Projects eee eee eee 22 320 GIOSING a PEOIGGL ux iue dort deni dent ee tees eae ee ah E d Rcg a s d s Es 23 326 SavingliProleCiS 3 134993 CR ho deo EROR PEORES P Eee eae 23 4 SPECIFYING THE TARGET HARDWARE DEVICE 25 4 1 STG or SIT Devices i2 f der ei iwi e a a oboe ekeeeeeau ds 25 4 2 Choosing a Target Microcontroller 0 0 00 cee eee eee 26 4 2 1 Selecting the Target Microcontroller for a New Project 26
63. NT or LONG The COMMENT attribute is used in the report file 5 68 209 Chapter 7 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 7 2 Sequential Symbols Sequential 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 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 lt 69 209 Sequential Symbols Chapter 7 Micro Delay Variable S
64. Peripheral Dependent Events Disconnecting a Subscheme from its Execution Conditions Returning to the Root Scheme from a Subscheme lt Subschemes Execution Conditions and Events 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 he 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 4 3 6 on page 32 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 or double click the line Click OK If you wish to remove the execution conditions from a subscheme perform the following 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 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 Sele
65. Recognition llis 178 B2 Analog Multiple Key Decoder llle 179 B2 1 Application Overview lle 179 B22 Ihel yDOdId i e ee Meee er R Rex 180 B2 3 Software Generation llle 181 B2 4 Possible Improvements 0 00 cece ee eee eee 182 B3 COCK DESIGN ua uid dtoy o eg cere ey o OR e Dec 6e ow o be Seed Bose Sb ee s cius dd od 184 B3 1 Application Overview llle 184 B3 2 Current Time Counting llle 184 B3 3 Current Time Setup stresi essi geunkan a aE ee 185 Boe Alarm NME Seups 4tecetett a eoe N aed edes 185 E35 Alarm Voger sup aa i ico 06 o ded ode x re wines dee 185 D3 6 WMCDASC ues uua ur RU RE ah a E COR UE GeO cou aea 185 Do lt OGurrent Time Gounling xs acp pa oC e OCDE RB x e megan 186 B3 8 Current Time Setup 0 0 0 ee 187 B3 9 Alarm Time Setup 0 0 eee ee 188 B4 Fast Counter Application 0 000 cc eee ees 189 B4 1 Ve JADDIICallO 29 ecd rp dune Boars gode edd eh ed oe Rob ad rs Gad ard 189 B4 2 Fast Counter Report File 0 0 00 ccc eee 192 B43 Generated COde 2224 bRERUDPRE ERE E RS ib iE 194 7 209 Table of Contents 8 209 4 Chapter 1 What You Need to Install ST Realizer 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 minimum requirements Table 1 Host PC minimum requirements Minimu
66. ST Realizer II USER MANUAL Release 1 1 July 2002 Ay Ref DOC ST REALIZER II 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 TABLE OF CONTENTS 1 INSTALLING ST REALIZER l E XR E ESRRESPEEZERUEREAs ex EGG 9 1 1 What You Need to Install ST Realizer ll 0 0 00 eee ee 9 1 2 Installation Procedure 42032265 40nbheed ee teoeed eu te eset een kee a euees 9 2 INTRODUCTION AND CONCEPTS 2 00 eee ern 11 2 1 ST Realizer Application Structures 0 0 0 cc eee 12 2 2 Programming using Symbols 0 00 ce ee ees 12 2 3 Inside ST Realizer Applications llle 13 CE MEIST a6 hase eae ILE LIII DLL TT 14 2 4 4 State
67. 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 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 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 83 209 Counter Symbols Chapter 7 Variable Scaler Symbol G Gain O Offset Output Input Gain Offset type WORD i ks scalerv Output value type type 6 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 7 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 countf pcountf A rising edge on the Pr input pin causes the counter to be loaded with the specified value via the value dialog box
68. UE Alignment Value Horizontal Center F Vertical Center F Direction Marmal V Isibiliby Cancel E T ag M Value e Inthe Tag drop down list select Value 148 209 4 Chapter 10 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 1 S beside the text Step Value and click once Click Data e again to return to normal editing mode Step Value 71 2 Our Stepper symbol should now appear as at right Glock 10 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 Tag Value Point of Effect Properties 2n Tock NS Step Value 1 4 2 Right click the mouse A popup menu appears as shown above Select Properties lt 149 209 Defining a New User Defined Symbol Chapter 10 A Change properties dialog box appears fees Change properties gt Color Em Edit Tag Size 15 m m i Alignment Horizontal Right gt Vertical Bot
69. UFO oen ett eet ee 30 Preference settings symbol attributes 42 Preferences AGG S anata E E 160 ONUN nescio oibus chad ance tiones eite 161 SGLOGL ocu sastuttnudes cada dicetur aS 158 SVITIDOIS sits tres bes gctiqasuantu abt ent ludas 162 TOGO AM em 163 Printer LON pe cr 49 SeN Bo 49 Printing preferences ssssssese 161 Probes NUMO C ecce pisces ta dee om Peu 116 OSCIIIOSCODO i isi Euch ba dechbevdldauts 117 ALLACHINIG t PE 117 changing properties of 118 SIMULATION saos io bee a inpia eon 115 state VAC IM INS ua ini euet itin nettes 120 state machine probes attaching 120 values FEC ONGING Pe 103 FOUSING sera S 103 values recording 124 values reusing ssssssse 124 Processing Cycle controlling the time of 95 Project TSS cts IL 20 CIOSITIO condicio eon eee 23 creating DneW sedei vto cer aceudrintnestneee 21 6 61510 a cerae r 22 opening projects from earlier versions of Reallzer 22 204 209 SAVING secant tessuti farne ace Eu pap E 23 H A N e 31 Ramlnit subroutine sssss 30 Reallnit subroutine 30 Realizer Operating System 29 RealMain subroutine 30 Recording adjuster values
70. 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 167 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 performs 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 4 14 209 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 6 on page 37 explains how to build and modify schemes 2 5 2 The Root Scheme The root scheme is
71. 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 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
72. arget microcontroller and or the project schemes You are free to run or modify the simulation at will 9 1 3 Saving an SEF 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 Ay 105 209 Setting Adjusting and Viewing Input Values Chapter 9 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 9 2 Setting Adjusting 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 Numeric Adjusters which displ
73. ay 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 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 4 106 209 Chapter 9 If you right click any type of adjuster or probe probes are described in Setting Adjusting and Viewing Input Values Increase size section 9 3 on page 115 a popup menu will open that looks similar to that Decrease size at right Properties From this menu you may increase or decrease the size of the adjuster by selecting Increase size or Decrease size 9 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 Num
74. ayed a specified fixed time The TIME value format is dashhimmsss xx where 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 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 clock ticks for the delay default 10 ms Time type WORD and O types BIT 5 80 209 Chapter 7 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 iT 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 T l C delvon ticks for the delay default 10 ms Time type WORD and O types BIT Fixed Time Oscillator Symbol The TIME attribute format IS dd hhezmm 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 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 J TIME type WORD comment O type BIT Fixed Timer Symbol
75. bscheme 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 n any blank area of the subscheme right click the mouse to bring up the New i following popup menu T Select Execution conditions The Execution conditions dialog box for 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 microcontroller 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 oymbols to Microcontroller Pins Ports and Peripherals on page 46 before you define the execution conditions in any subschemes Leave Properties 59 209 Subschemes Execution Conditions and Events Chapter 6 Placing and Configuring an Event Symbol in a Subscheme 60 209 E ST 7221262 Execution conditions Conditional execution of Filter sch E by conditions Available conditions Applied conditions Upon sub scheme i
76. 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 X pene that shown at right E3 Libraries O amp 3 Target hardware i Project heating E STz 221282 Two 16 Bit Timers 8K AOM 255 Bytes RAM SZA 26 209 Chapter 4 Choosing a Target Microcontroller 4 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 lt Open the Project whose target microcontroller you wish to modify mice Options Tools Wir Click Hardware Select on the Project menu or double click the target hardware device in the Project Viewer The Select target hardware dialog box will open ware select showing the target hardware device previously TRETEN e settings selected Simply browse to the new target hardware device desired Click once to
77. cation 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 assembler Depending on whether or not you included the ROS see Section 2 3 on page 13 and Section 4 3 4 on page 29 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 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 application If any messages are generated during the analysis and compi
78. cessing 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 182 209 ky 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 B9 Figure B9 System Optimization Using Customized Components From the voltage divider Analog value entry Key recognition ky 183 209 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
79. cheme 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 Horizontal Center Vertical Center gt Direction Moma Visibility M Tag M 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 50 209 lt Chapter 6 Subschemes Execution Conditions and Events 6 4 Subschemes Execution Conditions and Events Subschemes are exactly 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 wer
80. 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 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 lt 73 209 Logic Symbols Chapter 7 Multi type binary Inverter Symbol Z NOTA inv A type Any type BIT LONG Z type A type Jk Flip flop Symbol Values are J K Q Q Where rising edge x dontcare Q 1 previous value One loop Delay Symbol The output is the previous value of the current input loopdel 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 0 1 type BIT 0 1 type Any type BIT LONG Out type The largest 0 or 1 type Out 5 74 209 Chapter 7 Symbol Symbol Name oo dex 43 C i rr B eo LT T Qo T F Cy LU at
81. cnt et nete taa 152 ecrire n ners 151 namning err 152 Main symbol library 67 EAA OO a cR 39 mainper lib library sssss 39 Memory Configuration se 31 Memory configuration susssss 28 Monitoring simulated signals 115 Multy OG DING akerise tamea arae 167 N NAME atl iDUle oaoaraa i ees 172 Naming HiaefOS adito reden ten i 152 NMI signal event 62 Non volatile variables 171 Numeric adjusters uesss 107 O OC ODE attrib le inariana 172 Opening efejzie P 22 cepi 35 simulation environment file 105 OCODUIMISAUGINS zucca edd et fuia ied esas 97 Oscilloscope probes 117 Output 9j P EST 145 SVITIDOIS ae 46 OQuIpIESWTbOl se aelesu ui bala tera 46 outputlatch symbol ssss 46 P Page prorerenNCES israse rdi 160 Parameters for macros 152 203 209 INDEX Passive output pin eeeeseeeee 145 Periodic event seeeeeseeeees 61 Peripherals ERAD Rr 32 SOTO NP T 28 win NS orc e NUN TENE nee 170 Pins MUDE C 167 Placing symbols in a scheme 38 portin symbol DOMOUT SVIDDOL iceiie nitens 58 OMIA SUDFOLL
82. ct the event to be removed e Click the left arrow Mew I View i Properties e Click OK Click the subscheme area out of any symbol E with the right mouse button ai A popup menu opens View d Select Leave ropertes 63 209 Table Symbols Chapter 6 6 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 assigned An example of a lookup table is Input value Output 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 exam
83. d 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 pL None digit received A B gt A B _B A C COUNTER Digit Reception Flag C B C 2nd Digit te B A C q Std_Digit o Digit Srd_Digit __ ast digit ky 177 209 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 by 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 di
84. der 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 x 156 209 Chapter 11 11 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 157 209 Automatically Saving Your Work and Setting Screen Preference Chapter 11 11 1 Automatically Saving Your Work and Setting Screen Preference S T 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 save Auto backup every i min S electionbox calor px E dit Ghostbox calor i E dit OK 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 yo
85. e 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 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 oubschemes not linked to events either by definition of execution conditions or the inclusion of event symbols are basical
86. e One for seconds n 60 e One for minutes n 60 e One for hours n 24 z 184 209 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 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 applicati
87. e 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 lt 109 209 Setting Adjusting and Viewing Input Values Chapter 9 9 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 Agjuster 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 Values 5 100 00 00 00 0000 _ ss 600000 75 00 00 00 0005 100 00 00 07 5000 150 00 01 00 0000 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 Bl 3 Click where you want the adjuster to appear The adjuster is now placed in your SEK sch
88. e options Code generation Code optimisation Realizer uses timer ticks For timing Generate a 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 Fixed processing cycle time Une processing cycle must be finished in 1 timer ticks LIK 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 lt 95 209 Changing the Compile Options Chapter 8 for each family of microcontroller ST6 8 MHz ST 8MHzcysta ST7 16 MHz crystal Minimum Maximum 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 Processing 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
89. e time required to perform one main loop cycle is called the Processing Cycle Time By default the processing cycle time is variable However you can choose to fix the processing cycle at a specific number of timer ticks how to do this is described on page 95 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 6 4 3 on page 51 Time related symbols are described in detail in Section 7 4 on page 80 z 18 209 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 Applicati
90. ear 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 Of Setting Adjusting and Viewing Input Values SCK MISU Mos OCMP2 A ICAP2 A OCMP1 A zai Heatingls ON Temperature M Setpoint OCKMP1_B ICAP CLEOUT Increase size e Right clicking on the adjuster and selecting Properties Decrease size from the popup menu shown at right Properties The Change sine wave adjuster dialog box opens lee Change sine wave adjuster Bottom T Top 55535 Frequency 1 000000 Hz Cancel 113 209 Setting Adjusting and Viewing Input Values Chapter 9 5 Fillin 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 9 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 wi
91. eate ST Realizer applications This information includes e Alist 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 m mm o mm SINT 32768 32767 Signed integer LONG 2147483648 2147483647 Signed long WORD 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 ST 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 example 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 ky 167 209 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 on
92. eme and connected to the pin or wire MISO you selected In the example at right we MOSI see that the time table adjuster has been ee connected to the pin called Setpoint which is also the name of the input symbol Note that the time table adjuster shows the name of the pin whose input edere IN the adjuster controls eem OCMPI_B ICAP2_A OCMP1_ A ICAP OB CLEOUT 4 110 209 Chapter 9 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 Decrease size e Right click the time table adjuster and select Properties in the popup menu Properties 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 3 for instructions fee Change time table adjuster E3 e o T OO EET 00 0000 0 000 Import Cancel Table 3 Entering and Editing Time Table Values Double click the entry you want to change then edit its To change the value of a table cell value in the Change value dialog box Press the Insert key on your keyboard then enter the new time and value To Insert a new table row of cells Import values from an existing file Click Import and choose
93. ences 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 lee Environment options Onentation Landscape gt Size Ad Grid 1 0 mm 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 160 209 5 Chapter 11 Printing Options 11 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 Inthe Environment Options dialog box click the Print tab The Print dialog box opens Margine in m m Lett jl Fonthace Anal pointsize 8 Select font LIF Cancel 2 To change the margins overtype the values in the appropriate 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 161 209 Symbol Layout Preferences Chapter 11 11 5 Symbol Layout Preferences In this dialog box you can change the way symbols are displayed on the worksheet
94. ents 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 ky 145 209 Defining a New User Defined Symbol Chapter 10 5 Inthe Type field select the capacity of the pin you want to place For a pin transmitting Choose this data type this value range 0 or 1 Bit BIT 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 Long LONG 2147483647 Any values except BIT Word WORD type values 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 Each time you click this button the pin moves anti clockwise to the ne
95. equired 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 line 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 135 209 Defining a New User Defined Symbol Chapter 10 10 4 1 Defining the New Symbol 1 Open the Symbol Editor fee Select the symbol properties x Symbol name Stepper Select a symbol C Sub scheme symbol f User defined symbol Select a shape f Rectangle C Circle Number of input priz 2 Number of output pins 2 Cancel 2 Give the new symbol a name In our example above we have named our new symbol Stepper 3 Click the user defined symbol
96. erences analysing and generating final code Providing no fatal errors are encountered ST Analyser generates a non 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 13 and Section 4 3 4 on page 29 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 19 209 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 fr
97. eric 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 46 Note A numeric adjuster has the same type as the pin or wire it is attached to ED 2 Click 3 Click where you want the Numeric 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 numeric adjuster has been connected to the pin called Setpoint which is also the name of the input symbol Note that the numeric adjuster shows the name of the pin whose input the adjuster controls 4 Setthe value input to the pin or wire ky Setpoint 0 000 I DI SCE MiS O hos ACPA CAPZ A DO ChIP1 Heatinglz 0H Temperature ICAPR1 B Setpoint OCMP1 B ICAP B CLEOUT 107 209 Setting Adjusting and Viewing Input Values Chapter 9 If the pin or wire input is analog you can change its value by either emu 108 209 Clicking the displayed value in
98. erties dialog box You can now define either a new subscheme symbol or a new user defined symbol 10 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 easily create a new subscheme symbol 1 Open the Symbol Editor fee Select the symbol properties Symbol name 523 1 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 4 Back Next gt 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 130 209 ky lt Chapter 10 Defining a New Subscheme Symbol 3 Click the Sub scheme symbol radio button 4 Select the shape you which to assign to the symbol Note 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
99. ferent execution time e At initialization e As part of the main loop e At the end of 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 icemacroname 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 Ay 139 209 Defining a New User Defined Symbol Chapter 10 10 The Generate the symbol dialog box opens Click Finish to confirm lee Generate the symbol x Creating user defined symbol Stepper with 2 input pins Wath 2 output pins Click Finish to generate the symbol 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 descrip
100. g Filter sch Event Timed interrupt 0 01 Sec ST72212G2 DIL28 connection overview Pin Name Alternative name Type I O Description 1 RESET BIT Input Active low 2 OSCin Oscillator In 3 OSCout Oscillator Out 4 PB 7 SS BIT Input Not connected 55 PB 6 SCK BIT Input Not connected 6 PB 5 MISO BIT Input Not connected 7 PB 4 MOSI BIT Input Not connected 8 PB 3 OCMP2 A BIT Input Not connected 9 PB 2 ICAP2 A BIT Input Not connected 10 PB 1 OCMP1 A BIT Input Not connected 11 PB 0 HeatingIsON BIT Output Push pull output 12 PC 5 Temperature UBYTE Input 8 bit analog input 13 PC 4 Setpoint UBYTE Input 8 bit analog input 14 PC 3 ICAP2 B BIT Input Used by the application 15 PC 2 CLKOUT BIT Input Not connected 16 PC 1 OCMP1 B BIT Input Used by the application I7 PC 0 ICAP1 B BIT Input Used by the application 18 PA 7 BIT Input Not connected 19 PA 6 BIT Input Not connected 20 PA 5 BIT Input Not connected 21 PA 4 BIT Input Not connected 22 PA 3 BIT Input Not connected 23 PA 2 BIT Input Not connected 24 PA 1 BIT Input Not connected 25 PA 0 BIT Input Not connected 26 TEST Test mode pin 27 Vss Jo Ground 28 Vdd Vy Power Supply Hardware connections Symbolic name H W nameDescription Comment HeatingIsON PB O Push pull output Pilot LED ON Setpoint PC 4 8 bit analog input Temperature in 1 10 degrees Celsius Temperature P
101. g 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 37 209 Symbols Chapter 6 The above list is by no means exhaustive The modifiable attributes depend on the type of symbol In Chapter 7 on page 67 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 10 on page 129 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 you compile the application 6 2 1 Placing and Controlling Symbols Placing a symbol in Symbols can be placed in a scheme in two Lar rb the scheme Ways Input and output 1 Insert a new symbol one that does not already exist in the open scheme by atime related choosing it from the main library
102. g with sueessssse 12 ramtable volatile RAM 89 FOLAUING PRECES 43 cleri inr een 83 cleri S 84 seg enti resserre dS adaautatin aunt 69 SIE DSM uses ss dane des itte Shut sos bbs od 86 SOW m 89 SET DST 22 299 ee se 79 Soc escasa des E e tn 58 SIE MATE 92 SLAO tud cu to cian rise do apt e E 91 state machllie s nete tees 14 90 State P 91 stateinit pstateinit 90 iz Iz To 10 MUNERE EE ITUR 91 SIOD asc dut ctacte iuto M o asc rA itp E E 89 SUD ccena sdiqudeu oues utumdestu etant ente 84 izle re a 88 table SVITIDOIS itesie risotto ide 64 time related seeesssssse 80 L p PRSE PRENNE 81 TIBT Ens oes atem traces tedio doin Etat 82 EE E E E E A EAE 92 user delllied niet ros 30 WU sss iesceme E To etu Et dus atia unes inus 90 WAlISCOUCNE e cds doce baa 71 VATI go se MER PME UP a 44 wiring together eesssssse 44 Ife T 87 WDICK oana RD cna er cere 87 WS DIT m L 87 WU DA CK d 88 kyy OOM esta E ccu ted UI Ee 73 T TABLE alriDUlG suerte pa Peer Er 172 Table symbols changing data format 65 editing Galquassaes Econ bm 65 importing data files into 66 ASer etui aical n doute madent da 65 Tables data format changing arsena MES 65 SGIUING Gata I mem EE m 65 In porng IMeS soe tonio bees 66 WN
103. git 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 n Entry amp Sl 1st Digit A 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 178 209 ky Appendix B Sample Applications Analog Multiple Key Decoder B2 Analog Multiple Key Decoder One of the main uses of the ST on chip Analog 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 ci
104. gram of an application with a subscheme having this type of event either as an execution condition or an event symbol 52 209 Reset entry point Initialization Normal Code Execution Subscheme input s changed Subscheme Code Normal Code Execution lt Chapter 6 Subschemes Execution Conditions and Events e 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 Reset entry point Initialization Normal Code Execution Once the period of time specified has elapsed the subscheme or periodic code part will be executed and the periodic counter will be reset Elapsed A periodic event or execution condition is Periodic Code Part analogous to an If Else statement where s Subscheme the If condition is whether a specified number of ticks have been counted at the Normal Code beginning of each main loop cycle For example at the beginning of each main TIMER loop cycle the number of timer ticks elapsed IRQ 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 n
105. hapter 6 selection mode e Click m 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 k Mirror Copy shape where you want to place it You will be Attributes prompted to specify new attribute values for IATER the symbol Edit vi Tip The choices shown on the popup menu can vary depending on the type of m symbol For example for Constant type symbols a Value option is also displayed or for s
106. heme 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 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 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 10 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 vvindow Help Realizer window Simulator F1 2 Onthe Tools menu click Symbol Editor symbol Editar Ctrl F11 Or lt 129 209 Defining a New Subscheme Symbol Chapter 10 Click the scheme area out of any symbol with the right mouse button and select the Attribute New 2Symbol menu sequence Miren Symbol Leave The ST Symbol Editor window opens EOM It automatically shows the symbol editor s tool Properties bar and the Select the Symbol prop
107. henever you are in drawing mode c 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 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 143 209 Defining a New User Defined Symbol Chapter 10 3 Adialog box entitled Change properties opens fee Change properties x Width 2 0 m m Height i Im n r Start a
108. heral 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 57 209 Subschemes Execution Conditions and Events Chapter 6 6 4 Subscheme Operations In the remainder of this section we will describe how to create a subscheme and assign execution conditions to it Creating a Subscheme Connecting a subscheme to a symbol in the root scheme 58 209 You can create your subscheme just a you would create a new scheme refer to Section 5 2 2 on page 34 Once you have opened the new scheme window design your subscheme with these guidelines 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 Ma
109. his 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 Return 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 lt 54 209 Chapter 6 Subschemes Execution Conditions and Events Eve
110. if you want the code to be executed once every one hundredth of a second Click OK Click OK in the events dialog box Cancel Remember 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 95 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 events 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 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 ys Chapter 6 Configuring a Timer Overflow Event Configuring Other
111. ile 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 125 126 209 4 Chapter 9 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 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 change adjuster values 5 Once you have finished recording simulation information close the log file by clicking 127 209 Recording and Reusing Adjuster and Probe Values 128 209 Chapter 9 4 Chapter 10 Overview 10 CREATING YOUR OWN SYMBOL 10 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 sc
112. in lib x Input and output Sequential Logic Time related Mathematical Counter Conversion T able Power management Constant State machine Hierarchical sheet Open the root scheme e Click er A 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 the future subscheme Title e Click Place a 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 Chapter 6 v Tip s Opening a Subscheme Assigning an Execution Condition to a Subscheme lt 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 2 The file C Sreale3 Heatingsssmname sch does not exists Do you want to create t Click Yes A new scheme window will be opened and you can begin drawing your su
113. ing 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 the microcontroller for which the application has been designed It 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 mcu 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 yo
114. inning 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 z 96 209 Chapter 8 Executing the Analysis and Compile 2 This recorded value is used to evaluate all time related symbols and most but not all time related events during the running of the 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 vi Tip Please note that there is one golden rule when it comes to timers the quantity aa 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 related 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 53 for de
115. inting 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 raject drop down menu mE Spions Tools wir 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 ley coom In only refer to parts of Tee Zoom out the symbol itself ST m Full view l Connect Realizer enables you Retresh view to view hidden Properties attributes Pan Click the Invisible attributes entry in the View cascading menu Invisible attributes 49 209 Working in Schemes Chapter 6 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 s
116. ion Chapter 4 Portinit 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 Ramlnit and Reallnit 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 4 Include files for user defined macros If the scheme you are analysing and compiling includes a symbol that you created yourself you must include the macro or macros linked to the symbol before analysing the scheme For details on how to create your own symbo
117. ire 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 oelect 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 3 Select the wire then click THE 45 209 Symbols Chapter 6 Rotating a Wire Select the wire then click e The selected wire is rotated by 90 counterclockwise Changing a Wire s Click the wire with the right mouse button Attributes A popup menu opens PE Init Click the name of the attribute you want to change i An Edit the Value dialog box opens fee Edit the value x Label Enter the new value then click OK LABEL E plabed cone Connecting Input Application input and output symbols must be connected to the ST6 or Output Symbols to ST7 microcontroller input and output pins ports or peripheral control Microcontroller registers in order for the application to function Pins Ports and Peripherals Note Application Input and Output symbols are adc digin comment digout input EA name UBYTE comment comment inputlatch output IUBYTE comment Comment outputlatch qme event event name 4 Comment comment eventenable 46 209 lt Chapter 6 Symbols To connect these symbols to a target l Rotate microcontro
118. istered trademark of Intel Corporation Microsoft Windows and Windows NT are U S registered trademarks of Microsoft Corporation 2002 STMicroelectronics All Rights Reserved Purchase of IC Components by STMicroelectronics conveys a license under the Philips IC Patent Rights to use these components in an l C system is granted provided that the system conforms to the FC Standard Specification as defined by Philips STMicroelectronics Group of Companies Australia Brazil China Finland France Germany Hong Kong India Italy Japan Malaysia Malta Morocco Singapore Spain Sweden Switzerland United Kingdom U S A http www st com
119. ith 43 209 Symbols Chapter 6 the symbol clicking the symbol with the right mouse button To rotate a group of symbols select the group then Eus click with the right mouse button Duplicate A popup menu displays Choose Rotate Botate k Mirror 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 6 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 two symbols together between Symbols Select wiring mode by clicking The cursor changes to a crosshair indicating that it is in wiring mode e 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 Click when the crosshair is snapped
120. ix B Sample Applications Fast Counter Application Figure B21 Fast Counter Display section Display section Dirrving the display in multiplexed mode Ea Ei B2 EJ Ez BS Ec Br pig 1 t pis 3 ri aia a3 rin poracn Execution conditions Timed interrupt 0 03 Sec 191 209 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 Unie v4 00 0 1990 99 ictum 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 Files ST Realizer Examples Fastcnt Latch 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 ls Pew Ig 0s XS BIT Output Jy 20 mA sink open drain output 2 UPB DIGIE d BEIT OQULD t Jy 20 mA sink open drain output om TEOT Ey Test program 4 PB 2 Count BIT Input 1 interrup
121. k 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 HL d d KKK KK KKK KKK KKK KK KK LC KKK KKK KK KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KKK KK KKK Ke Ke He KKK KE He He ke Ke e He e e KKK F istepperwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 Description Initialize Word STEPPER Hd k ke Fe de Fe ke Fe Fe He de KKK KK Fe Ke Fe He Fe ke Fe He He Fe e He Fe He He He He He He He He He He e Ke He He He He e He He He He He He He He He He He He He He He He He He He He He He e He Ke Ke He He Ke He Ke He He e ke e He e e KKK istepwbbww macro Data tData 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 Hid d ke Fe de LE KK KKK KKK KKK KK KK KK KKK KKK KK RK KK KKK KKK KKK KK KKK KKK KKK KK KK KEKE He He Ke He KKK He Ke He Ke Ke ke e ke Ke Ke ke ke e ke Ke e ke stepperwbbww macro Data tData Clock nClock tClock pClock pnClock ptClock S tS NS tNS c5 Description WORD stepper Hid d ke Fe KKK KKK KKK KK KKK KKK KK KKK KKK KK KKK KKK KKK KK KKK KKK KK KKK KKK KKK KKK He He Ke KKK KE He Ke e ke Ke ke e ke ke ke Ke ke e ke ke ke ke stepwbbww macro Data tData Clock nClock tClock pC
122. k 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 hMISU mm zd hin OCMP2_ A mri I J C ICAP2 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 Dion you Wish Temperature ICAP1 B OCMP1_ A Setpoint RINT E To see all views at once under the Window menu select Tile M E CLEOUT XJ 104 209 Chapter 9 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 9 1 3 below 9 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 ST Realizer Tools menu eee vvindow Help Simul m symbol Editor Ctrl F11 Once you are in ST Simulator select the File menu and click Open The Open simulation environment dialog box opens Open a file Look in 3 Heating aa heating sef Files of type Environments set Cancel In the list double click the name of the sef file for example main sef then click Open All of the simulation views contained in the se file will open for example the pin level drawing of the t
123. lated 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 7 1 Input and Output Symbols These symbols provide input and output links between the application you create and the target microcontrollers 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 page 46 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 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 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 ky 67 209 Input and Output Symbols Chapter 7 Event Symbol Can be used only in a subscheme to cause the symbols
124. le 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 4 3 on page 28 for further details 8 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 e 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 93 209 Changing the Compile Options Chapter 8 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 he 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 the ST Realizer system To view or set the compile options 1 Onthe main menu click Optio
125. lect 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 lt 117 209 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 osciloscope probe also shows the name of the pin whose output signal the probe is monitoring ELE Misa MOS OCMP2_A ICAP2 A CMP1 A Heatingls OH Temperature Setpoint ICAP B ICAP1 B DCMP1 B a To change the Y axis time scale and time mode of the displayed graph 1 Double click the probe or right click the probe and select Properties from the popup menu shown at right Chapter 9 OCMP1 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 4 explains the various options available in the dialog box lee Change oscilloscope probe Y asis LHCHMPT B Channel 2 Top 99 oo Bottom 659 7 Time Begin at Da O0 00 0000 Renn ss rns End at Da O0 00 0010 hhimm ss me Mode Trigger hi Trigger on a Rising edge when the value equals 118 209 0 000 4
126. lizer 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 31 209 lt Hardware Configuration Chapter 4 4 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 7 The Main Symbol Library on page 67 32 209 Chapter 5 Schemes 5 CREATING OPENING SAVING SCHEMES 5 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 you 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
127. ller port or peripheral e Right click or double click the I O Mirror symbol Copy shepe This popup menu opens TIE e Click Connect The 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 ST 7221262 1 0 Hardware connections EJ Connect EznLure to UEYTE Setpoint ILL Connect Avallable resources Connected resources PA Input FB Input PL Input FL U 8 bit analog input FL 1 8 bit analog input FL 2 8 bit analog input 2 FL 3 8 bit analog input FL 4 8 bit analog input PC 5 8 bit analog input Properties OF Cancel Click the right arrow or double click the selected device pin name Click OK i Tips To have connections for the device sorted in pin order check the Sort by a resource box If the peripheral register or bit that you wish to connect does not appear in the i 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 lt 47 209 Working in Schemes Chapter 6 6 3 Working in Schemes This section describes general functions and utilities available when you are wo
128. llle 159 11 3 Worksheet Layout Preferences llle 160 11 4 Printing ODIOM S a5 asd ed dri ho ERR Ree E etae ECCE eO lod 161 11 5 Symbol Layout Preferences llle 162 11 6 Gustomizing Toolbars i ed R ERE RETEXRERExS denk do EXE 163 11 6 1 Adding and Deleting Toolbar Buttons LL 164 11 6 2 Placing Separators Between Toolbar Buttons 164 11 6 3 Changing the Order of Toolbar Buttons 164 11 6 4 Restoring the Default Toolbar 2 0 0 cee eee 164 11 7 Wire Drawing ODIONS 4x2 xx EA Stee eae Cito ARERR EEE 165 Appendix A Variables and Attributes elllelllees 167 A1 Variable Types and Rules 0 cece eee tenes 167 A1 1 Type InDeritaliC Os 019 3749 2o sre SOA eee POR A 168 Al TYPE OVSIFUlllig lt 2 2 a d do Edo idco Er ito Dt i at e ek 169 A2 Attribute TypeS 1 ee RR 3 e ns 169 A2 1 PA OTe MA ET CERT OO E OO ET LLLI T T TIL 170 A22 Symbol Attributes m ond ders e eR Gault Ghd bane BOSE eee es 171 6 209 z Table of Contents Appendix B Sample Applications 0 000 eee es 175 B1 Coded Lock Application rs kg wk ae Ee true Reb Re d 175 B1 1 Application Overview lee 175 B1 2 Functional Description scs cy ye ye ee e mew 176 B3 Sequencing CONWOl 2 ance ete oes bed bus Sog UHR Re 176 B1 4 Secret Code Storage in the EEPROM 178 B1 5 A Access Code Entry and
129. lock 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 endif 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 ky 153 209 Defining a New User Defined Symbol Chapter 10 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 endif if tin2 eq TCONST adc A low c5 shr 8 tendif 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 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
130. lowed 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 10 4 8 Writing the Assembly Macro Macro headers are created as requested on page 139 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 nClock tClock pClock pnClock ptClock S tS NS tNS and c5 152 209 ky Chapter 10 Defining a New User Defined Symbol e for the main portion of the code the parameter list is Data tData Clock nClock tClock pCloc
131. ls see Creating Your Own Symbol on page 129 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 5 Assembler options Normally you will not need to alter the default assembler options 30 209 lt Chapter 4 Hardware Configuration 4 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 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 X ea Wes value or overtype its current value Begin 0x008 00173 End 0 0173 O FFDF 2 Click OK To reset the values to standard device settings click Reset Reset LIF Cancel Notes 1 The default values found in these fields do not correspond to those reported in the microcontroller s datasheet because ST Realizer reserves a portion of the available RAM memory for its own use For example for ST7 devices ST Rea
132. lue 1 if B C the B C output takes bit value 1 A B C types WORD output types BIT Type conversion symbol that enables 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 2 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 In Out type Any type BIT LONG When in the persistent non volatile library this symbol named pshift shows an M in its design z 86 209 Chapter 7 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 Word Split Symbol Symbol used to split an input word into a high byte and a low byte All types WORD ky 87 209 Table Symbols Chapter 7 Word Unpack Symbol Symbol used to unpack a word into sixteen bits ED E Ez EJ Ez Ea Ez Br Ecl Era 7 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
133. ly 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 6 4 3 Description of ST Realizer Events Events are a general concept described in Section 2 6 on page 16 and allow for the conditional execution of code within an application As outlined above if an event is applied to ky 51 209 Subschemes Execution Conditions and Events Chapter 6 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 events 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 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 If Else switch in standard programming algorithms The diagram at right shows a schematic flow dia
134. ly 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 IN T Becomes SBYTE INZ INS Becomes SINT Ia a Note that if the expected result is outside the expected range you must set the appropriate type for the output pin by placing a T YPE 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 4 168 209 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 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 IN1 SINT No TYPE LONG IN2 SINT No Another example of
135. m requirements Processor Intel Pentium 100 MHz RAM 16 Mb Disk memory 16 Mb Monitor Super VGA 17 Mouse ST Realizer Il runs under Microsoft Windows 95 98 2000 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 ky 9 209 Installation Procedure 10 209 Chapter 1 4 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 understand
136. m the popup menu shown at right Reese Properties 120 209 ky Chapter 9 Selecting Adjusters and Probes The Change state machine probe dialog box opens le Change state machine probe Show a history list of E terns Cancel To change the length of the history list enter a new length in the Show a history list of field 2 Click OK 9 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 Options indo Numeric SING wave Time table 9 5 Running the Simulator When 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 lt 121 209 Running the Simulator Chapter 9 9 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 OF In the Simulate menu Simulate To initialize the simulator click Initialize SUG Options wino Initialise Ctrl F 1 1 Start F11 Eal
137. 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 amp m m m m s s m s 8 Table B3 Voltage at the ADC input and 8 bit conversion result 5V supply z 180 209 Appendix B Sample Applications Analog Multiple Key Decoder The condition no key pressed 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 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
138. mes and their inputs and outputs Portin Symbol This symbol is used to connect the subscheme symbol pins from the parent scheme with the 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 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 In with 2 input pins and 1 output pin The SCHEME attribute Out defines the filename of the subscheme portin and portout In2 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 sssO0 1 sss1 O0 sss1 1 sss1 2 sss2 1 sss2 2 filename 7 13 Title Symbols The title symbol is used to enter information about the scheme you are working on for archiving purposes Symbol Name Description Title block used for archiving purposes There are numerous fields that you can enter values for to record information about the scheme the circumstances of its creation and the project 5 92 209 Chapter 8 Overview 8 ANALYSING AND GENERATING YOUR APPLICATION 8 1 Overview ST Analyser is a built in tool that analyses your appli
139. 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 COUNTER Min Setup gt gt Min Alarm gt Hour Alarm Hour Setup gt gt COUNTER 4 188 209 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 signal 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 I
140. nput change Penodic Timer Capture 1 interrupt TimerB Compare 1 interrupt TimerB Capture 2 interrupt E 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 By placing an Event symbol in the subscheme the execution of the entire subscheme or part of it can be triggered by an event determined by a specific symbol within the subscheme Place the 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 lt Chapter 6 Configuring a Subscheme Input Change Event lt Subschemes Execution Conditions and Events e Right click the symbol area A popup menu opens e Select Connect The Events dialog box for the current target microcontroller opens 8T72212G2 in the example It sh
141. ns then Project The Analyse options dialog box opens with tabs for you to select daughter dialog boxes Wi 2 The Code Generation dialog box is the first of the tabs f you deselect the Generate source code option the Invoke assembler and Generate in erre eds final hex code options Will v 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 and the creation a binary hex version of the code a hex obj or s19 file depending on the microcontroller as described on page 93 Iv Include project data in source code 5 94 209 Chapter 8 Changing the Compile Options M A 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 e 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 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 fee Analys
142. nt 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 6 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 constant 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 6 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 act
143. o 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 6 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 7 on page 67 encompasses all of the main functions required in assembler code and should you need a very specialized symbol for your application 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 Givin
144. oject scheme you will be prompted to create a new subscheme lt 133 209 Defining a New Subscheme Symbol Chapter 10 e If you always wish your new subscheme symbol to reference the same subscheme file enter the name of the subscheme file for example custom sch in this attribute field with its correct path I e the project folder in which the subscheme file will occur Note Hemember 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 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 sch 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
145. om the process you are defining then linking it to the macro it represents All the files and definitions 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 ST Simulator Load the code into anST microcontroller 20 209 4 Chapter 3 Project Files 3 CREATING OPENING AND SAVING PROJECTS 3 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 3 2 Creating a New Project To create a new project 1 Click Project 2New 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 x Save In 3 Heating F fed eres Click here to create a new folder Click here to move up one folder level Type the name of your ne
146. ompile Options 0 0 0 ee 93 8 3 Executing the Analysis and Compile 0 0 0 ees 97 8 4 What to Do if there are Errors Found during Analyse 98 8 5 Viewing and Tracing Generated Messages 000 eee eee ee 99 8 5 1 Viewing the Analyse and Compile Report 99 6 6 Printing REPOS aeaa aed coda d Goer ec wim n Re E EUR D RC hee Sen Poo ale i 102 SIMULATING YOUR APPLICATION leere 103 9 1 Working with Simulation Environment Files Less 103 9 1 1 Creating a New sef File 0 0 cee ees 103 9 1 2 Opening an Existing sef File 0 0 cece 105 9 9 5avihg dleoBb RIG cuiua de dedo eot d o re e rid 105 9 2 Setting Adjusting and Viewing Input Values 0 0000 eae 106 9 2 4 Setting Fixed Input Values 0 0 0 cee 107 9 2 5 Setting Variable Input Values lille 110 9 2 6 Setting Sinusoidal Input Signals llle 112 9 2 7 Setting Square Wave Input Signals 00 00008 114 9 3 Monitoring Signals with Probes 0 00 cee ees 115 9 3 8 X Viewing Signal Values Numerically lus 116 9 3 9 Viewing Signal Values Graphically Ln 117 9 3 10 Viewing State Machine States 0 0 0 0 eee eee 120 9 4 Selecting Adjusters and Probes naana aaaea eee 121 9 5 Running the Simulator 0 0 0 tenes 121 9 5 11 Sta
147. on 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 185 209 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 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 e 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 maximum 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 186 209 ky Appendix B
148. on to the Target Device All signal inputs to the application are supplied by one or more of the microcontroller s input 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 ref
149. ons 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 buttans Analyse Go Simulate Go Edit Delete Separator Select amp wire Group Separator Analyse Results B Previniigs Messane Up Down Separator Default LIE Cancel lt 163 209 Customizing Toolbars Chapter 11 11 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 5 To delete a button from the toolbar click its name in the Active buttons box then click y Click OK 11 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 could 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 Click the Separator button then click OK 11 6 3 Changing the Order of Toolbar Buttons 1 2 In the Active buttons box click the button you want to move Click Up to move the button one place to the left or Down to move the b
150. operties from the popup menu 10 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 Type Label 5 Number 3 Color mm Edit 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 167 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 141 To draw an ellipse or a circle 1 142 209 Click on the symbol editor toolbar or select New Arc in the popup menu Click once where you want the centre of the ellipse to be 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 4 Chapter 10 Defining a New User Defined Symbol v Tip Note that the position of your cursor in x and y coordinates appears in the TS status bar at the bottom left of the symbol editor window w
151. or press the or Group of Del key Symbols 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 r l Changing a Symbols can have a variety of attributes that Rotate Symbol s Attributes depend on the symbol type When you place a Mirror symbol on a scheme from the symbol library you are prompted to specify these attributes However they can be changed at any point Attributes To do this e Right click the symbol A popup menu opens Copy shape Connect Edit lt 41 209 Symbols Chapter 6 Click Attributes The Select an Attribute dialog box opens Double click the line of the attribute you want to change An Edit the Value dialog box opens E Select an attribute CODE limf ValueTop 255 ValueB othom U fee Edit the value MAME Myname Cancel pm 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 ON Tip To change the value of the Constant symbols Or m Lr you may also click the Value entry in the popup menu that is specitic to this type of symbol The same Edit the value dialog box opens N Changing the You may also change the manner in which an Symbol Attribute attribute is displayed on a symbol Rotate Preference Settings Righ
152. output output output output output output ontput OULpub output output Output Total Total Total Total Total Total Total used used used used used used used bites events unsigned bytes signed bytes unsigned integers signed integers Longs Memory overview 19 Total Total used used Note RAM ROM 73 byte 1714 byte The timer pin is configured as an output lt 0UDH OSEH UOGSH P 09CH 0080H 0732H QE OESIH The pins that are not connected are defined as digital input with pull up 193 209 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 File C Program Files ST Realizer Examples Fastcnt Fastcnt asm Scheme Version 1 04 Date Tue May 18 14 06 27 1999 Used variables 52 lt Used runctrons 00 VERS US162700 ROMSIZE 4 DP_ON SDDST U SEEN EESSPOCInme SINPUT C Program Files yST Realizer libysT6260 ince INPUT C Program Files ST Realizer lib st62lib mac INPUT C Program Fites ST Reala ver lab Sto2xx mac INPUT C Program Files ST Realizer lib st62eepr mac lol cal ORG 00080H RROMSTIT AL l4 TFastent usc lp ug Reset LDI IORIOR MASK LDI HWDR OFFH LDI DRBR O10H LDL ECILE000H PerInit A initialize PORTB events Enable interrupt on PORTB 2 Poro Inat
153. output Q to be set to 1 Q 0 2 f 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 RP Q named psrff shows an M in its design ky 79 209 Time Related Symbols Chapter 7 7 4 Time Related Symbols Time related symbols perform functions where the concept of time is required This 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 53 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 TT 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 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 On Symbol An ON input bit is del
154. ows the list of events that can occur during the main loop execution and cause a specific action to be performed namely the Rotate d Mirror Lopy shape Attributes Edit execution of the code in the subscheme that follows the event symbol This list depends on the target device fe 5T72212G2 Events x Connect event to My Event Sort by event Available events Connected events Upon sub scheme input change Filter sch Timed interrupt 0 01 Sec Periodic My Event Upon sub scheme input ch Timed interrupt TimerB Capture 1 interrupt Timer Compare 1 interrupt Timer Capture 2 interrupt Timer Compare 2 interrupt Timer Overflow interrupt Properties OK Cancel In the example ST72212G2 the event Upon subscheme input change has been associated with the event My Event oelect Upon subscheme input change in the left window pane and click the right arrow or double click the line Click OK 61 209 Subschemes Execution Conditions and Events Chapter 6 Configuring a Periodic Event Note v Tip a af Configuring a Timed Interrupt Event voz Tip a qu Configuring an NMI Interrupt Event ST6 devices only Configuring an Input Interrupt Event 62 209 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 01s
155. ple 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 64 209 lt Chapter 6 Table Symbols 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 aah 10h 14h 20h 30h 40h 100h C m J 9 14 ST Realizer stores table data in ASCII text files that have the extension TAB Inserting a Table Symbol Changing table data format Editing table data lt The Index and Lookup table symbols are named indextable and lookuptable and are stored in the main library under the Table functional category Double click inside the table symbol 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 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 E Table editor Import Cancel 65 209 Table Symbols Importing files Into tables Note
156. rcuit 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 ky 179 209 Analog Multiple Key Decoder Appendix B Sample Applications Figure B7 Multiple Key Press Depending 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
157. re 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 see that the square wave adjuster has been connected to the pin called Setpoint which is also the name of the input symbol Note that the square wave adjuster shows the name of the pin whose input the adjuster controls Set the signal amplitude duty cycle and frequency by SCE Misa RET CMP2 A ICAP2 A CMP1 A Heatingls OH Temperature ICAFP1_B Setpoint RITE S e Double clicking the adjuster ICAP2_B II Or Increase size e Right clicking on the adjuster and selecting Properties Decrease size from the popup menu shown at right Properties 114 209 Ay Chapter 9 Monitoring Signals with Probes The Change square wave adjuster dialog box opens fee Change square wave adjuster E3 Battam 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
158. res 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 Ay 151 209 Defining a New User Defined Symbol Chapter 10 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 example 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 fol
159. 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 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 ky 15 209 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 6 4 on page 51 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
160. rgest 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 4 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 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 as
161. rking 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 Click iQ then click the blank area in the scheme worksheet View You may also click the Zoom in entry in the View cascading menu you obtain by clicking the blank area in the scheme worksheet Note Zooming in magnifies the view by 200 Zooming in ona Click ia then select the area of the scheme you want to zoom in on Selected Area Using the Zoom Click a then click the blank area in the scheme worksheet Out You may also click the Zoom out entry in the View cascading menu you obtain by clicking the blank area in the scheme worksheet Note Zooming out reduces the magnification by 509 Using the Full Click CI Screen View You may also click the Full view entry in the View cascading menu you obtain by right clicking any blank area in the scheme worksheet Redefining the View Click El then click where you want the new centre to be on the Center of your scheme Scheme You may also click the Pan entry in the View cascading menu you obtain by clicking the blank area in the scheme worksheet lt 48 209 Chapter 6 Printing the Currently Active Scheme v Tip a N Printing all Project Schemes Viewing Hidden Attributes lt Working in Schemes Click the File Print sequence in the main menu bar Continue the normal pr
162. roject gt Close 3 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 f 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 ly Tip If you save your project to a different folder all of the schemes and subschemes a associated with the project will also be saved to the new folder w lt 23 209 Saving Projects 24 209 Chapter 3 Chapter 4 ST6 or ST7 Devices 4 SPECIFYING THE TARGET HARDWARE DEVICE 4 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 o T Realizer does not support any RAM or ROM paging except for static pages Because of this the ROM size is limited to 4 kilobytes and the RAM size to 128 bytes The Max ROM
163. ronment files as you can do with any other type of file 9 1 1 Creating a New sef File The first step in simulating your application is to create an associated simulation file oimulation 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 idee indo Simulator F bal Editor Ct Help ST Simulator will open in a separate window cvm F11 lt 103 209 Working with Simulation Environment Files Chapter 9 3 In ST Simulator select the qm E File menu and click New Ik i i Inl alum emermmmiert Open Ctrl O Text In the cascading menu that Clase appears select Simulation Saye Cire environment fuus HET Soe all Erit EEE Frinter setup Exit Alt F4 The Create a file dialog box opens letting you specify the name of your 9avem C Heating e new simulation aa Main sef environment sef file Create a new file File name Save as Hype Environments sef Cancel 4 Type the name of the sef file 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 SCE If you double clic
164. rting Stopping the Simulation 0 0 0 0 eee ee 122 9 5 12 Setting Run Options 0 00 00 cee ee 122 9 6 Recording and Reusing Adjuster and Probe Values 124 9 6 13 Recording Adjuster and Probe Values 00005 125 9 6 14 Reusing Adjuster Values llle 126 ky 5 209 Table of Contents 10 CREATING YOUR OWN SYMBOL ee 129 INEST 129 10 2 Running the ST Symbol Editor llle 129 10 3 Defining a New Subscheme Symbol 00 000 cee es 130 10 3 1 Adding Your New Subscheme Symbol to a Library 133 10 4 Defining a New User Defined Symbol 00000 eee eee 135 10 4 1 Defining the New Symbol 20 00 eee ee 136 10 4 2 Editing the New Symbol 2 0 140 10 4 3 Adding Pins to Your Symbol 00 ccc eee 145 10 4 4 Assigning Attributes to Your Symbol usns 146 10 4 5 Modifying Existing Attributes llle 149 10 4 6 Creating the Macro Header 0 cee eee 151 10 4 7 Creating the New User Defined Symbol Macro 151 10 4 8 Writing the Assembly Macro 0 0 0 ee eee 152 10 4 9 Adding New User Defined Symbols to a Library 155 11 CUSTOMIZING ST REALIZER esee 157 11 1 Automatically Saving Your Work and Setting Screen Preference 158 11 2 Attribute Display Preferences
165. s aded d inta etd 167 TIN TS 167 0 LDM 167 View hidden attributes 49 Viewing simulated signals 115 208 209 symbol information 44 W Wires changing attributes 46 CODVIDICI ciieboutett eise OE de tete 45 CONC UIA G anctiecrancchbaceatesassstetases aa 45 GFaWIFIG uii ata n stet ua colum 44 Agia kel alate NER T E m 45 MOVING ee 45 er gre p 45 Otang petto D M 46 Wiring symbols together 44 automatically sirieias 45 WORD mm NU ERE EUN 167 Z ZOOM VIEW s ieiscd etie La actore ecu EE Re eins 48 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 STMicroelectronics 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 registered trademark of STMicroelectronics Intel is a U S reg
166. s 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 e Lock the door The digits used for the code are received serially and are announced by the activation of a flag ky 175 209 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 sequencing the secret code storage in the EEPROM and the code recognition Figure B1 Coded Door Lock Block Diagram Lock the door u Change secret code Sequencing Control EEPROM to door Code locking Recognition System Digit reception flag O u i eb E 2 o 2 O pum LL Digit value B1 3 Sequencing
167. s 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 controlling hardware dependent interrupts than as an all purpose condition trigger ky 55 209 Subschemes Execution Conditions and Events Reset entry point Initialization Normal Code Execution Subscheme Symbol Normal Code Execution event symbols Subscheme Code Event 1 a Event 24 out1 out2 Chapter 6 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 ha
168. se Blz Record Ltrl Fle2 Information To run the simulator Click Or In the Simulate menu click Start To temporarily stop your i Click L Or simulation In the Simulate menu click Pause 1 Open a log file see Recording and Reusing Adjuster and Probe Values on page 124 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 9 5 12 Setting Run Options Before you run your simulation you should consider which run options you want to set The run options are Whether you want to run the simulation continuously for a set number of loops or for a set time period 122 209 ky Chapter 9 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
169. sed 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 count 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 macro 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 x 172 209 Appendix A Variables and Attributes Attribute Types TIME see DEVICE
170. select it Analyse F11 Prnt E Select target hardware x Curent ST 72212532 Two 16 Bit Timers SK ROM 256 Bytes RAM 4 Target hardware devices HL ST 210 16 Bit Timer SPI ch 4 5T 212x Two 16 Bit Timers SPI SCI Pe oT ToT 30 1 Rit gem aK ROM OE me RAM 577225 A D Converter Two 16 Bit Timers SPH 12C J 5T 231 A D Converter Two 16 Bit Timers SPI SCI 57 7233s A D Converter Two 16 Bit Timers SPI SCI EEPROM Cancel 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 Ifyou 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 46 27 209 Hardware Configuration Chapter 4 4 3 Hardware Configuration 4 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 configuring general hardware options e Memory tab for setting hardware memory options
171. sociate 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 ky 171 209 Attribute Types Appendix A Variables and Attributes DEVICE cont d DEVICE TIMER which extends the macro argument list with a time value atime 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 attribute results in the following macro call extensions If the TIME attribute exists time I time timer I timer 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 u
172. t bs DPBS BIT Input y Not connected of PB DIGIC 2 BIT i QUEDput jy 20 mA sink open drain output ie PEs Digi 29 msd BIE JQUEDHUE Jj 20 MA sins open drain Output 8 PA O a segment BIT OUtp t Jy 5 mA sink open drain output 9 Vad Jy Power supply 10 Vss sg Power supply 11 PA 1 b segment BIT Output 5 mA sink open drain output 12 PA 2 c segment BIT DULDUE 7 5 mA sink open drain output 13 PA 3 d segment BIT QQUELDULI 5 mA sink open drain output Tas OSCan Py Oscillator tos dqOSCQuE ju Oscillator T6 RESET BIT Daou Yy Active low 17 NMI BILT LAPUT sy Non Maskable Interrupt 18 PC 4 f segment BIT Output 5 mA sink open drain output 193 PC 3 g segment BIT dDOUPEDUE 5 mA sink open drain output 20 PC 2 e segment BIT OU DUE 5 mA sink open drain output 192 209 ky Appendix B Sample Applications Hardware connections Fast Counter Application Symbolic name DIGIE Digit Digit Digit QO UCLsd il 2 3 msd a segmemnt b segment c segment d segment e segment f segment g segment Variable overview H W name PB PB PB PB PA PA PA PA PGi PC E Co 4 PoCtobo0r 0o 1o0oHn e Description 20 mA sink open 20 mA sink open 20 mA sink open 20 mA sink open 9 O U GT CH U 6 mA mA mA mA mA mA mA sink sink sink sink sink sink sink open open open open open open open drain drain drain drain drain drain drain drain drain drain drain
173. t click the attribute field in the Tag symbol of interest value A popup menu opens Point of Effect e Select Properties Properties 42 209 lt Chapter 6 Mirroring a Symbol or Group of Symbols Rotating a Symbol or Group of Symbols ky Symbols The following dialog box opens fe Change properties ES Color EH Tag SIze 2 m m Comment Alignment Value Horizontal Left Pumps peedContral E Vertical Cener E k 4 d Direction Normal Visibility Tag M 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 Ho You may also use the Mirror option in the popup menu associated with the symbol right click the symbol To mirror a group of symbols select the group then Lopp click with the right mouse button Duplicate A popup menu displays Choose Mirror Rotate ER iid 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 w
174. t from the library dialog box and select Place 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 JI a A dialog box having the name of the open scheme in the title opens It contains a list of all the symbols used in that scheme ii Select the symbol you want to place condition consti digout input Ir limf mul Click Place E You may also double click the name autputlatch in the list S state statein stateinit 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 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 with 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 39 209 Symbols C
175. t 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 avere Fiker Limit In a Inpul ch The a shown in Figure B18 calculates the moving average over 4 samples every 3 seconds Figure B18 Fast Counter Input section Fd C lacter JUL 3 D C lacking walu ina D t lt 189 209 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 oscillator 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 ECIM gns iaa A o 3 EE pe ATE tsgmiat exh E P mn Execution conditions Woon sub scheme input change The subscheme shown in d pi B21 takes care of the multiplexing of 4 7 segment displays It runs under interrupt control every 10 milliseconds z 190 209 Append
176. t jo a degrees End at jo a degrees Line thickness 0 0 n r Color E 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 BEREN 3 S In the symbol editor window select iz from the Data oc symbol editor toolbar or select New2Arc in the 7 c 4 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 10 4 2 4 Symbol Information To change the text that describes the symbol when you click the If button select Edit design notes in the popup menu and enter the description you wish in the dialog box 4 144 209 Chapter 10 Defining a New User Defined Symbol 10 4 3 Adding Pins to Your Symbol The pins you place wm nd wid represent the variables that are Input autput Input input to and output Type from the symbol you are defining abel To place a pin Number 5B 1 Click in m Color Hl E dil the symbol editor toolbar or select New gt Pin in the popup Cancel menu The Create 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 argum
177. tails on why this is Once you have entered the Timer options you wish click OK The last 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 8 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 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 54 ky 97 209 What to Do if there are Errors Found during Analyse Chapter 8 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 step Bun by step Open Close ST Analyser Status Hardware select Status Mo errors Hardware settings
178. tdpeni timet rein 171 GIGI SYND kerasan 46 Digital input symbol se 46 202 209 dIgolt SVITDOLi sna essee necati attis taste 46 Displaying simulation information 122 Drawings OXDOFUFQ eeoa dedans 106 in symbol shapes 142 E Earlier versions of Realizer opening projects from 22 Editing table data 65 minii 31 Environment options sssssee 157 Error Message Sereen trs 93 eventenable symbol 46 EVEN uode tatet ot htc acdsee abate 51 COMPO UN IING iieri entes des E csi tudueboe es 61 description Ol scu edema esie Des 51 AP HEEHDEETEU DL oe ee eR oreet ttd 62 IDtFOGHCLOR 10 cott ets 16 introduction to event symbols 17 introduction to execution conditions 16 NMSA ieena 62 Denodd Cresen 53 61 peripheral interrupts 55 peripheral specific 63 je iejb zieHe t 53 subscheme input change 61 SVITIDOL s Sodann dub etsi 46 SVITIDOIS aee Becta uvae 17 51 55 target dependent 62 timed Interr pls uei oi 54 upon subscheme input change 52 Execution Conditions 16 51 Exporting draWilgS senec ied tete 106 r Files zl wr 93 executio EU heheh AE 1
179. ted 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 Report KK warMMEREEEEEEENM Select Analyser messages in the View menu Fiefresh view EN mesme sthibites The Analyser messages window for the last analysis opens 2 Double click any displayed message to view its origin 8 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 m mem during the analysis and compilation process This report provides you with useful information such as the input and output connections you made and gives an overview of how much memory is used by the application Analyser messages Refresh view Ctrl F Invisible attributes To see the report on the View menu click Report An example of an application report is shown on the following pages Ay 99 209 Viewing and Tracing Generated Messages ST72212G2 Realizing Unit V4 00 Chapter 8 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 Wed Apr 14 13 14 40 1999 No errors C Program Files ST Realizer Examples Heating heating sch Scheme C Program Files ST Realizer Examples Heatin
180. ted 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 triggered 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 7 How ST Realizer Keeps Track of Time S T 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 95 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 imer ticks may be used to control the processing time of a main loop cycle Th
181. the Numeric Adjuster Change the value 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 Value box to change the value of the numeric adjuster as shown above by right clicking the adjuster and Increase size selecting Value from the popup menu at right Decrease size Properties z Chapter 9 Setting Adjusting and Viewing Input Values If you select the Properties option in the popup menu a large dialog box will open entitled Change numeric adjuster From this dialog box you can several numeric adjuster options described in Table 2 fee Change numeric adjuster Radix Decimal Value T Step Step fast 10 W Extended Cancel Table 2 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 valu
182. 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 Scheme Subscheme Input signal from MCU pin port or peripheral p Output signal to MCU pin or port Additional inputs from MCU pins ports or peripherals are possible Subscheme ky 13 209 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
183. 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 95 lt 111 209 Setting Adjusting and Viewing Input Values Chapter 9 ON Tip Note in the example shown below that in addition to being able to view the G 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 fee Change time table adjuster 3 wp T time 00 00 00 0000 00 00 00 0000 B8 L4 mmwmr 0 C wenn MEME Import Cancel 9 2 6 Setting Sinusoidal Input 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 4 112 209 Chapter 9 2 Click 3 Click where you want the adjuster to app
184. 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 the simulation a time of 10 seconds will take 10 seconds This mode is less accurate than the target time mode 9 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 x 124 209 Chapter 9 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 0 0 O O 0 9 1 9 10 1
185. tive to change the pin data types if necessary and to add some graphical detail to better distinguish the symbol 10 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 4 140 209 Chapter 10 Defining a New User Defined Symbol 10 4 2 1 Accessing Editing options from the Symbol Editor window e n the scheme right click the symbol you wish to edit Ely The symbol editor popup menu will appear as at right allowing a number of options Most of these options also View d 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 to edit description create heading to define a new pin AMELE Fin Rectangle lo draw a rectangle an ellipse dit design notes Arc E Create heading 10 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 lt 141 209 Defining a New User Defined Symbol Chapter 10 3 Select Pr
186. tom F Direction Normal Visibility Tag M 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 disappear from the symbol Our stepper symbol will now appear as at right Step Value 1 v 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 c 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 41 Recall from page 135 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 4 150 209 Chapter 10 Defining a New User Defined Symbol The next step is to create a macro header for the symbol and then write in assembler the macros that will define how the symbol functions 10 4 6 Creating the Macro Header In the symbol editor popup menu select Create
187. umber of ticks elapsed in main loop cycle 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 Optimized part Periodic Optimization Update timer datastructures 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 tick is provided on page 95 ky 53 209 Subschemes Execution Conditions and Events Chapter 6 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 t
188. unction 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 microcontroller s 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 11 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 e Call the following subroutines that are created by S T Realizer ky 29 209 Hardware Configurat
189. ur application For more information please refer to the ACTUM Solutions web site yA 1 http www actum com ACTH Saluti lt 11 209 ST Realizer Application Structures Chapter 2 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 ROS start designing your application so that you are aware of how best to optimize available resources such as memory Initialization There are two main parts to each ST Data memory Realizer assembler application The first part is a series of initialization macros that are embedding automatically and Keep track of that make up the Realizer Operating System ROS The ROS sequentially initializes the microcontroller it s I O s Read inputs Calculate data Main peripherals and memory in much the Write outputs Loop 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 Applicatio you create Updating of Copies and State Machines Peripheral IRQs The figure at right shows a flow chart of Interrupt the overall structure of the generated assembler code that ST HRealizer produces 2 2
190. ur 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 158 209 5 Chapter 11 Attribute Display Preferences 11 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 Aaverces Jti Paco Pim Sambal Teo Y wira Color EH i Size 2 m m Alignment Horizontal Center F Vertical Center gt UE 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 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 lt 159 209 Worksheet Layout Preferences Chapter 11 11 3 Worksheet Layout Prefer
191. utton one place to the right Repeat step 3 until the button is in the required position Click OK when you have finished ordering the buttons 11 6 4 Restoring the Default Toolbar 1 Click Default 2 Click OK 164 209 ky Chapter 11 Wire Drawing Options 11 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 v Snap to object at v Auto wire Stop auta wiring after Wire calor Junction color UE 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 With 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 lt 165 209 Wire Drawing Options 166 209 Chapter 11 4 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 cr
192. ve 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 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 symbol will have the binary value 0 as its input signal and the rest of code sequence B will be executed in accordance Symbol sequence C will be performed unconditionally there are no event symbols connected to this code sequence 56 209 lt Chapter 6 Subschemes Execution Conditions and Events e If 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 e If neither Event 1 nor Event 2 is triggered no part of the subscheme code
193. w project here File name heating Save az Ippe Project files rpf 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 lt 21 209 Opening an Existing Project Chapter 3 3 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 OF a Click File gt Open or Lay You must specify the rpf extension The Open a File dialog box opens Open a file Look in 3 Heating heating rt 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 3 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 4 on page 25 once you have opened the earlier version project lt 22 209 Chapter 3 Closing a Project 3 5 Closing a Project To close a project Click File gt Close or P
194. will be performed 6 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 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 events 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 perip
195. window this represents the physical limits of the symbol 5 Specify the number of input and output pins Vly Oz Tip 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 fee Select the input pin properties Fin 1 Label In Pin Label In2 Pin 3 Label LN Back Next gt Click Next when you ve finished 131 209 Defining a New Subscheme Symbol Chapter 10 A new dialog box opens where you specify labels for the subscheme output pins im Select the output pin properties Click Next when you ve finished The Generate the symbol dialog box opens lil Generate the symbol Click Finish to generate the new symbol 132 209 ky Chapter 10 Defining a New Subscheme Symbol The new subscheme symbol is automatically added to the ocal symbol library for the project in which you are working To save the symbol in a library accessible to all projects follow the instructions in Section 10 3 1 mkl To place it in your scheme click L as explained on page 39 custom sch In our example at left the new subscheme symbol has 3 input pins and one output pin The associated subscheme is named custom sch however you may choose to leave this attribute field non specific by leaving the placed by default for example 10 3 1 Adding Your New Subscheme Symbol to a Librar
196. xt 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 10 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 167 4 146 209 Chapter 10 Defining a New User Defined Symbol To assign an attribute 1 Click Sl in the symbol editor toolbar or select NewAttribute popup menu The Create attribute dialog box opens E Create attribute 3 Color EN Edit Tag SIZE 2 m m TT Alignment Horizontal Center E Vertical Center EE Direction Noma F Visibility E T ag Iw 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 If 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 View Invisible attributes from the main menu For our Stepper symbol
197. y 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 VXLib folder To do this 1 Open the project where you have created the new subscheme symbol s Open the scheme where the new subscheme symbol is re 2 Open the local symbol library by clicking L 3 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 4 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 5 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 pr
198. ymbol 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 Time 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 Note When the input sequence is enabled the physical input is read immediately Comment 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
199. ymbols connected to microcontroller output pins such as digout a Connect option will be shown 2 Select the symbol to be copied Click i i 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 40 209 lt Chapter 6 Symbols Copying a Group of You may copy either a group of symbols or a scheme portion or Symbols 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 vel in the toolbar 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 cup l Duplicate The pop up menu shown at right will appear Select Co Rotate k py To copy the selection to the scheme page choose zar Duplicate Pasting an Object Click then drag and drop the ghost box down to the new from the Clipboard location of the symbol Moving a Symbolor To move a symbol or a group of objects 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 Deleting a Symbol Select the symbol or the group of symbols Click m
Download Pdf Manuals
Related Search
Related Contents
Kompernass A1 User's Manual Samsung 65709 User Manual Eizo CG303W User's Manual Valueline VLCB89000B network splitter Art.-Nr.: 34.024.11 I. iLive IBCD2817DPBLK User's Manual Chapter 4 Explanation of function Philips Remote control for home theater CRP653 Mode d`emploi synthétique de MCK3 Gear Head 58 in 1 Digital Card Reader + 3-Port Hub Copyright © All rights reserved.
Failed to retrieve file