Home
        DSP-2 Library for Simulink
         Contents
1.        100  Locked    Figure 41  DSP 2 robotic controller blockset    NOTE  When you are developing code for DSP 2 robotic controller  the following DSP 2  device driver blocks are not allowed in Sumulink model     e DSP 2 Analog Input Output  e DSP 2 Digital Input Output  e DSP 2 CAN Read Write   e DSP 2 PWM   e DSP 2 PWM2   e DSP 2 Encoder    CHAPTER 4  DSP 2 BLOCK REFERENCES 46    Analog Input    Description  DSP 2 robotic controller has four 12 bits analog to digital converters  ADC   with the input range from  10 V to 10 V  An output of Analog Input block  has ranges from  10 V to 10 V        Block Parameters  Analog Input  DSP2  RO0B_4l  mask   Analog Input block for OSP 2 Robotic Board    Parameters       Offset port     Sample time   1 for nhereted   z         Figure 42  GUI of DSP 2 robotic controller Analog Input block    Parameters  Analog input channel    Analog input channel of DSP 2 robotic controller  from which DSP 2  controller reads data     Offset port    If this option is selected  block input port appears  Value connected to this  input port is subtracted from ADC data     Sample time    Sample time must be an integer multiple of the base sample time  Fixed  sample time parameter      CHAPTER 4  DSP 2 BLOCK REFERENCES 47    Analog Output    Description  DSP 2 robotic controller has four 12 bit digital to analog converters  DAC    DSP RC with the output ranges from  10 V to 10 V  With parameter Analog Output   Figure 43  can be selected  on which analog ch
2.   Start time    0 0 Stop time    inf    Solver options    eio 1 isci fro continuous states   i  Fixed step size    150e 6 Mode  Auto     Output options    UK   Cancel   Help   Apply               Figure 8  Solver page    CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 10    When all the mentioned parameters are set to the correct values  you can start a build  process with single click on Build button on RTW page  After successful compilation the  following message in MATLAB command window will appear  Figure 9        8 successful completion of the ERT code generation process for the DPSF 2 board     Figure 9  MATLAB command window   Successful completion of RTW build procedure    Now you must run the DSP Terminal  the shortcut is located on the desktop  to download  generated code to DSP 2 controller  In DSP Terminal Options page  1   Figure 10  you can  navigate to directory in which the generated code is located  Note that generated code  appears with extension  hex  Select appropriate file and press Download button to download  code to DSP 2 controller  If the download is not possible  first reset the DSP 2 controller  with Reset button     If an option Download generated code to the DSP 2 controller on the RTW options page  1    Figure 16  is selected  then downloading process is automatically invoked      88 Successful completion of the ERT code generation process for the DSP 2 board      22 Downloading generated code to the DSP2 board          CHAPTER 3  DSP 2 LIBRARY FOR SIMULI
3.  33    PRBS    Description  PRBS block generates Pseudo Random Bipolar Sequence  which is mainly  used in the system identification  In GUI you can set the following  parameters  Amplitude  Mean value and Sample time   Block Parameters  PRES    S Furnction  mask     Pseudo Random Bipolar Sequence block    Parameters  Amplitude     BWR    Mean value   0  Sample time   1 for inhereted  ls     AA    Lancel   Help           Figure 34  GUI of DSP 2 PRBS block    Parameters  Amplitude    Parameter Amplitude defines amplitude of generated prbs signal   Generated signal has two output states     e Mean value   Amplitude  e Mean value   Amplitude  Mean value  Mean value of the generated prbs signal    Sample time    Sample time must be an integer multiple of the base sample time  Fixed  sample time parameter      CHAPTER 4  DSP 2 BLOCK REFERENCES 34    Incremental Encoder    Description  Block DSP 2 ENC enables sampling of the position and speed of an  aoe incremental encoder that is connected to DSP 2 controller  Figure 35 shows  Beare the GUI of DSP 2 Encoder block  In this GUI you can set two parameters   Mode and Gain  The meaning of these parameters is explained in Parameters   section below     To ensure the correct operation of incremental encoder  you must set  parameter Num of pulses per revolution  which is located on RTW Options  page  2   Figure 17   This parameter appears only  if DSP 2 target is  selected  As the name of the parameter says  you must set the number of  pu
4.  Configuration window  Figure 11   Select the variable which you want to  change in online mode and click Add to Table    button to add parameter to Global    CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 12     tunable  parameters table  Parameters Storage Class and Storage type qualifier  leave to the default values     Because an example is the best way to understand the theory of operation  an example is  presented in the subsection     Model Parameter Configuration  temp    Description    Define the global  tunable  parameters for your model  These parameters affect   1  the simulation by providing the ability to tune parameters during execution  and  2  the generated code by enabling access to parameters by other modules     source list Global  tunable  parameters    MATLAB workspace ka Storage class Storage type qualifier    simulinkGlobal  Auto  a Mw    SimulinkGlobal Auto w  SimulinkGlobal Auto  w    Refresh list Me       Figure 11  Tunable Parameters page in MATLAB 6 5    CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 13    J DSP Terminal   1 5 2001 FERI SES       a    FesetkDownload cor Prerr0PwEr 04ck 0       Figure 12  DSP Terminal   Parameters page    Example    In this example we ll show how to define exported parameters  We have a Simulink model  shown in Figure 13  In Discrete Time integrator we define parameters  as shown in Figure  14  the parameters that we want to export are in GUI of Discrete Time Integrator signed as  IC  LL  and UL   If we want to change these paramete
5.  DSP 2 controller can be found in DSP 2 user s manual     TPE A  gt  ax i   BIR C dedi  FER j    A A         ue   iad   br   i  x    T ma  F         pa  i    p         EXILI    EA E A i    aren       Figure 1  Photograph of the DSP 2 controller    CHAPTER 2  DSP 2 CONTROLLER       SERIAL PORT      FLASH 8    Power supply  SRAM OWS   2     ORK x 20 TM 320C32 60       EEPROM   2   16    Be XDS510  i MPSD Port    CAN  SAE81C90  ADM232A _RS232  interface  XCS40PQ240  INCR  ENC   RS485    LTC485 EA interface  Boundary A D D A IJO  Scan Logic    interface interface  A D  AID   A D   A D  00kS s  12bit   12bit   12bit   12bit Peeli    E  EN  SS EA OAV id OY pa ALS LS    Figure 2  Block scheme of the DSP 2 controller       EEPROM  interface       CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 5    3  DSP 2 library for Simulink    After successful installation of the DSP 2 library  installation process is explained in chapter  3 1   this library can be opened with dsp2lib command in MATLAB command window  DSP   2 library will appear  Figure 3   It contains the following blocks     e Basic Blockset  subsystem contains the DSP 2 device driver blockset  Figure 25      e Robotic Blockset  Subsystem contains Simulink blocks for DSP 2 robotic controller   Figure 41      e Doc  DSP 2 documentations in pdf format   e Demos  link to DSP 2 basic examples   e New model  more about this option can be found in chapter 3 2 on page 7     e About  general information   s about DSP 2 library for Simulink   Tah
6.  E E e 47   DIO ta IIT T euva ee ewan Chan pecan a AG gad aa wie ee ue es 48  DIGIEAISOUL Uriarte 49  ENCON Ramsar oh eat ce a ie 50  Encoder POSITION  POSO seron a A ta 52   Ads R LT PLANTS ia cdas 54  5  BLOCKS THAT ARE NOT SUPPORTED WITH EMBEDDED C FORMAT               55    TABLE OF FIGURES    Figure 1   Figure 2   Figure 3   Figure 4   Figure 5   Figure 6   Figure 7   Figure 8   Figure 9     Figure 10   Figure 11   Figure 12   Figure 13   Figure 14   Figure 15   Figure 16   Figure 17   Figure 18   Figure 19   Figure 20   Figure 21   Figure 22   Figure 23   Figure 24   Figure 25   Figure 26   Figure 27   Figure 28   Figure 29   Figure 30   Figure 31   Figure 32   Figure 33   Figure 34   Figure 35   Figure 36   Figure 37   Figure 38   Figure 39   Figure 40   Figure 41   Figure 42   Figure 43   Figure 44   Figure 45   Figure 46   Figure 47   Figure 48   Figure 49     ll  TABLE OF FIGURES   PRotodrapn  Of  he DSP 2 CONTO NS Esad oca 3  Block scheme of the DSP 2 controller errereen EAE rr 4  DSP 2 OKAY TOF SINUINK arain i aa AA AAA 5  els si ITS CID ary BROWSER ici D  new  MOG SGU TTT 7  NEW SIMUUINK Modelado ai 8  RIW page  itp MATLAB 6 AAA IA 9  SO Ver Dadas 9  MATLAB command window   Successful completion of RTW build procedure         10  DSP Terminal   Options PAQC    cccccccccccnnncccnoncncnonnn rn rrnn rra rr rr rr 11  Tunable Parameters page in MATLAB 6 5          ee 12  DSP Terminal   Parameters page Ke ETO TE at RAR E A ETEL Tt TREE 13  SIMPIS SIMUMAK MOJO aii daa i
7.  Library  dsp7lib    File Edit View    DSP 2 Library for  Simulink    Faculty of Electrical Engineering  and Computer Science  Smetanova 17   2000 Maribor   Slovenia   INSTITUTE OF ROBOTICS       Figure 3  DSP 2 library for Simulink    Note  Blocks in basic and robotic blockset can also be accessed in Simulink Library Browser   Just open the Simulink and click on plus sign near DSP 2 controller text  Figure 4      CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 6    ba simulink Library Browser  File Edit View Help     E Sal Find      Welcome to Simulink   Tip  For more tips  see the Simulink documentation       Simulink  C Basi   a  L7  Aerospace Blockset Basic Blockset      CDMA Reference Blockset   R   Communications Blockset Plants   Plants   S Control System Toolbox   Ml DSP Elockset Robotic   Robotic Controller Blockset    S DSP 2 controller      Basic Blockset       H Plants   J Robotic Controller Blockset   K Dials  amp  Gauges Blockset      Dutchroll Blockset for Simulink   N Embedded Target for Motorola MPC5   M   Embedded Target for TI C6000 DSP   Wa  Fixed Point Blockset   MA Fuzzy Logic Toolbox   Gal MPC Blocks   S NCD Blockset   R Neural Network Blockset   M   Real Time Windows Target   S Real Time Workshop    111          Ready    Figure 4  Simulink Library Browser    3 1  DSP 2 library setup    Before the installation of DSP 2 library for Simulink  the following software must have been  installed on personal computer     e MATLAB  6 5  6 5 1 or 6 5 2  e Real Time Worksho
8.  Name    Analog Input 1 Gain   mooo  Analog Input 2 Name    Analog Input 2 Gain                         Oversampling Factor        Carcel   teo      Figure 27  GUI of DSP 2 Al Oversampling block  Outputs  Outputs Al X  X 1  2     Output AIX  X 1 2  is oversampled value of the signal connected to  Analog Input X  Oversampling means  that the signal is measured n times  during one period of PWM signal  Output AIX  X 1  2  is the vector with  n elements  Dimension of this vector is defined with    Oversampling  Factor    parameter in block GUI     Parameters  Analog Input X Name  X 1  2     For each output channel  the user can assign custom name  This name    will appear in Terminal GUI after executable code deploying on the DSP 2  target     CHAPTER 4  DSP 2 BLOCK REFERENCES 26    Additional  notes    Analog Input X Gain  X 1  2     Each sampled value in analog input channel X  X 1  2  can be scaled  with parameter Gain     Oversampling Factor    Oversampling factor defines how many times the signal will be measured  in one period of PWM signal     Parameter range  1  lt  Oversampling Factor  lt  8  Default value  1    Note  In the  Oversampling Factor  field the user can enter the variable  name  If the variable is not yet defined in MATLAB workspace  the size of  each output vectors will be automatically set to 1     Sample time    Sample time must be an integer multiple of the base sample time  Fixed  Sample time parameter      After deploying executable code  generated fro
9.  with Embedded C format    Code for  Embedded C format  does not support the following blocks   e Continuous  o No blocks are supported   e Discrete  o First Order Hold  e Functions and tables  o MATLAB Fcn    o Following S function  M files or Fortran S function  and noninlined C MEX S   functions     o Algebraic Constraint  o Matrix Gain  e Nonlinear    o Rate Limiter    e Sinks  o XY Graph  o Display  e Sources  o Clock    o Pulse Generator  o Ramp  o Repeating Sequence    o Signal Generator    
10. NK 11    Mi DSP Terminal   1 5 2001 FERI    Pause   Scroll  SaveToFile  Parins Trigger      0 r  Q Pre samples E          200001    DSP reset   Program    download       FesetkDownload com  PrErr 0PwErr 0Ack 0    Figure 10  DSP Terminal   Options page    3 4  Online changing of block parameters    DSP 2 library in combination with DSP Terminal enables online changing of the Simulink  block parameters  while the code is executed on the DSP 2 controller  Parameters of blocks   which are placed in Simulink model  must be stored in local or global variable in MATLAB  workspace as real scalar values     Which parameters are changeable in online mode depends on Inline parameters button on  Advanced page     If Inline Parameters button on the Advanced page is NOT selected  than all scalar  parameters of each block placed in the Simulink model will appear in the Parameter  Inspector window of DSP Terminal     When the Simulink model is pretty complex  a  lot of parameters appear in the Parameter Inspector window  Usually we want to  change only a few parameters in online mode  therefore option  described in the next  section is much more appropriate     If the Inline Parameters button is selected  than you can define which parameters  you want to tune in online mode  This can be done on Tunable parameters page   Figure 11   This page appears  if you select  Configure    button on Advanced Page   The list of MATLAB workspace variables is placed on the left side of the Model  Parameter
11. P 2 BLOCK REFERENCES 22    4  DSP 2 block references    4 1  DSP 2 device driver blockset    In the following subsections detailed description of individual DSP 2 device driver blocks are  explained     CHAPTER 4  DSP 2 BLOCK REFERENCES 23    Library  dsp2lib1 AE DSP 2 device driver blockset contains  File Edit View the following blocks     e Analog Input  DSP 2 device driver    blockset  e Analog Output    DSF 2 DSF 2  aa F ee e Analog Output Differential  DSP 2 e Digital Input  DI 0 DO 4 o  e Digital Output  DSP 2 FA   DSP 2 TA  pepa 0x880020 e From Address  n G e To Address  Temp Temp      DSP 2 CAM e PRBS  IDO IDO    e Analog Input Oversampling    a  C  E  EJ    al  wa  FO  E  C1  i   rar    e Incremental Encoder  ae   e Modulator   e PWM   e To File   e To Terminal   Pulse e From Terminal    Generator    e Transformation blocks    PROS       ER       Figure 25  DSP 2 device driver blockset    CHAPTER 4  DSP 2 BLOCK REFERENCES 24    Analog Input    Description  DSP 2 controller has three fast analog inputs  signed with 0  1  2 in GUI   See and one    slow    analog input  which has an 8 1 multiplexer placed on its  E input  signed with 3 0  to 3 7  in GUI   Algorithm of this block is made so   that at the start of each ISR DSP performs sampling of all three fast analog  inputs and one of eight signals that are connected to multiplexer  In each  interrupt  sampling of different port of    slow    analog input is executed   Because multiplexer type is 8 1  that means  that 
12. University of Maribor  Faculty of Electrical Engineering and Computer Science  Smetanova ulica 17  2000 Maribor  L Slovenia  La pra INSTITUTE OF ROBOTICS       DSP 2 Library for Simulink    User s Manual       Author  Darko HERCOG  dsp2lib version  1 5 1  Terminal version  1 5 6    MATLAB version  6 5  Contact  darko hercog uni mb si    March  2007 DSP 2 Library for Simulink    TABLE OF CONTENT 1  TABLE OF CONTENT   L  PREFACE A a e or idoS 1  2  DSP 2 CONTROLLER cu    rida 2  3  DSP 2 LIBRARY FOR SI IMUELINK iii 5  Se Le   DSP Z LIBRARY SETUP anta dar taa ao iaa 6  32      CREATING A NEW MODEL raid riada oir 7  Bro  CODE GENERATION  ai AAA A Ea 8  3 4  ONLINE CHANGING OF BLOCK PARAMETERS         e 11  325   IDSIP Z OPTIONS id NAAA A Gc we eae Ree 15  BiG  DSP   2 DEMOS maera a aaa Nusa na ay areas eae ae oa dh eee is a hin water a tae 20  4  DSP 2 BLOCK REFERENCES 0  a 22  4 1 DSP 2 DEVICE DRIVER BLOCKSE TS pr di a es 22  A  OS INDIE AAA AAA AAA A AAA 24  A  alog Beie d eU ees aeii anal 25   ANSIO OUPO Ea AA dara 27   Analog Output Different 28  DIED Eesti tried 29   Birahi EBIT  00 nent enn aaa 30  Scao te soaker e a Sten er Sent oo no 31  TOA ios 32   PRD NR E R 33  Incremental ENCO a di tios 34  Us T ae A A O O RT A A eats Gee eaten Cone ae 36   SAT 0 IC 37   A on O eat sad aa een aaa ae 38  Al HTHH 40   Er TPI eS dias 42  kran S OMM aO S uti abri a nea eaten ate 44   4 2  DSP 2 ROBOTIC CONTROLLER DEVICE DRIVER BLOCKSET  x x 45  ANACO Lat e  di ana 46  oso A e ee E TOO gu
13. an 4095 quants  or smaller than   O  the signal is limited to 4095 or O respectively     Caution  If at least one of the DSP 2 Analog Output block exists in the  Simulink model  than block AO_DIFF is not allowed to be in the model     Block Parameters  Analog Output  DSP2_A0  mask   DSP  analog output block    Parameters    Analog Output  O          Show  Output    Sample Time   1 for inhereted   s      a  Cancel   Help        Figure 29  GUI of DSP 2 Analog Output block       Table 2  Analog output ranges    DSP 2 analog output DSP 2 analog output D A converter output  V   range          Oto 4 095   O to 4 095        O to 4 095 O to 4 095       Parameters  Analog output    We can select to which analog output on DSP 2 controller  DSP will send  block input data    Show input     This option is used only in the simulation  If option is selected  than block  input appears  In the simulation block input values are copied to the block  output     Sample time     Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If sample time is set to  1  then sample time is  inherited from driving block  Default value is   1      CHAPTER 4  DSP 2 BLOCK REFERENCES 28    Analog Output Differential    Description  Block Analog Output Differential enables biporar analog output generation on  the AOUT port of the DSP 2 controller     DSP 2 40  Caution  If this block exists in the Simulink model  than block Analog Output   DSP 2 AO  is not allowed to be in 
14. and  threshold     Block Parameters  Digital Output  DSP2 DU  mask   DSP2 digital output block    Parameterz    Digital Output  lt   Operation    C maller        Threshold   o    Show Output    Sample Time   1 for inhereted   z      qo  Cancel   Help           Figure 31  GUI of DSP 2 Digital Output block    Digital output  Select to which digital output DSP will sends data  Operation    Greater   If the input signal is greater than the threshold  then the  output is set to  1  else to  0     Smaller  If the input signal is smaller than the threshold  then the  output is set to  1  else to  0     Threshold    Threshold must be a scalar real number  The meaning of this parameter  is explained in Operation parameter     Sample time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If the sample time is set to  1  then the sample  time is inherited from the driving block  Default value is  1     CHAPTER 4  DSP 2 BLOCK REFERENCES 31    From Address    Description  Block DSP 2 From Address  Figure 32  enables digital signal processor to get  EPA the data from the address in memory  In GUI of DSP 2 From Address block  canal you can set two parameters  Address and Initial value  We can select  Address only from drop down menu  because this disables input of the  wrong address  Parameter Initial value defines the value  to which the  selected address is set in the initialization stage of the DSP 2 controller    Default value of mentioned 
15. annel of DSP 2 robotic  controller  block input data will be send  If the block input signal is greater  than 10  or smaller than  10  the input signal is limited to 10 or  10   respectively     Block Parameters  Analog Output  DSP2R0B_40  mask   Analog Output block for OSP 2 Robotic Board    Parameters       Figure 43  GUI of DSP 2 robotic controller Analog Output block    Parameters  Analog output channel    Analog output channel of the DSP 2 robotic controller   to which DSP  sends block input data     Sample Time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If sample time is set to  1  then sample time is  inherited from driving block  Default value is   1      CHAPTER 4  DSP 2 BLOCK REFERENCES 48    Digital Input    Description  DSP 2 robotic controller has 16 optically isolated logical inputs  Which input      to use  can be selected with the parameter Digital Input  Figure 44   On the  DSP 2RC   ee ate hae  output of this block  signal with the logical value  0  or  1  appears   Block Parameters  Digital Input  DSP2R0B_0l  mask   Digital Input block for OSP 2 Robotic Board    Parameters    Sample time   1 for inhereted   2      RO          Figure 44  GUI of DSP 2 robotic controller Digital Input block    Parameters  Digital input channel    Digital input channel of the DSP 2 robotic controller   from which DSP  gets data     Sample time    Sample time must be an integer multiple of the base sample time  Fixed  Sample 
16. aracters  Parameter must be entered in single  quotes     CHAPTER 4  DSP 2 BLOCK REFERENCES 44    Transformations    Description  DSP 2 library contains blocks for the following transformations        DR f    R2D p    RPM 2 rads E    radis 2 RPM E    transformation from ab to dq system of coordinates   d  cos fi  a sin  fi   b  q      sin  fi    a   cos  fi   b    transformation from dq to ab system of coordinates     a   cos  fi   d    sin  fi  d  b   sin  fi   d   cost fi   q    transformation from 3 phase to 2 phase system of coordinates   L       l   ae  L  S m         above transformation equation is valid  if  i  1   i   O    Conversion from Degrees to Radians    A  180    Conversion from Radians to Degrees    E  T    D    Conversion from RPMS to rad s    adis ARPM  30    Conversion from rad s to RPMS    RPM E trad  5   TT    CHAPTER 4  DSP 2 BLOCK REFERENCES 45    4 2  DSP 2 robotic controller device driver blockset    DSP 2 robotic controller blocks can be used in Simulink model only  if DSP 2 robotic  controller is attached to the DSP 2 controller     In the following subsections individual DSP 2 robotic controller blocks are explained     DSP 2 robotic controller blockset  contains the following blocks     j gz mn  L Library  dsp  roblib isl ES  File Edit View    e Analog Input    DSP 2 robotic controller e Analog Output    device driver blockset e Digital Input  e Digital Output  AD 0  e Encoder Position Preset  e From Terminal    DSP 2 RC e To Terminal  Pos Preset
17. at every 8 th interrupt  sampling on the same port of   slow   analog input is performed  Voltage  ranges of analog inputs are shown in table below  Table 1   All A D  converters are 12 bit  that means  that on output of A D converter we get a  unipolar input range signal from O to 4095 quants  while at bipolar from    2048 to 2047 quants  On the output of this block we get value of quants  stated in table below     Block Parameters  Analog Input  DSP2_Al  mask   DSP  analog input block     Parameters    Analog Input  i  gt        Show Input    Sample time   1 for nkhereted   z        Cancel   Help           Figure 26  GUI of DSP 2 Analog Input block    Table 1  Analog input ranges    aaa ee aaa DSP 2 input range  V    A D converter output  quant   o     O to 4 095 O to 4095     2 048 to 2 047  2048 to 2047   2 048 to 2 047  2048 to 2047  3 0  to 3 7   2 048 to 2 047  2048 to 2047       Parameters  Analog input  Analog input  from which DSP reads data  Sample time    Sample time must be an integer multiple of the base sample time  Fixed  sample time parameter      CHAPTER 4  DSP 2 BLOCK REFERENCES 25    Analog Input Oversampling    Description  Analog Input Oversampling block enables oversampling of the signals  connected to the analog inputs 0  1  2 of DSP 2 controller  Oversampling    means  that these signal are measured n times during one period of PWM  K Signal        Block Parameters  Analog Input Oversampling    DSP2_AlOVERSAMPLING  mask     Parameters   Analog Input 1
18. eee  14  GUI of Discrete Time INtegrator      cccccccccccncccccnncnonocnnnncrnn rra e RT rra 14  DSP Terminal Parameters  page inicio narra ii 15  DS P2 OPUON ita Ms act 16  DS B Z ODIOS zan 17  DOS P22 OPUS a Aa 17  DSP   Z OPUS 44   ia AAA A 18  DSP 2 roDotic controller Options  Ubica 18  DSP 2 robotic controller Options  1         occcccccccccnnnccccnncncncn cnn rr rra 19  DSP 2 ropotic controller Options  2  seda 19  DSP 2 robotic controller Options  3           c cc cccce eee e eee eeee cece eeeeeeeeeeeeeeeeeessenenes 20  SZ OCR OS eich aeaciie ne s eh os ech deans tic 21  DSP 2 Gevice driver DOCK Sell a 23  GUI of DSP 2 Analog Input DIOCK             ccc ee e 24  GUI of DSP 2 Al Oversamp ling DIOCK            c cece cece cece eee ceee nets eeeeeeeeeeseeneeeeeeas 25  Automatically added objects to the Terminal GUI                ccc cece cesses eee eeeeeeeees 26  GUI of DSP 2 Analog Output DIOCK          xx ee 27  GUI of DSP 2 Digital Input  DIOCK aia iris 29  GUI of    DSP 2 Digital OUtPUt DIOCK voor aida 30  GUI of DSP 2 From Address block            oococcccocccccccccccccncnn cnn rr rr 31  GUI OF  DSP 2  To  AGGress  DIO 32  GUI  lt   DSP 2 PRBS   DOCK aida O 33  GUI OFr DSP 2 ENCOder DIOCK eestitosivhiariian sania ess 34  GUI Of DSP 2 Modulator DIOCK psnarrvicio rra ii 36  GUO DSPE PWM S10 Errata 37  GUl OT pT 2 10 FIle DIOCK ara tinas IE 38  GUI of DSP 2 To Terminal DIOCK             c cece cece cece ceee sees eee eeeeeeeeeneeeeeeeeettsnaaaay 40  GUI of DSP 2 From T
19. erminal block           ooooocccccccccnccnnnoccnnnnnn e T 42  DSP  FODOUE CONLFOIEr DIOCKS Ola citan a aaa 45  GUI of DSP 2 robotic controller Analog Input block                ccc K 46  GUI of DSP 2 robotic controller Analog Output block             ccc cence eee ees 47  GUI of DSP 2 robotic controller Digital Input DIOCK             e cece cece eee ee ee ee ee anes 48  GUI of DSP 2 robotic controller Digital Output DIOCK               ccc cece cece eee eee eee eees 49  GUI of DSP 2 robotic controller Encoder block              ccc cece cece eeeeeeeeeeeeeeeeeeneees 50  GUI of DSP 2 robotic controller Encoder Preset block               ccc cece eee ee eee e cena 52  ADDA INteiface Gal CO  di RN 54  DEMO With 3  phase  DOGG iias cds iniie meaner Verna A E aceon 54    USED SYMBOLS    USED SYMBOLS    A D Analog to Digital converter  D A Digital to Analog converter  DSP Digital Signal Processor  FPGA Field Programmable Gate Array  GUI Graphical User Interface  ISR Interrupt Service Routine  PC Personal Computer  PWM Pulse Width Modulation  RTW Real Time Workshop  TI Texas Instruments  GUT s  Name Path  Advanced page Simulink model  gt  Simulation  gt  Parameters  gt  Advanced  Diagnostic page Simulink model  gt  Simulation  gt  Parameters  gt  Diagnostic  Options page DSP Terminal  gt  Options  Parameters page DSP Terminal  gt  Parameters  RTW options page RTW page gt  category  DSP 2 options  i   i   1  4  RTW page Simulink model  gt  Simulation  gt  Parameters  gt  Real Time Wo
20. iption of each block of DSP 2 device driver blockset and DSP 2  robotic controller blockset     Chapter 5 contains a list of Simulink blocks that are not supported with Real Time workshop  Embedded Coder     CHAPTER 2  DSP 2 CONTROLLER 2    2  DSP 2 controller    As mentioned before the DSP 2 controller was developed at Institute of Robotics on Faculty    of Electrical Engineering and Computer Science  The DSP 2 controller is a high performance   floating point digital signal processor  DSP  based inverter controller designed primarily to    control a three phase AC motor  The controller is based on Texas Instruments TMS320C32  DSP and Field Programmable Gate Array  FPGA  XCS40 4PQ240C member of Xilinx Spartan  Family    The key features of DSP 2 controller are     e DSP TMS320C32 60MHz  e DSP serial interface  e Two timer general purpose I O pins  e DSP MPSD interface for XDS510 emulator  e FLASH 256K x 8   70ns  e SRAM 128K x 32 OWS  e channel simultaneous 12bit A D with serial output  e Conversion and transfer to register in FPGA 2 6 us for all four channels    e One channel with unipolar input range O to 4 095 V or O to 40 95 mA with 100 OHM  Shunt resistor    e Two channels with bipolar input range  2 048 V to 2 047 V or  20 48 mA to 20 47  mA with 100 OHM shunt resistor    e One channel with input multiplexer to select one of eight voltage input signals  e First order input RC filters  time constant 33 us for   1 and i3 and 100 us for udc   e Two channel 12bit D A conve
21. it enables online changing of the variable values  Block has four  parameters  Variable name  Initial value  Type and Unit     Block creates new variable with the name equal to Variable name  parameter  After the code generation and downloading process  in the  upper part of DSP Terminal Visual page  for each DSP 2 From Terminal  block in the Simulink model  the following objects appear  figure below      e Option box  option is disabled    e Text box   the same name as we assigned in the parameter Variable  name  in GUI of DSP 2 From Terminal block  is displayed     e Edit box   the value of the variable at the time of observation is  displayed     e Text box  Unit   the same name as we assign in the parameter Unit  in  GUI of DSP 2 From Terminal block is displayed     K 1124 TE    Now we can change the variable value  by entering different value in Edit  box     Block Parameters  From Terminal  DSP2 ET  mask   DSP2 from terminal block    Parameters  Variable name     Initial value       Show Input    Sample Time   1 for nhereted   z      ee    Cancel   Help           Figure 40  GUI of DSP 2 From Terminal block    CHAPTER 4  DSP 2 BLOCK REFERENCES 43    Parameters  Variable name    String of alphanumeric characters  Parameter must be entered in single  quotes     Type  This option is not implemented yet   Initial value    Scalar real number  The value  to which DSP initializes the variable in  the initialization stage of DSP 2 controller     Unit    String of alphanumeric ch
22. l encoders that are connected to the DSP 2 robotic controller  In  block GUI  Figure 46  you can set two parameters  Encoder and Mode  The  meaning of these parameters is explained in Parameters section below        To ensure the correct operation of incremental encoders  Num of lines per  revolution and Hardware Multiplication parameters  for each connected  encoder must have been defined on DSP 2 robotic controller options  i    i 1  4   Figure 20  Figure 21  Figure 22  Figure 23   Note  that these  parameters appear only  if the DSP 2 controller target is selected     Block Parameters  Encoder  DSP2ROB_ENC  mask   Encoder block for DSP 2 Robotic Board    Parameters    Mode    Position         Position Unit  radians  Sample time   1 for inhereted   E                   Cancel   Help           Figure 46  GUI of DSP 2 robotic controller Encoder block    Parameters  Encoder  Encoder of DSP 2 robotic controller   from which DSP gets data  Mode    Speed  if  speed  is selected then speed in rad s  radian second  of  incremental encoder appears on the output of this block    Position  if  Position  is select then the position of incremental encoder  IN appears on the output of the block  With the parameter Position Unit  the user can define position in radians or in pulses     Sample time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If the sample time is set to  1  then the sample  time is inherited from the driving block  Defaul
23. le name  Format and Unit  All parameters  except Target page of DSP Terminal must be entered within single quotes     Block Parameters  To Terminal  DSP2_TT  mask   SFZ to terminal block     Parameters    Target page of DSF Terminal        arable name      T emp    Cancel   Help           Figure 39  GUI of DSP 2 To Terminal block    Target page of DSP Terminal    Text Page  If this option is selected the value of the block input signal  appears in Text page of DSP Terminal     Visual Page  If this option is selected the value of the block input signal  will appears in Visual page of DSP Terminal     Variable name  The name of the variable that holds the input data   Format    Block input signal is stored to variable in   float   format  therefore the  parameter Format must be of type  X Yf  where X is the number of  all  and Y number of decimal places     Unit    Unit name appears after the variable value    CHAPTER 4  DSP 2 BLOCK REFERENCES 41    Example     Let us assume  that we set the block parameters to the following values   e Target page of DSP Terminal Variable  Text Page   e name   Current      e Format    3 1f  e Unit   A     If in a moment of observation the value of the block input signal is equal to  50  then on the Text page of the DSP Terminal appears the next line     Current 50 0 A    CHAPTER 4  DSP 2 BLOCK REFERENCES 42    From Terminal    Description     DSP 2 FT L  Temp    DSP 2 From Terminal  Figure 40  is source block  In combination with DSP  Terminal 
24. lope of the block input signal  Afterwards   encoder position will be preset to the value defined in parameter Encoder    Position Preset Value  i 1  3   when the encoder reference signal will  appear  disappear      Note  If you use this option  and position preset occur immediately after  positive slope of block input signal  turn Invert reference signal    CHAPTER 4  DSP 2 BLOCK REFERENCES 53    parameter on DSP 2 robotic controller options  i 1  3  page to the  opposite value     Sample time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If the sample time is set to  1  then the sample  time is inherited from the driving block  Default value is   1      CHAPTER 4  DSP 2 BLOCK REFERENCES 54    4 3  DSP 2 Plants    In addition to the DSP 2 learning module  Institute of Robotics provides DSP 2 plants which  can be easily connected to DSP 2 learning module  These plants are Buck converter  DC  motor  Figure 49   ADDA interface card  Figure 48   etc  Documentation of these plants   which include description of Simulink blocks and description of demonstration examples   could be found on the following internet address     http    www ro feri  uni mb si projekti dsp2 documentation htm           _   _   _     AENA ey  ddd   ADDA interface card       Figure 48  ADDA interface card       Figure 49  DC motor with 3 phase H bridge    CHAPTER 5  BLOCKS THAT ARE NOT SUPPORTED WITH EMBEDDED C FORMAT 55    5  Blocks that are not supported
25. lses that appear on the output of the encoder in one revolution  Default  value of this parameter is set to 10000     Block Parameters  Encoder  DSP2_ENC  mask   DSP2 Encoder block    Parameters      Show Input    Sample time   1 for nhereted   s      Ts  Cancel   Help           Figure 35  GUI of DSP 2 Encoder block    Parameters  Mode    Speed  if  speed  is selected then speed in rad s  radian second  of  incremental encoder appears on the output of this block    Position  if  Position  is select then the position of incremental encoder   in radians  appears on the output of block    Gain  With parameter Gain we can scale speed or position to the desired units   Sample time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If the sample time is set to  1  then the sample  time is inherited from the driving block  Default value is   1      CHAPTER 4  DSP 2 BLOCK REFERENCES    35    CHAPTER 4  DSP 2 BLOCK REFERENCES 36    Modulator    Description  Block Modulator transforms the desired voltage vector  which is given in a b  system of coordinates  to the relative time length of transistors conduction   Desired voltage vector is given with two inputs  while calculated switching  times appear on the output of the block  This block is used in combination  with DSP 2 PWM block  You can connect outputs of DSP 2 Modulator with  T1  T2 and T3 inputs of the DSP 2 PWM block        Block Parameters  Modulator    DSP2 MOD  mask   DSP  Modula
26. m Simulink model which  contains    DSP 2 Analog Input Oversampling    block  one numerical control      OS MODE     and two numerical indicators automatically appear in DSP  Terminal GUI  Figure 28   The names of indicators are equal to the names  entered in Analog Input X Name  X  1  2  field in block GUI     If the variable  OS MODE   Oversampling Mode  is set to O then all in graph  presented variables are sampled on the DSP 2 controller with the    basic  Sampling period     This period is equal to    Fixed step size    parameter in  Simulink model     If the variable  OS MODE   Oversampling Mode  is set to 1 then all in graph  presented variables are sampled with the  oversampling period   This period  is defined as    basic sampling period    gii T le oversampling factor    Note  Note  If  OS MODE  ts set to O  this does not mean  that the block  output vectors are empty  Oversampling is executing independent from  OS  MODE  variable  If  OS MODE  is set to O  then all in graph presented  variables are sampled with  basic sampling period          Al os       PT    Al  os    Figure 28  Automatically added objects to the Terminal GUI    CHAPTER 4  DSP 2 BLOCK REFERENCES 21    Analog Output    Description  DSP 2 controller has only two analog outputs  With parameter Analog  Ses Output  Figure 29  can be selected  on which output DSP sends block will  input data  Both D A converters are 12 bit and have the output range from O  to 4 095V  If block input signal is greater th
27. p    e Real Time Embedded Coder      e TI compiler for C3x4x family of DSP processors  Code Composer     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 7    Installation process    Put CD with DSP 2 library in your CD drive  After a while setup GUI will appear  It is  recommended  that you select default settings in all GUI   s that will appear in setup process   Setup program will copy all program files and documentations to C  FERI dsp2lib matlab6p5  folder  The shortcut to DSP Terminal will be created on desktop     Deinstallation process    In Control panel select Add or Remove Programs  In Add or Remove Programs window find  DSP 2 Library for Simulink  and select Remove     3 2  Creating a new model    If you want to build a new Simulink model  which will target DSP 2 controller  it is  recommended that you double click the block New Model in the DSP 2 library  After this GUI  in which you must enter new model name will appear  Figure 5   All the model parameters  will be initialized so that the Build process will successfully generate executable code suitable  for DSP 2 controller from Simulink model     Enter newe model name    OF    Cancel      Figure 5  new model GUI       After entering model name  new Simulink model will appear  Figure 6   Now you can add  DSP 2 blocks or built in Simulink blocks in new Simulink model     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 8    Ta temp    File Edit View Simulation Format Tools Help    NY p  Nam  bs    Edit  Parameters    Update  Paramete
28. parameter is O     Block Parameters  From Address  DSP2 FA  mask   DSP  from address block    Parameters    Access  E        Initial value     o  Sample time   1 for nkhereted   s      roo  Cancel   Help           Figure 32  GUI of DSP 2 From Address block    Parameters  Address  Address in DSP 2 memory  from which DSP gets data   Initial value    The value to which DSP initializes address  selected by Address  parameter  in DSP 2 memory in the initialization stage of DSP 2  controller     Sample time    Sample time must be an integer multiple of the base sample time  Fixed  sample time parameter      CHAPTER 4  DSP 2 BLOCK REFERENCES 32    To Address    Description  This block is similar to DSP 2 From Address block with one exception  This  block is sink block  and enables digital signal processor to store the block    DSP 2 TT  input value to the address specified in the parameter Address in  float   format  Figure 33      Block Parameters  To Address  DSP2 TA  mask   SFZ to address block    Parameters    Access  E  lt     Sample time   1 for nhereted   s      a  Cancel   Help           Figure 33  GUI of DSP 2 To Address block    Parameters  Address  Address in DSP 2 memory  to which DSP stores the block input data    Sample time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If the sample time is set to  1  then the sample  time is inherited from the driving block  Default value is   1      CHAPTER 4  DSP 2 BLOCK REFERENCES
29. ptions  3     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 18    simulation Parameters  example    Solver  Workspace 1 0   Diagnostics   Advanced   Real Time Workshop    Categor   DSP 2 Options  4    External Mode ka   Build      Options    External mode    TCP IP Address    NNN  NNN  AU NNN  TCP IP Port   14001       UK   Cancel   Help   Apply      Figure 19  DSP 2 options  4     Simulation Parameters  example    Salver  Workspace 1 0   Diagnostics   Advanced  Real Time Workshop    Category   DSP 2 Robotic Controller Options  0  ka   Build    Options  Incremental encoder U  number of lines per revolution   10000  incremental encoder U  hardware multiplication  l4     Incremental encoder U  preset value    U      Incremental encoder 0  invert reference signal       Figure 20  DSP 2 robotic controller Options  0     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK    simulation Parameters  example    Options    Incremental encoder 1  number of lines per revolution    10000  Incremental encoder 1  hardware multiplication  l4     Incremental encoder 1  preset value    U      Incremental encoder 1  invert reference signal       Options    Incremental encoder 2  number of lines per revolution   10000  Incremental encoder Z hardware multiplication  4     Incremental encoder Z  preset value    U      Incremental encoder 2  invert reference signal       E          Figure 22  DSP 2 robotic controller Options  2     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 20    simulation Parameters  example    Salver  Wo
30. rkshop  Solver page Simulink model  gt  Simulation  gt  Parameters  gt  Solver  Text page DSP Terminal  gt  Text  Tunable parameters Advanced page  gt  Configure    button  page  Visual page DSP Terminal  gt  Visual  Robotic controller RTW page gt  category  DSP 2 Robotic Options  i       0  3    Options page    111    CHAPTER 1  PREFACE 1    1  Preface    The present user s manual describes the DSP 2 library for Simulink  DSP 2 library for  Simulink enables block programming of DSP 2 controller with simulation program  MATLAB Simulink    The DSP 2 controller was developed at Institute of Robotics on Faculty  of Electrical Engineering and Computer Science  University of Maribor  Slovenia  The DSP 2  controller is a high performance  floating point digital signal processor  DSP  based inverter  controller  designed primarily to control a three phase AC motor  The controller is based on  Texas Instruments TMS320C32 DSP and Field Programmable Gate Array  FPGA  XCS40   4PQ240C member of Xilinx Spartan Family  more information about DSP 2 controller can be  found in DSP 2 user s manual      Quick overview of each chapter in this user s manual     Chapter 2 briefly describes main features of DSP 2 controller     Chapter 3 describes DSP 2 library for Simulink  It is explained how to install this library to  MATLAB environment  how to generate code from Simulink block diagram and how to  change variables or parameters of Simulink model in online mode     Chapter 4 contains full descr
31. rkspace 1 0   Diagnostics   Advanced Real Time Workshop    Category   DSP 2 Robotic Controller Options  3  ka   Build    Options  incremental encoder 3  number of lines per revolution    10000  Incremental encoder 3  hardware multiplicatiore 4     Incremental encoder 3  preset value    U      Incremental encoder 3  invert reference signal       Figure 23  DSP 2 robotic controller Options  3     3 6  DSP 2 demos    DSP 2 Library for Simulink contains a set of Simulink demo models  These demos are  available at MATLAB demos in the Blocksets section  Figure 24      To access DSP 2 demos  enter demos in MATLAB command window and then navigate to  Blocksets   gt  DSP 2 Library for Simulink  Figure 24      CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 21    Fie Edit View Go Web Window Help   Help Mavigator  2 S mnr es   DSP 2 Library for Simulink a    Contents Index Search Demos Fav                                 gt  Getting Started with Demos  DSP 2 Library for Simulink   fa  MATLAB   ade bolas DSP 2 Library for Simulink integrates MATLAB and  i Simulink  G E Blocksets    Simulink with OSP 2 controller  The software suite  lets you develop and validate digital control or  signal processing algorithms fram concept through  3 1 Aerospace code and automates rapid prototyping on your     Ti CDMA Reference DSP 2 controller        E communications    AG DSP  Sap DSP 2 Library for Simulink    Ga Basic  DC Motor Control    DSP 2 robotic board a  L          Figure 24  DSP 2 demos    CHAPTER 4  DS
32. rs       FixedStepDiscrete    Figure 6  New Simulink model    3 3  Code generation    How to generate executable code from Simulink model  Just open RTW page  Figure 8   If  you created a new model as described in chapter 3 2  then all parameters are predefined so   that you just click on Build button and code generation process will start  Otherwise you  must set the following parameters     Real Time Workshop page     On RTW page in Category option select Target configuration  The Category section will  appear  Set parameters to the following values     o System target file  ert_dsp2 tic  o Template makefile  ert_dsp2 tmf  o Make command  make_rtw  Solver page   Simulation time   e Start time  O  e Stop time  inf  Solver options     e Type  Fixed step and discrete  no continuous states     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 9    e Fixed step size  this parameter define interrupt period  It can be set to 50e 6 or  greater  but smaller than 250us     e Mode  auto       Simulation Parameters  untitled    Solver Workspace 1 0   Diagnostics Advanced  Real Time Workshop    Category    T arget configuration ka Bug    Configuration  Sistem target file    ert dep  tle Browse     Template maketile    ert dep  traf  Make command   make tw 0    Generate code only Stateflow options            UK   Cancel   Help   Apply      Figure 7  RTW page in MATLAB 6 5          Simulation Parameters  untitled    Solver Workspace 1 0   Diagnostics Advanced   Real Time Workshop      Simulation time
33. rs in online mode  we must add these  parameters to Tunable parameters page  Figure 11   Note that parameters UL  LL and IC  must be defined in MATLAB workspace  before you start build procedure  In our example  this parameters has the following values   C 50  UL 100  LL 0     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK    File Edit view Simulation Format Tools Help    D    ld S    gt  Normal                DSP 2 TT  Intez Out    Discrete Time  Integrator    100  FixedStepDiscrete       Figure 13  Simple Simulink model       14    Block Parameters  Discrete Time Integrator    Discrete Time Integrator    Discrete time integration of the input signal     Parameters    Integrator method   AO  External reset    either    Initial condition source    internal    Initial condition     Limit output    Upper saturation limit     Lower saturation limit     C  Show saturation port  C  Show state port    Sample time   1 for inherited            Figure 14  GUI of Discrete Time Integrator    Now we can build the code from Simulink model and download the generated code to DSP 2  controller  After a few seconds we can see  that in DSP Terminal Parameters page the same  parameters  as we assigned in Tunable parameters page  Figure 15   appear  Now you can  change parameters values  if this is not possible use Unlock button   by entering a different  value to Value cell near parameter Name cell  while the generated code is executing on the  DSP 2 controller  In DSP Terminal visual page you can obser
34. rter with serial input and unipolar output O to 4 V  e RS232 full duplex interface with fixed Baud Rate  57600 b s  8bits  1stop  No parity   e RS485 interface  not implemented in this firmware version  April 17  2000    e RS422 receiver for incremental encoder  e Three logic inputs and logic one output   all optically isolated  12 V passive   e Bridge protection circuit  e Interlock between bottom and top IGBT activation and dead time  e Minimum pulse width  minimum pause width  e Inthe presence of the fault signal the bridge is shut down unconditionally  e Three phase synchronous pulse width modulator  e Twelve bit up down counter for triangle generation    e Symmetrical output pulses    CHAPTER 2  DSP 2 CONTROLLER    e 66 6 ns time resolution  e generates interrupt pulses ones or twice in one modulator period  e Incremental encoder speed measurement with improved MT method  e 66 6 ns time resolution  e Position register contain position increment during sampling period  e Time register contain relative time  in one modulator period  of last position change  e Booth registers are saved on interrupt and are available until next interrupt  e Stand alone operation  Program is preloaded in FLASH   e Operation with personal computer  e Code Composer software development environment  e Standard RS232 serial interface  57600 Bd  and Terminal software  e MPSD interface for XDS510 emulator  e Multipoint communications RS485 and CAN  e Controller dimensions 161 x 130 mm    More about
35. sk   DSP2 Ph block    Parameters    Enable level     Cancel   Help           Figure 37  GUI of DSP 2 PWM block    Enable level    Parameter must be a positive scalar value  When the value of input  signal  which is connected to the input EN  is greater than parameter  Enable level  then PWM starts working     CHAPTER 4  DSP 2 BLOCK REFERENCES 38    To File    Description     EN psp  pTO FILE    Figure 38 shows the GUI of DSP 2 To File block  This is an example of  dynamic GUI  because content of GUI is changing dynamically depending on  parameter Num of input vars     When the signal  which is connected to input EN  becomes greater than the  parameter Enable level  all block input signals  except of input EN  are  stored to temporary buffer on DSP 2 controller  The size of this buffer can be  changed with parameter Buffer size on RTW Options page  2   Figure 17    Because DSP 2 controller memory size is limited  it is recommended  that  this parameter does not exceed 20000  Input signals share out buffer size in  equal parts  That means  if you set Buffer size 20000 and Num of input  vars 4  then each input signal occupies 5000 locations in the buffer     When the buffer is full  the transfer of buffer data from DSP to PC is  performed  DSP Terminal program must run on PC    Buffer data is store in  file with the name that is enter in parameter File name     Block Parameters  To File  DSP2_TO_FILE  mask   DSP2 To File block    Parameterz    Number of input vars z    Enable le
36. t value is   1      CHAPTER 4  DSP 2 BLOCK REFERENCES    51    CHAPTER 4  DSP 2 BLOCK REFERENCES 52    Encoder Position Preset    Description        Parameters     Block Encoder Preset enables encoder i  i 0  3  position preset  In block GUI   Figure 46  you can set two parameters  Encoder and Consider reference  Signal  The meaning of these parameters is explained in Parameters section  below     To ensure the correct operation of incremental encoders  Encoder    Position  Preset Value  i 0  3  and or Invert reference signal parameters  for each  connected encoder must have been defined on DSP 2 robotic controller  options  Figure 20  Figure 21  Figure 22  Figure 23   Note  that these  parameters appear only  if the DSP 2 controller target is selected     Block Parameters  Encoder Position Preset  DSP2ROB_ENC_POS PRESET  mask   DSP 2 Robotic Board encoder position preset block    Parameters    Consider encoder reference signal    Mo       Cancel   Help           Figure 47  GUI of DSP 2 robotic controller Encoder Preset block    Encoder  Encoder of DSP 2 robotic controller  Consider reference signal    No  If this option is selected  encoder position will be preset  on the  positive slope of the block input signal  to the value that is defined in  parameter Encoder i Position Preset Value  i 1  3   Note  Use this option  only  if your encoder does NOT contains reference signal     Yes  If this option is selected  encoder position preset mode will be  started on the positive s
37. the model     Table 3  Analog Output Differential output range    DSP 2 analog Block input range DSP 2 output range  V   output  quants        AOUT  4096 to 4 095    Parameters  None     CHAPTER 4  DSP 2 BLOCK REFERENCES 29    Digital input    Description  Figure 30 shows GUI of DSP 2 Digital Input block  DSP 2 controller has 3    un optically isolated logical inputs  Which input to use  can be selected with the  Ee  parameter Digital input  On the output of this block appears the signal   which has the logical value  0  or  1      Block Parameters  Digital Input  DSP2_DI  mask   DSP  digital input block    Parameters    Digital input  SS           Show Input    Sample time   1 for inhereted   a      me eE    Cancel   Help           Figure 30  GUI of DSP 2 Digital Input block    Parameters  Digital input    Digital input of DSP 2 controller  from which DSP gets data  Show input    The meaning of this parameter is the same as in DSP  2 Analog Input  block    Sample time    Sample time must be an integer multiple of the base sample time  Fixed  sample time parameter      CHAPTER 4  DSP 2 BLOCK REFERENCES 30    Digital Output    Description     DOISP 2  DO 1    Parameters     Figure 31 shows the GUI of the digital output block  DSP 2 controller has  only one optically isolated logic output  In the GUI of this block you can set  the following parameters  Digital output  Threshold and Operation  The value  of the output signal is depending of height of the input signal  operation 
38. time parameter      CHAPTER 4  DSP 2 BLOCK REFERENCES 49    Digital Output    Description  DSP 2 robotic controller has 8 optically isolated logic output  In the GUI of  this block  Figure 45  the following parameters can be set  Digital output   DSP 2 HC  Threshold and Operation  The value of the output signal is depending of  height of the input signal  operation and threshold parameters     Block Parameters  Digital Output  DSP2AOB_DO  mask   Digital Output block for OSP 2 Robotic Board    Parameters    Digital output channel     Operation    Smaller    Threshold              Figure 45  GUI of DSP 2 robotic controller Digital Output block    Parameters  Digital output channel    Select to which digital output channel of DSP 2 robotic controller   DSP  will sends data    Operation    Greater   If the input signal is greater than the threshold  then the  output is set to  1  else to  0     Smaller  If the input signal is smaller than the threshold  then the  output is set to  1  else to  0     Threshold    Threshold must be a scalar real number  The meaning of this parameter  is explained in Operation parameter     Sample time    Sample time must be an integer multiply of the base sample time  Fixed  step size parameter   If the sample time is set to  1  then the sample  time is inherited from the driving block  Default value is  1     CHAPTER 4  DSP 2 BLOCK REFERENCES 50    Encoder    Description  Block DSP 2 Encoder enables sampling of the position and speed of  incrementa
39. to the appropriate value   when the DSP 2 CAN Read and or DSP 2 CAN Write blocks are used in the Simulink  model     DSP 2 options  4   External mode   Figure 19     Options on this page are NOT implemented yet  Parameter External mode MUST be  UNSELECTED     DSP 2 robotic controller options  i   1 0  3     These options are explained in DSP 2 robotic controller device driver blockset section on  page 45     simulation Parameters  example    Solver  Workspace 1 0   Diagnostics   Advanced  Real Time Workshop    Category  DSP  Uptions  1  ka   Build      Options  mw Download generated code to the OSP 2 controller      Create LabVlEW virtual instrument   We Show Exported Signals in DSF Terminal  i Initialize internal data   i Initialize external lO data      Include Terminate function    Figure 16  DSP 2 options  1        CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 17    simulation Parameters  example    Solver  Workspace 1 0   Diagnostics   Advanced   Real Time Workshop    Category   DSP 2 Options  2  ka   Build    Options  Incremental encoder  number of lines per revolution    10000  Modulator  dead time  0 250     40  Modulator  rele delay  zl   05    Capture  number of samples      250    Capture  buffer size      0000       Figure 17  DSP 2 options  2     simulation Parameters  example  Salver  Workspace 1 0   Diagnostics   Advanced Real Time    Workshop    Category    DSP 2 Options  3    Conmnunication ka   Build      Options    CAN Baud Rate  1000000          Figure 18  DSP 2 o
40. tor block     Parameters    Cancel   Help           Figure 36  GUI of DSP 2 Modulator block    Parameters  None     CHAPTER 4  DSP 2 BLOCK REFERENCES 37    PWM    Description        Parameters     Block DSP 2 PWM  Figure 37  has only one parameter Enable level  When  the value of the input signal  which is connected to input EN  is greater than  the mentioned parameter  the pulse width modulator  which is located in  FPGA  starts working  In each ISR the values of T1  T2 and T3 inputs of this  block are transferred to registers W_MOD_T1  W_MOD_T2  and W_MOD_T3   look at DSP 2 User   s guide  of PWM     Period of the PWM is egal to the half of the interrupt period  Fixed Step Size  on the Solver page     Input ranges of T1  T2 and T3 inputs are from O to  Timax  Where Timax can be calculated from the following equation     Interrupt period  s         i 1 2 3  A 2 66 6 10    s     When the output of the PWM is set to    1     the upper transistor is active  and  at the value    0    the lower transistor is active  Immediate transition between  the conduction of the upper and the lower IGBT transistor is not allowed   Transistors must be in inactive state for a while  Duration of inactive state  or    dead time    can be set with the parameter Modulator dead time in Options  page  2   Figure 17   This option appears only  if the DSP 2 target is  selected  Default value of parameter Modulator dead time is set to 40 units   1 unit is 66 6ns      Block Parameters  PWM  DSP2 Pil  ma
41. ve effects of changes     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK    l   DSP Terminal   1 5 2001 FERI  CAMA TLABSpSiworkitemp_dsp _ riwidsp  b  hex     Parameter Parameter  name value    visual Parameters    TesetiDownload Com PrErr 0PwEr 0Ack 482    Figure 15  DSP Terminal Parameters page    3 5  DSP 2 options       15    DER    In this section some additional DSP 2 options are explained  These options are placed on the    RTW options page   DSP 2 options  1   Figure 16      e Download generated code to the DSP 2 controller  if this option is selected  then DSP  Terminal is automatically invoked when RTW terminates with the code generation    process     e Create LabVIEW virtual instrument  If LabVIEW 7 0  and DSP 2 add on toolkit for  LabVIEW are installed on PC  LabVIEW virtual instrument will be automatically  created during executable code generation  More information   s about this option can    be found in LabVIEW virtual instrument for DSP 2 controller document     e All other options on this page are Simulink built in options  therefore explanation of    these options can be found in the Simulink documentation     DSP 2 options  2   Figure 17     Individual options of this page are explained in the description of the related block     DSP 2 options  3   Communication   Figure 18     CHAPTER 3  DSP 2 LIBRARY FOR SIMULINK 16    Currently ony one option exists on this page  Option CAN Baud Rate defines baud rate  for CAN bus communication  This option must be initialized 
42. vel                           File name        datoteka  dat       Format     Ba et    Decimation         Var name 1     Cancel   Help           Figure 38  GUI of DSP 2 To File block    CHAPTER 4  DSP 2 BLOCK REFERENCES 39    Parameters     Number of input vars  Number of block inputs   Enable level    When the signal  which is connected to the input EN  becomes greater  than the parameter Enable level  all block input signals  except of input  EN  are temporary stored to the buffer     File name  The name of the file that holds the block input data   Format    Block input signals are stored to the buffer and then to the file in the    float   format  therefore parameter Format must be of type  X Yf   where X is the number of all  and Y number of decimal places     Decimation    The Decimation parameter is the decimation factor  It can be set to any  positive integer d  and allows you to write data to buffer in every dth  interrupt  The default decimation is set to  1     writes data to buffer in  every ISR     Var name    The name of input signal    CHAPTER 4  DSP 2 BLOCK REFERENCES 40    To Terminal    Description     D3P2 TT  Temp    Parameters     Figure 39 shows GUI of the DSP 2 To Terminal block  which enables sending  of the block input data to the serial bus of DSP 2 controller  If DSP Terminal  is running on PC  then you can monitor block input data in DSP Terminal  Text or Visual page  In GUI you can set the following parameters  Target  page of DSP Terminal  Variab
    
Download Pdf Manuals
 
 
    
Related Search
    
Related Contents
XI-TI25-2 Dual Manual de Usuario  - Frank`s Hospital Workshop  English - Pioneer Europe - Service and Parts Supply website  Ref 103:Ref 103.qxd  Jøtul F 602    Tricefy 3.6 User Manual San Diego, April 2015    Copyright © All rights reserved. 
   Failed to retrieve file