Home

an2263: PC Master Software: Creation of Advanced Control Pages

image

Contents

1. Private Sub Workbook BeforeClose Cancel As Boolean Application OnTime EarliestTime ScheduleTime Procedure RecordAndAnalyze Schedule False End Sub VKKKKKKKK KAKA KKK KKK vn Modulel VKKKKKKKKKKKKKKK KKK Public pcm As McbPcm Public ScheduleTime As Variant Sub RecordAndAnalyze Dim succ As Boolean Dim sht As SheetData Set sht Worksheets Data Spectral Function Succ pcm ReadVariable N N tv msg If succ Then succ pcm ReadMemory w 2 N data msg If succ Then clear data sht Range A2 A129 ClearContents 30 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Appendix C returned array bounds serCnt UBound data fill data For s 0 To serCnt X 2 SB data 2 s 1 LSB data 2 s If MSB gt 128 Then sht Cells s 2 1 Value 256 MSB LSB 65535 32768 Else sht Cells s 2 1 Value 256 MSB LSB 32768 End If Next s Else something failed MsgBox msg End If Else something failed sgBox msg End If Signals amp Statistics Succ pcm GetCurrentRecorderData t data serNames tbase msg If succ Then clear columns sht Range E H ClearContents returned array bounds serCnt UBound data 1 valCnt UBound data 2 timebase valid If tbase gt 0 Th
2. lt td gt lt tr gt lt tr gt lt td gt amplitude lt td gt lt td gt lt input type text name Al size 7 gt lt td gt lt tr gt lt tr gt lt td nowrap gt phase inc lt td gt lt td nowrap gt lt input type text name d omgl size 7 gt rad pi lt td gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td gt lt table border 0 cellpadding 2 cellspacing 2 width 100 gt lt tr gt lt td colspan 2 align center gt lt b gt Harmonic II lt b gt lt td gt lt tr gt lt tr gt lt td gt amplitude lt td gt lt td gt lt input type text name A2 size 7 gt lt td gt PC Master Software Creation of Advanced Control Pages 9 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Scripting lt tr gt lt tr gt lt td nowrap gt phase inc lt td gt lt td nowrap gt lt input type text name d omg2 size 7 gt rad pi lt td gt lt tr gt lt table gt lt td gt lt tr gt lt table gt The input boxes from the first table display the following parameters Amplitude of Harmonic input box named A1 Phase increment of Harmonic input box named d_omgi Amplitude of Harmonic Il input box named A2 Phase increment of Harmonic input box named d_omg2 The input boxes are named the same as the corresponding PC master software variables This estab
3. recorder routine call gt simulate periodical call of pcmasterRecorder routine e g in timer interrupt pemasterRecorder delay for j 0 j lt 10000 j D signal generation shift of input buffers x and d for TiN ro P E x i x i 1 for i MAX ORDER 1 i gt 0 i d i d i 1 new input sample x 0 d D new desired response sample omgl omgl d_omg1 omg2 omg2 d_omg2 d 0 mult Al fcnSinPIx omgl mult A2 fcnSinPIx omg2 24 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Appendix A LMS adaptive algorithm 1 ere as eines a eae FIR filter processing y 0 for i20 i lt N i y mult w i x il result error e da 0 y filter coefficients update for i 0 i lt N i w i w i 2 mult mult mi e x i PC Master Software Creation of Advanced Control Pages 25 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Appendix B lt KKK KKK KK KK XZ A A K A AX X X AX KA K KK X K AX KA X K AXA X KA X XK AA X KA X KA AX X AXA KA Ck kk ko KA KK KK KK KK KK KD lt lt lt lt lt lt lt lt lt lt lt lt lt lt KKK KKK KK KK XZ
4. the adaptive processor builds a model of the incoming signal such that it can predict D samples of source signal The order N and the adaptation step size mi of the adaptive FIR processor is also adjustable in the application All the target board application parameters can be adjusted using the watch window in the PC master software application The signals generated in the target board application can be monitored in the oscilloscope and recorder charts Figure 4 shows the PC master software recorder chart displaying the following application signals Processor input signal x n Processor desired response a n Processor output signal y n The more the processor is adapted the closer the output signal is to the desired response The PC master software oscilloscope in Figure 5 shows the evolution of the processor FIR coefficients w n during the adaptation together with the error signal e n Appendix A contains the C language source code of the target board application main routine PC Master Software Creation of Advanced Control Pages 5 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D 7T C master eelbware aimi xj De i jem Decree qas Posi tl auio ala elie ni fe aiebat ie m FRA rreri h prapthi m B3 DIFA er PR J1006 ICM speed S00 bre Figure 4 PC Master Software Recorder with Signals x n y n and d n and Some Application
5. Generation lt b gt lt font gt lt td gt lt tr gt lt tr gt lt td gt table border 0 cellpadding 2 cellspacing 2 width 100 gt lt tr gt lt td colspan 2 align center gt lt b gt Harmonic I lt b gt lt td gt lt tr gt tr lt td gt amplitude lt td gt lt td gt lt input type text name A1 size 7 onchange WriteValue onkeydown WriteValueOnEnter gt lt td gt lt tr gt lt tr gt lt td nowrap gt phase inc lt td gt lt td nowrap gt lt input type text name d omgl size 7 onchange WriteValue onkeydown WriteValueOnEnter gt rad pi lt td gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td gt lt table border 0 cellpadding 2 cellspacing 2 width 100 gt lt tr gt lt td colspan 2 align center gt lt b gt Harmonic II b td lt tr gt lt tr gt lt td gt amplitude lt td gt lt td gt lt input type text name A2 size 7 onchange WriteValue onkeydown WriteValueOnEnter gt lt td gt lt tr gt Su td nowrap phase inc td td nowrap gt input type text name d omg2 size 7 onchange WriteValue onkeydown WriteValueOnEnter gt rad pi lt ta gt lt tr gt lt table gt lt td gt lt tr gt lt table gt lt td gt lt tr gt bre td table bgcolor 00aacc border 8 bordercolordark 006688 bordercolorlight 00ddff cellpadding 4 cellspaci
6. Value retMsg End If succ pcm ReadVariable D v If succ then D Value tv else D Value retMsg End If succ pcm ReadVariable N v If succ then N Value tv else N Value retMsg End If succ pcm ReadVariable mi v tv retMsg If succ then mi Value tv else mi Value retMsg End If End Sub Sub WriteValue Dim succ retMsg tv retMsg tv retMsg succ pcm WriteVariable Window retMsg If succ then txtError InnerText else txtError InnerText retMsg End If End Sub Sub WriteValueOnEnter If chr Window Event KeyCode WriteValue End Sub End If VBCR Then pcm ReadVariable d omg2 v tv retMsg Event SrcElement Name Window Event Srcl AN2263 D Appendix B Element Value PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com 27 Freescale Semiconductor Inc AN2263 D lt script gt lt object classid clsid 48A185F1 FFDB 11D3 80E3 00C04F176153 heigh id MCB PC Master Servicesl name pcm width 1 gt lt object gt lt table border 0 cellpadding 5 cellspacing 0 gt lt tr gt lt td valign top gt lt table bgcolor 00aacc border 8 bordercolordark 006688 bordercolorlight 00ddff cellpadding 4 cellspacing 0 width 100 gt lt tr gt lt td align center valign middle gt lt font size 4 gt lt b gt Signal
7. the sub routine RecordAndAnalyze and create a sub routine on the file close event that will cancel the last schedule Private Sub Workbook BeforeClose Cancel As Boolean Application OnTime EarliestTime ScheduleTime Procedure RecordAndAnalyze Schedule False End Sub Appendix C contains the complete source code of the Microsoft Excel Visual Basic script PC Master Software Creation of Advanced Control Pages 21 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Using the PC Master Software OnRecorderDone Event Extension Conclusion In the previous example the sub routine RecordAndAnalyze is called periodically each 5 seconds Another way to hand e PC master software recorder data is to use the OnRecorderDone event This event is called each time the currently selected recorder finishes downloading of the new data To assign a handler to this event in Visual Basic declare the PC master software ActiveX object with the WithEvents keyword Public WithEvents pcm As McbPcm and then create the event handler routine Private Sub pcm OnRecorderDone any code End Sub Methods similar to creating Control Pages can be used also for other HTML pages within the PC master software Detail View pages Algorithm Block Description pages The aim of this Application Note is to describe and to demonstrate how to create ad
8. 14640 0 03283 4 D 4f B25 LD z25 68 0 026018 D26514 5 0 533996 O30F19 O amp D 581116 0 335742 000427 0606323 0453836 D02435 amp D B04584 0 504333 00328 0 170715 9 D 572449 0530457 D02356 0 154455 1o O 50r7a2 0 627038 Do00dgss 0 08313 11 0 411041 0480682 OO2771 3214 12 28479 420441 0 080088 16 020615 I3 LD 133758 0 317749 0 145468 16 0 45326 14 0 03513 185584 0 225769 Tf Fara 15 0 21332 0 033417 030719 16 0 38105 4013338 0 385742 1 0 55604 030096 0 255868 18 0 704198 446762 0 504333 19 0 82013 0651355 0 530457 22 20 489795 473199 527038 ag 21 93213 40818098 S50 24 22 481855 85345 0 420441 M pas 1 1 Wl Ready Er F F NHF ee amp Figure 8 The Third Data Worksheet in the Microsoft Excel Application PC Master Software Creation of Advanced Control Pages 15 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D PC Master Software ActiveX control in Visual Basic The PC master software data can be accessed in Microsoft Excel using a Visual Basic code that calls the PC master software ActiveX control functions Similar to the HTML based Control Panel the PC master software Activex object must be created first Public pcm As McbPcm Set pcm CreateObject MCB PCM The ActiveX functions can now be called For example to load an array of w n coefficients use the HeadMemory function of the Ac
9. AA X AZ A X X AX KA KX AKA X XK AX KA AX X AXA X KA KA AX KA KK KK KO ck kk k ck ck ck kckck k KK kk k kokok lt h Su Freescale Semiconductor Inc c Copyright 2001 gt ALL RIGHTS RESERVED gt gt gt KK KK KKK KK A A kck A X X AX KA kckck kck ck kckck kckck ck X KA kckck ck kckck kckck kckck KKK ck kckck KKK ck kck ck k ck ck KK ck k KK KD File Name control panel xls Description control tables to adjust application parameters Modules Included tml head meta http equiv content type content text html charset iso 8859 1 gt meta name generator content Adobe GoLive 4 title Control Page lt title gt lt link rel stylesheet href LMS css type text css gt lt head gt lt body gt lt script language VBScript gt b ReadSettings Dim succ v tv retMsg succ pcm ReadVariable Al v tv retMsg If succ then Al Value tv else Al Value retMsg End If succ pcm ReadVariable d omgl v tv retMsg If succ then d omgl Value tv else d omgl Value retMsg End If succ pcm ReadVariable A2 v tv retMsg If succ then A2 Value tv else A2 Value retMsg End If gt gt gt gt gt Po gt gt 26 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Succ Freescale Semiconductor Inc If succ then d_omg2 Value tv else d_omg2
10. Freescale Semiconductor Application Note AN2263 D 12 2002 PC Master Software Creation of Advanced Control Pages By Milan Brejl SL Applications Engineering Freescale Czech Systems Laboratories Roznov pod Radhostem Czech Republic Objectives This application note describes the advanced technigues for creating PC master software Control Pages For example it can be represented by the design of a framed Control Page composed of two frames with an HTML based frame and Microsoft Excel running embedded in the second frame This enables you to control and adjust the target board application parameters and to visualize and analyze the board application processes An adaptive signal prediction algorithm running on the target board is used as a comprehensive example Prerequisites This application note assumes basic knowledge of PC Master Creation of HTML pages Basic HTML scripting with VB Script Creation of Microsoft Excel applications Introduction PC master software is a PC Windows based application providing various support for embedded applications It is a tool that can be used for debugging monitoring and controlling the target application and also for demonstrating the target board application functionality Microsoft and Windows are registered trademarks of Microsoft Corporation in the U S and or other countries Freescale Semiconductor Inc 2004 All rights reserved o freescale s
11. More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D To enable the manual adjustment of the parameters displayed in the input boxes equip each input box with two event procedures The event calls a sub routine and the sub routine calls the target board via PC master software activeX object lt input type text name A1 size 7 onchange WriteValue onkeydown WriteValueOnEnter gt The onchange event is automatically invoked by the Internet Explorer when the cursor leaves the edit box This event is handled the same way in all input boxes by the WriteValue sub routine Here the SrcElement property of the Event object is used to determine which edit box to handle Use the Write Variable function of the PC master software ActiveX object to write the adjusted value Sub WriteValue Dim succ retMsg succ pcm WriteVariable Window Event SrcElement Name Window Event SrcElement Value retMsg This function gets the name of the PC master software variable as the first parameter The name of the input box is the same as the name of the variable The next parameter is the new value to be written As in the other PC master software ActiveX functions the return value can be used to get the success of the call If succ then txtError InnerText else txtError InnerText retMsg End If End Sub 12 PC Master Software Creation of Advan
12. Parameters in PC Master Software Watch Control Page Our goal is to create a Control Page composed of an HTML frame and an Excel Proposal frame The Control Page will 1 Provide an interface to monitor and adjust all application parameters making a more user friendly environment than the PC master software watch A graphical Control Panel will be created in HTML and will be enhanced by scripts to provide control functionality 6 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide wi M2 M v OOM M JS FIR coefficients km B E T E E E T r a Figure 5 Oscilloscope Displaying the Time Course of FIR Coefficients w n signal e n and Some of the Application Parameters in PC Master Software Watch 1 Analyze the signal model and get a Spectral Function calculated from FIR coefficients w n The calculation and visualization of the Spectral Function will be done in Microsoft Excel t will be described how to use Microsoft Excel embedded in the Control Page and how to access the w n coefficients in Excel Visual Basic script PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D 2 Calculate the statistics of the signals captured by the PC master sof
13. ameter variable data the array of series names in the second serNames time base if defined in the third tbase and the error message is the last parameter variable msg Succ pcm GetCurrentRecorderData data serNames tbase msg To get the bounds of the recorder data matrix use the UBound function If succ Then serCnt UBound data 1 valCnt UBound data 2 Else MsgBox msg End If To put a data into the Excel sheet first create a SheetData variable Then use the ClearContents function of the sheet range object to clear the specified range contents Assign the cells Value property to place the data value into the specified cell Dim sht As SheetData Set sht Worksheets Data sht Range A1 B8 ClearContents sht Cells 1 2 Value someValue Use these examples in our workbook now Open the Visual Basic Editor in Microsoft Excel Open the code editor of the ThisWorkbook object Create a new module Module and open it as well Create a global declaration of the PC master software ActiveX object variable pcm and Schedule Time in Module 1 Public pcm As McbPcm Public ScheduleTime As Variant PC Master Software Creation of Advanced Control Pages 17 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Create an event procedure in ThisWorkbook that will be activated when the Excel file is opened Private Sub Workb
14. are defined command SendCommandDlg opens a command dialog and sends a PC master software defined command PC master software version 1 1 adds the following functions ReadMemory ReadMemoryHex reads a block of memory from a specified location GetCurrentRecorderData retrieves data currently displayed in the recorder chart GetCurrentRecorderSerie retrieves one data series from the currently displayed recorder chart StartCurrentRecorder starts the currently displayed recorder StopCurrentRecorder stops the currently displayed recorder GetCurrentRecorderState retrieves the current recorder status code and status text of the currently displayed recorder PC master software version 1 1 also implements one call back event OnRecorderDone called when the currently selected recorder finishes downloading new recorder data See the PC Master Software User Manual for a detailed description of each function PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide The rest of this document gives a step by step example of the creation of a complex PC master software Control Page The following text describes Freescale Semiconductor Inc The target board application Application variables that are used in the interface between PC master software and the board application The control a
15. array see the PC Master Software User Manual Succ pom GetCurrentRecorderData t data serNames tbase msg When the data are read successfully clear the contents of columns E to H column E for the time axis and the next three columns for signals on the sheet Data If succ Then sht Range E H ClearContents Check the bounds of the read data serCnt UBound data 1 valCnt UBound data 2 Check if the read time base is specified If tbase gt 0 Then sht Cells 1 5 Value time sec Else sht Cells 1 5 Value index tbase 1 End If and fill the X axis column For i 0 To valCnt sht Cells i 2 5 Value i tbase Next i 20 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide Then fill the signal data to the 6th F and the next columns For s 0 To serCnt sht Cells 1 s 6 Value serNames s For i 0 To valCnt sht Cells i 2 s 6 Value data s i Next i Next s Else MsgBox msg End If Let the sub routine RecordAndAnalyze be repeated after the next 5 seconds with newer data and so on until the Excel file is closed Add the code ScheduleTim Now TimeValue 00 00 05 Application OnTime ScheduleTime RecordAndAnalyze End Sub to the end of
16. by the appropriate parameter values from the target board application Create the ReadSettings sub routine to perform this task and let the sub routine be called after the Control Panel is loaded Add a call to this procedure at the end of the HTML body section lt script language VBScript gt ReadSettings lt script gt The sub routine body is like this lt script language VBScript gt Sub ReadSettings Dim succ v tv retMsg Use the ReadVariable function of the PC master software ActiveX object in order to fill the first input box Harmonics amplitude in the example succ pcm ReadVariable Al v tv retMsqg This function gets as the first parameter the name of the PC master software variable The next two variables passed to the call are filled the variable value V and the value in text format tv according to the setting in PC master software The last parameter retMsg is filled by an error message in case there is an error The function call returns true and v and tv are filled if the function was performed successfully It is false if it fails for any reason and retMsg is filled If succ then Al Value tv else Al Value retMsg End If Repeat this part for all application parameters to fill all control panel input boxes d omg1 A2 d_omg2 D N mi see Appendix B End Sub lt script gt PC Master Software Creation of Advanced Control Pages 11 For
17. ced Control Pages For More Information On This Product Go to www freescale com Framed Control Page Freescale Semiconductor Inc AN2263 D Example Step by Step Guide As the user might expect the new value should be written to the board application when he or she presses Enter That is why the onkeydown event is also handled in all input boxes The handling sub routine Write ValueOnEnter tests the pressed key and if it is the Enter key the value is written with the help of the Write Value sub routine Sub WriteValueOnEnter If chr Window Event KeyCode VBCR Then WriteValue End If End Sub Appendix B contains the complete source code of the Control Panel The Control Page consists of two frames see Figure 7 The left one is the previously created Control Panel file control panel html and the right one is composed by the Microsoft Excel file LMS x s which is described in the following text The HTML file that creates the placement of both frames is the actual main Control Page source and looks like this lt html gt lt head gt meta http eguiv content type content text html charset iso 8859 1 gt meta name generator content Adobe GoLive 4 gt lt title gt Control Page lt title gt lt head gt lt frameset cols 320 framespacing 0 border 4 frameborder YES bordercolor dddddd gt frame src control panel html name HTML gt lt frame src LMS xls nam
18. clude pcmaster h define MAX ORDER 128 FIR adaptive processor Fracl6 w MAX ORDER FIR filter coeficients Fracl6 x MAX ORDER input signal buffer Fracl6 y filter response DA Fracl6 d MAX ORDER desired response buff Fracl6 e response error Fracl6 mi step size of adaptation UWord16 N filter order Prediction params UWordl6 D prediction delay xy Signal generation Fracl6 Al sine 1 amplitude Ef Fracl6 A2 sine 2 amplitude Fracl6 omgl sine 1 actual phase lt 1 1 Fracl6 omg2 sine 2 actual phase lt 1 1 Fracl6 d omgl sine 1 phase inc lt 1 1 kA Fracl6 d omg2 sine 2 phase inc 1 1 void main void UWord32 j UWordl6 i PC Master Software Creation of Advanced Control Pages 23 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D PC master software initialization pcmasterInit ITCN initialization ioctl ITCN ITCN INIT GPRS NULL set GPR and IPR according to the ioctl ITCN ITCN INIT IPR NULL definition in appconfig h SCI initialization ioctl SCI 0 SCI INIT NULL archEnableInt enable all maskable interrupts initialization N 16 mi _ fixed2int 0 001 D 10 Al __fixed2int 0 5 A2 __fixed2int 0 4 d omgl __fixed2int 0 06 d_omg2 __fixed2int 0 09 while 1
19. com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide When the N variable is read successfully 2 N bytes of the w n array can be read into variable data succ pcm ReadMemory w 2 N data msg If succ Then When the data are read successfully first clear the contents of column A rows 2 to 129 on the sheet Data sht Range A2 A129 ClearContents Check the bounds of the read data serCnt UBound data and transform the data from the 8 bit memory dump into the 16 bits signed fractional values and write them to the cleared cells in order For s 0 To serCnt X 2 MSB data 2 s 1 LSB data 2 s If MSB gt 128 Then sht Cells s 2 1 Value 256 MSB LSB 65535 32768 Else sht Cells s 2 1 Value 256 MSB LSB 32768 End If Next s Else MsgBox msg End If Else sgBox msg End If PC Master Software Creation of Advanced Control Pages 19 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D The previous part of the sub routine gets the data for the spectral function calculation The next part loads the recorder signals for the signal statistics The PC master software ActiveX component function GetCurrentRecorderData will be used in its variant for the VisualBasic GetCurrentRecorderData tthat is faster because it uses a typed array instead of variant
20. e Excel gt lt frameset gt lt html gt Internet Explorer automatically runs the Microsoft Excel application embedded in the frame to display the contents of the xls file PC Master Software Creation of Advanced Control Pages 13 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D D bE ee Paper im bami bee E a gigs isle sela iF aelel E Ts pre imam Ea adoptie costiciend Ge FIR coesficen s amp pri LESE c a ob c The Sowctira Fusction of the peadictar e calculated zn wr cagficiar s at 0 A aqsuily spaced points and inteepolatod x BU Tha chart ix funchanal andy ter tha Processor Craar up ta 2 z U Spvectrad furba Snake R Staten fi mmm TE o0 9 Q TO speed S00 bps et Hokin o Figure 7 PC Master Software with Control Page and Spectral Function Sheet Displayed in the Excel Frame bs Li Microsoft Excel Microsoft Excel workbook embedded in the second frame of the Control Page Data Analysis will have three worksheets e The first one will be used to display the frequency function see Figure 7 of the signal model calculated from the FIR coefficients w n The number of w n coefficients is equal to the order N which is one of the application parameters The second sheet will display the recorded signals x n y n and a n and some statistics calculated from the signa
21. emiconductor For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D The embedded application runs on a target board se Figure 1 which is connected to the PC via an RS232 interface The PC runs the PC master software application that communicates with the target board application The PC master software can read and write the target board application variables record variable value courses and provides other functions useful for monitoring controlling or debugging the target board application For more information about this tool refer to the PC Master Software User Manual portion of the MSWSSDKO000AA Embedded Software Development Kit for 56800 56800E and to the application note PC Master Software Usage Freescale document order number AN2395 D Both of these documents are available on the World Wide Web at http freescale com The Control Page is one of several pages which can be displayed in the Detail view pane of the PC master software main application window It is intended to enable control of the target board application and may also contain parts dedicated to monitoring or analysis of the processes running on the target board The page is based on HTML which is widely used on the Internet so the design can be made with the help of the web authoring tools which are commercially available or even free on the Internet PC master software Figure 1 PC Master Softwa
22. en sht Cells 1 5 Value time sec Else sht Cells 1 5 Value index tbase 1 End If fill X axis column For i 0 To valCnt sht Cells i 2 5 Value i tbase Next i fill data For s 0 To serCnt sht Cells 1 s 6 Value serNames s For i 0 To valCnt sht Cells i 2 s 6 Value data s i Next i Next s End If ScheduleTime Now TimeValue 00 00 05 Application OnTime ScheduleTime RecordAndAnalyze End Sub PC Master Software Creation of Advanced Control Pages 31 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc How to Reach Us Home Page www freescale com E mail support freescale com USA Europe or Locations Not Listed Freescale Semiconductor Technical Information Center CH370 1300 N Alma School Road Chandler Arizona 85224 1 800 521 6274 or 1 480 768 2130 support freescale com Europe Middle East and Africa Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen Germany 44 1296 380 456 English 46 8 52200080 English 49 89 92103 559 German 33 1 69 35 48 48 French support freescale com Japan Freescale Semiconductor Japan Ltd Headquarters ARCO Tower 15F 1 8 1 Shimo Meguro Meguro ku Tokyo 153 0064 Japan 0120 191014 or 81 3 5437 9125 support japan freescale com Asia Pacific Freescale Semiconductor Hong Kong Ltd Technical Inf
23. ical experts Freescale Semiconductor does not convey any license under its patent rights nor the rights of others Freescale Semiconductor products are not designed intended or authorized for use as components in systems intended for surgical implant into the body or other applications intended to support or sustain life or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application Buyer shall indemnify and hold Freescale Semiconductor and its officers employees subsidiaries affiliates and distributors harmless against all claims costs damages and expenses and reasonable attorney fees arising out of directly or indirectly any claim of personal injury or death associated with such unintended or unauthorized use even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part T4 o freescale semiconductor AN2263 D Rev 0 12 2002 For More Information On This Product Go to www freescale com
24. lishes an assignment between the input box and the PC master software variable that will be used when writing a new value from the input box into the board application The other two tables can be designed using the first table as an example The parameters displayed in these tables are see Figure 6 Prediction delay input box named D FIR processor order input box named N LMS processor step size input box named mi Refer to Appendix B for the full HTML source code of these two boards To enable the HTML page to communicate with PC master software functions insert the PC master software ActiveX control at the beginning of the HTML body section The control is identified by the unique global Class ID number see the example below Since the object itself does not provide a graphical interface it is possible to set the object dimensions height and width to zero to make it invisible lt object name pcm width 0 height 0 classid clsid 48A185F1 FFDB 11D3 80E3 00C04F176153 gt lt object gt The HTML page created above is enhanced by scripting which is implemented by using the following HTML code VBScript was selected for this example PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide When the page is loaded the values of all input boxes are filled
25. ls see Figure 2 The third sheet serves as the data interface to the PC master software 14 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide It is out of the scope of this document to describe the creation of the first two Excel worksheets Refer to the Excel User Manual for the implementation details The data are imported into the third worksheet see Figure 8 using Excel Visual Basic script Microsoft Excel is also capable of running ActiveX aware scripts That is why the connection from Excel to PC master software can be accomplished through the same PC master software functions as listed in Control Page Functionality Column A of the third worksheet holds the NFIR coefficients w n Here can be from 1 to 128 coefficients so the sheet range assigned to w n coefficients is A2 A129 The columns E H hold the time index and the signals y n a n and x n see Figure 8 The following description explains how to fill these cells and columns with the PC master software data Fc mount Ejerel LPScErI us Eke gd yew Insert Format Took pata Widow Lo igi x Fees ae E TS 0 8 IH O BIU FEEAHWX Z U M j E a na E F G H W index y d EJ al 4 20869 O 0 174347 nnogS4 Dox317 0 1187 L D 284558 O02771 0005524 4 37568 zus Qnae OLD 1 3 0 397614 0
26. nd monitor technigues used on the Control Page The actual design of the Control Page E PEE MN Erez med Soap bos Eae oky Figure 2 PC Master Software with Control Page Consisting of an HTML Frame and an Excel Frame 4 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide Target Board The target board application block diagram is shown in Figure 3 Application ine Wave EN a signals n Description Ps Transport Delay Sine Wave 2 Luis P adaptiwe processor eror eficients Figure 3 Board Application Block Diagram The source signal is generated by the application as the sum of two sine waves with adjustable amplitudes and frequencies phase increments per sample The signal is delayed by an adjustable number of samples D and this delayed signal is connected to the input x n of the LMS least mean square adaptive processor The original version of the source signal is connected to the processor desired response a n The aim of the adaptive processor is to minimize the error signal e n that is the difference between the output signal y n produced by a FIR finite input response system from the input x n and desired response d n As the result
27. ng 0 width 100 gt 28 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Appendix B lt tr gt lt td align center valign middle gt lt font size 4 gt lt b gt Processing lt b gt lt font gt lt td gt lt tr gt Sr td table border 0 cellpadding 2 cellspacing 2 width 100 tr td prediction delay lt td gt lt td nowrap gt lt input type text name D size 7 onchange WriteValue onkeydown WriteValueOnEnter gt samples lt td gt lt tr gt lt table gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt tr gt lt td gt lt table bgcolor 00aacc border 8 bordercolordark 006688 bordercolorlight 00ddf cellpadding 4 cellspacing 0 width 100 gt lt tr gt lt td align center valign middle nowrap gt lt font size 4 gt lt b gt LMS Adaptive Algorithm lt b gt lt font gt lt td gt lt tr gt lt tr gt lt td gt table border 0 cellpadding 2 cellspacing 2 width 100 gt lt tr gt lt td nowrap gt FIR processor order lt td gt lt td gt lt input type text name N size 7 onchange WriteValue onkeydown WriteValueOnEnter gt lt td gt lt tr gt tr lt td nowrap gt step size lt td gt lt td nowrap gt lt input type text name mi size 7 onchange WriteValue onkeydo
28. ook_Open Set pcm CreateObject MCB PCM ScheduleTime Now TimeValue 00 00 05 Application OnTime ScheduleTime RecordAndAnalyze End Sub This sub routine assigns the PC master software ActiveX object to the pcm variable and schedules the sub routine HecordAndAnalyze to run 5 seconds later Create the sub routine HecordAndAnalyze in Module1 The purpose of this routine is to get the FIR coefficient values w n for the spectral function calculation and to get the recorder signals x n y n and a n for their statistics The data will be saved to the specified positions on the third sheet named Data Then the Excel cell functions will use this data to automatically calculate the Spectral Function and the signal statistics Create the declarations and assign a sheet variable with the third sheet named Data in the sub routine RecordAndAnalyze Sub RecordAndAnalyze Dim succ As Boolean Dim sht As SheetData Set sht Worksheets Data To get the w n FIR coefficients the PC master software ActiveX control function HeadMemory will be used because the w n coefficients are stored in an array in the board application memory It is necessary to know the length of this array which corresponds to the processor order N succ pcm ReadVariable N N tv msg If succ Then 18 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale
29. ormation Center 2 Dai King Street Tai Po Industrial Estate Tai Po N T Hong Kong 800 2666 8080 support asia freescale com For Literature Requests Only Freescale Semiconductor Literature Distribution Center P O Box 5405 Denver Colorado 80217 1 800 441 2447 or 303 675 2140 Fax 303 675 2150 LDCForFreescaleSemiconductor hibbertgroup com AN2263 D Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document Freescale Semiconductor reserves the right to make changes without further notice to any products herein Freescale Semiconductor makes no warranty representation or guarantee regarding the suitability of its products for any particular purpose nor does Freescale Semiconductor assume any liability arising out of the application or use of any product or circuit and specifically disclaims any and all liability including without limitation consequential or incidental damages Typical parameters which may be provided in Freescale Semiconductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s techn
30. re and Target Board Application Control Page Functionality PC master software uses Microsoft Internet Explorer to display the HTML pages which enables the user to use a wide range of web technologies supported by it Internet Explorer allows the following technologies to be used from the PC master software environment HTML Dynamic HTML DHTML e Java Script or VBScript Activex Java and Java based trademarks and logos are trademarks of Sun Microsystems Inc in the United States and other countries 2 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Control Page Functionality PC master software application implements an ActiveX object which is used to enable access to and control of the target board application The functions exposed by the ActiveX object can be called from a script inserted in the HTML code or from other Windows applications that are capable of working with ActiveX objects In this document it will be demonstrated how to access the PC master software functions from both VB Script and Microsoft Excel running embedded in PC master software The PC master software ActiveX control provides the following functions ReadVariable reads a value from a PC master software defined variable WriteVariable writes a value to a PC master software defined variable SendCommand sends a PC master softw
31. tiveX object Dim succ As Boolean succ pcm ReadMemory w 16 data msg The address of the memory block to be read is the first parameter of the ReadMemory function This can be either an absolute numeric address or a symbol name valid in the current PC master software project The second parameter is the size of the memory block to be read in bytes The memory data are returned to the variable that is the third parameter The last parameter is the variable for an error message in case of an error Usually it is necessary to transform the data bytes into another data representation For example into an array of 16 bit fractional values get the pairs of MSB most significant and LSB least significant bytes from the read memory block and put these bytes together into a fractional value If succ Then For s 0 To 7 MSB data 2 s 1 LSB data 2 s If MSB gt 128 Then fracValue 256 MSB LSB 65535 32768 Else fracValue 256 MSB LSB 32768 End If Next s Else MsgBox msg End If PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Back to the Example Freescale Semiconductor Inc AN2263 D Example Step by Step Guide Use the function GetCurrentRecorderData to load the PC master software recorder series The function returns the matrix 2 dimensional array of the recorder data in the first par
32. tware recorder Microsoft Excel functions like MIN MAX AVERAGE STDEV VAR and CORREL will be used for this task t will be described how to load the PC master software recorder signal into Microsoft Excel cells for further processing Control Panel The Control Panel should be designed to allow the adjustment of all application Creation parameters see Figure 6 Freescale Semiconductor Inc Figure 6 HTML Control Panel 8 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Example Step by Step Guide To start the creation of the Control Page first prepare the HTML source of the three control tables as displayed in Figure 6 The HTML TABLE tag with color attributes can be used to achieve the 3D look The edit boxes can be implemented with the INPUT tag The source code of the first board named Signal Generation might look like this lt table bgcolor 00aacc border 8 bordercolordark 006688 bordercolorlight 00ddf cellpadding 4 cellspacing 0 width 100 gt lt tr gt lt td align center valign middle gt lt font size 4 gt lt b gt Signal Generation lt b gt lt font gt lt td gt lt tr gt lt tr gt lt td gt lt table border 0 cellpadding 2 cellspacing 2 width 100 gt lt tr gt lt td colspan 2 align center gt lt b gt Harmonic I lt b gt
33. vanced PC master software Control Pages which are intended to monitor and to control embedded applications Therefore the complete methodology with all required information is provided The description is illustrated by real examples with code samples A full real life example is also provided The example page is divided into two frames The usage of PC master software functions from an HTML page is shown in one frame and the usage of PC master software functions from Microsoft Excel is shown in the second frame 22 PC Master Software Creation of Advanced Control Pages For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Appendix A Appendix A Oko kok kok kok k ok kok kok kok k k k kk kk kk kk kk kk kk k kk kk kk kok kk kk kk kk kk kk kk kk kk kk kk kk kk kk kk Freescale Semiconductor Inc c Copyright 2001 ALL RIGHTS RESERVED KEK KKK KKK KKK KKK KKK KKK KKK KKK ck KA KKK KK KKK AX KA KKK KKK KKK KKK KKK KKK KKK ck kock ck Sk ck kv Sk KKK KKK KK File Name lsm demo c Description FIR adaptive processor running the signal prediction algorithm Modules Included kk k k k k k k k k k k k k A k X k X kk XXX XXX k k k ck k k k k ck k k k k I I kk include types h include arch h include periph h include appconfig h include gpio h include itcn h include sci h in
34. wn WriteValueOnEnter gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt table gt lt td gt lt tr gt lt table gt Er center font color red id txtError gt lt font gt lt center gt lt script language VBScript gt ReadSettings lt script gt lt body gt lt html gt PC Master Software Creation of Advanced Control Pages 29 For More Information On This Product Go to www freescale com Freescale Semiconductor Inc AN2263 D Appendix C YK ck K ck K AK X KA KA XK AX KA KA X ck X KA KA ckckckckckckck X kckckckckckckckckckckckckckckckck ck ckckckckckckck X KX k ck ck ck kc kck ko kk i Freescale Semiconductor Inc c Copyright 2001 ALL RIGHTS RESERVED LK kckckckckckckckckck ck ck AX KA KA ck A ckckckck ck ckckckckck KA X kckckckckckckckckckck ck ckckckckck ck ck ck kckckckck X kckckck kck k k kk i File Name lms xls Description capture of application data to third worksheet Modules Included ThisWorkbook Modulel YK ckckck kc KAZ X KA KA ck ck ck KA KA X A X KA KA X AX X KA ck ck X kckckckckckckckckckck ck ckckckckck ck ck k kc kckckck ck ckckckck ck ck ck kc kok ko kk Vk ck ck ok ck ck ck ck ckckckckockck KKK kk ThisWorkbook VKKKKKKKKKK KKK KKK KKK Private Sub Workbook_Open Set pcm CreateObject MCB PCM ScheduleTime Now TimeValue 00 00 05 Application OnTime ScheduleTime RecordAndAnalyze End Sub

Download Pdf Manuals

image

Related Search

Related Contents

Kaltura MediaSpace™ Setup Guide  CM369-JP 取扱説明書 NET-ACCESSTM 排気用エアーダクト  Thule KIT3021  取扱説明書 - 中野エンジニアリング  Whirlpool KGCS166G User's Manual  User Manual  tones  openstage 15 T hipath 4000  ACS550-01  Une « drôle de carte »  

Copyright © All rights reserved.
Failed to retrieve file