Part Number Hot Search : 
MMBZ5243 FSS242 IRH4054 00900 KP100 1245Y SDM150 TC322
Product Description
Full Text Search
 

To Download AN584 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 PICMASTER Support of Microsoft Windows DDE
AN584
PICMASTERTM Support of Microsoft(R) WindowsTM DDE
The PICMASTER system supports Windows Dynamic Data Exchange (DDE). This feature allows the contents of the trace buffer to be transferred to other windows applications such as Microsoft ExcelTM. This feature is invaluable to control systems designers who would like to plot real-time data to debug and fine tune an application. This application note will show how to set this up and graph system data. 5. You will see the trace buffer fill with instructions and data if those instructions were executed and trace enabled. If you do not see any instructions in the trace buffer, check the Trace Settings in (1) and look for loops or deadlock situations that would prevent your program from executing these instructions.
THE TRACE BUFFER
The PICMASTER contains a 8K x 40 bit trace buffer. The fields within this buffer are broken up into three categories:
(1) (2) (3) Current Address of instruction Data/Opcode Field External Logic Analyzer inputs 16-Bits (ADDRESS) 16-Bits (DATA) 8-Bits (EXT) ---------- 40-Bits
Note: PICMASTER must be running and the trace buffer open with data displaying in order to use DDE for other Windows applications (such as Microsoft Excel as described in the next section).
SETTING UP EXCEL
After starting Excel with a blank spread sheet, select 100 rows in the first column by pressing the left mouse button and holding it down to drag across all cells. Next Type the following string in the box: =PICMASTR|'c:\path\test.hex'!'data 0 99' and hit CNTRL+SHIFT+ENTER The format for this command is as follows: =PICMASTR|'`!' ` * represents the full path and filename of the object code file that you have downloaded to program memory. This string must match what is displayed in the PICMASTER window handle at the top of the PICMASTER window. defines the group of values that you want to look at in the trace buffer. The following are the three groups of trace information: ADDRESS for opcode address (16-bits Real-time data) DATA for the opcode coding itself (16-bits Real-time data) EXT for the external logic probes (8-bits Real-time data)
5
Any instruction can be optionally traced or not traced; the trace for each instruction is enabled by the "T" field on the far left column of the program memory dump window. To set up the trace buffer, do the following: 1. Select the SETUP->TRACE SETTINGS window option to set up a range of addresses to be traced. These ranges are selecting specific memory addresses that will be traced if these instructions are executed. Individual instructions can also be trace enabled / disabled with the SHIFT+RIGHT_MOUSE button Open the trace window by selecting the WATCH>TRACE MEMORY menu selection. Click the RUN button after opening the Run box with the RUN->RUN BOX menu selection. The processor will now run. At a later time you may hit the HALT button from the Run Box.
*
2. 3. 4.
* * *
EXAMPLE 1: TRACE BUFFER DATA
Trace Buffer Address 0 1 2 3 : : : : Program Memory Address 711 712 713 714 Instruction Opcode (12,14,16 bit) 425 525 305 36F Address Label Instruction Comments
BIT3
bcf bsf rrf rlf
porta,0x1 porta,0x1 porta,W 0xF
;Toggle Clock ;Clock in data
(c) 1994 Microchip Technology Inc.
DS00584A-page 1
5-231
PICMASTER Support of Microsoft Windows DDE
* * * * RAM for the current state of any file registers (8-bits, Not Real-time) PROG The current state of program memory (16bits, Not Real-time) specifies starting address location in the trace buffer to be transferred specifies the ending address location in the trace buffer. Generally, the must be greater than the and the difference equal to the number of cells selected in Excel.
MOVING LIVE DATA INTO THE TRACE BUFFER
Many applications would like to show trends in register values over time as the application runs real-time. For example, if the microcontroller software is using a file register SPEED to show the current shaft speed of a motor that the controller was controlling, the designer may want to capture the motor speed VS time when the controller is running in real-time. This can be accomplished with three different methods, two of which work with the PIC16CXX and PIC16C5X family, and all three work with the PIC17C42.
Note:
Hit SHIFT-CTL-ENTER and the data/opcode field values show up in the excel cells. You can now create hex values or strip off the literal encoding with formulas written for Excel.
Method 1: Lookup Table (PIC16C5X, PIC16CXX, PIC17C42)
At the end of your code, add a look-up table that returns the literal value that is passed to it. This value can then be traced in the trace buffer through the DATA field and the data value stripped from the opcode. The lookup table that is added would look like the following:
. . MOVF CALL . . ORG (600-3) TRACE_REG BTFSC .T.. RETLW DECF ADDWF .T.. .T.. .T.. .T.. .T.. .T.. .T.. RETLW RETLW RETLW . . RETLW RETLW 0FEh 0FFh SPEED,W TRACE_REG
; Here is your code that calculates SPEED
; Place the current value of the SPEED register into W ; Call TRACE_REG so the opcode is stored in trace buffer
; This address must have bit 9 as a zero in 16C5X ; and must always have the ADDWF PC on address XX00h
STATUS,Z ; Skip to Decrement if not zero 0 SPEED,W PC 1 2 3 ; if zero, return zero ; Compensate for table offset ; Jump into lookup table and return same value as W-1 ; Return 1 ; Return 2 ; Return 3 ; There are 250 RETURN instructions here ; RETLW 4 through RETLW 0FDh ; Return FE ; Return FF
Note: Since the RETLW instruction takes two cycles and the next instruction is prefetched, the trace buffer will contain two sequential values for every value that is traced with this method. The user can strip this intervening value out with the spread sheet.
DS00584A-page 2
(c) 1994 Microchip Technology Inc.
5-232
PICMASTER Support of Microsoft Windows DDE
Method 2: Using the Logic Analyzer external inputs (PIC16C5X, PIC16CXX, PIC17C42).
Connect the eight logic analyzer inputs TRC<7:0> to a currently unused digital output port of the PIC16/17. Set the port direction of this port to OUTPUT and when you want to look at a value, simply move the value to the port and set the trace bit on the second instruction following the move instruction. The following example shows this:
. CLRW OPTION . . . MOVF MOVWF . .T.. . SPEED,W Port_B ; Place where Speed variable is modified and needs to be traced ; Place Speed value into W register ; Place value into Port B ; Execute normal instruction ; Trace second instruction after Port B move to capture current value Port_B ; Code Initialization ; Place 0 into W register ; Make all Port B pins outputs to feed variable state data to logic inputs ; Use MOVWF DDRB instruction in place of OPTION for 17C42
FIGURE 1: EXCEL SPREADSHEET EXAMPLE OF REAL-TIME PSEUDO-SINE WAVE GENERATOR
5
300 250 200 150 100 50 0 1 11 21 31 41 51 61 71 81 91 Series1
(c) 1994 Microchip Technology Inc.
DS00584A-page 3
5-233
PICMASTER Support of Microsoft Windows DDE
Method 3: Using TBLWRT instruction to modify program memory (PIC17C42 only)
The PIC17C42 supports table lookup and writing features that are not supported on the PIC16CXX family. The emulator supports write operations to program memory using the TBLWRT instruction. To capture real-time RAM data, the user simply sets up the table pointers to an unused portion of program memory space and loads the current register value into the table latch. Next the user issues the TBLWRT instructiono load the data into the least significant byte of the word used for trace. A simple call to this location with the trace bit set will capture the data. The following example shows this:
ANALYSIS OF VARIOUS METHODS
Method 1 requires an additional 259 words of code space at the end of memory but does not require any external port pin connections. Method 2 requires an 8-bit port connection to the external logic input pins but does not require any additional code space. Additionally, Method 2 does not have an intervening sequential address that occurs from the two cycle RETLW instruction used in Method 1 and Method 3. Method 3 does not require the additional code of Method 1 or the port connections of Method 2, but this is only supported on the PIC17C42.
MOVLW TRACE_HIGH MOVWF TBLPTRH MOVLW TRACE_LOW MOVWF TBLPTRL TLWT 1,0B6h
; PlaceTRACE_LOCATION MSB into W ; Move TRACE_LOCATION MSB into Table pointer HIGH ; Place TRACT_LOCATION LSB into W ; Move TRACE_LOCATION LSB into Table pointer LOW ; Place RETLW opcode MSB into Table Latch High ; Place SPEED value into Table Latch low and write to mem
TABLWT 0,0,SPEED CALL . . TRACE_LOCATION .T.. RETLW XX
TRACE_LOCATION; Now Call to trace the value
; The data in XX with reflect current SPEED value
CONCLUSION
Although there is no straight forward method to do this, it is practical to trace real-time file register data with the PICMASTER trace buffer.
Author: John Day, Field Applications Engineer, Northeast Region (North America)
DS00584A-page 4
(c) 1994 Microchip Technology Inc.
5-234
Note the following details of the code protection feature on PICmicro(R) MCUs. * * * The PICmicro family meets the specifications contained in the Microchip Data Sheet. Microchip believes that its family of PICmicro microcontrollers is one of the most secure products of its kind on the market today, when used in the intended manner and under normal conditions. There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the PICmicro microcontroller in a manner outside the operating specifications contained in the data sheet. The person doing so may be engaged in theft of intellectual property. Microchip is willing to work with the customer who is concerned about the integrity of their code. Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as "unbreakable". Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our product.
* * *
If you have any further questions about this matter, please contact the local sales office nearest to you.
Information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. No representation or warranty is given and no liability is assumed by Microchip Technology Incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. Use of Microchip's products as critical components in life support systems is not authorized except with express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any intellectual property rights.
Trademarks The Microchip name and logo, the Microchip logo, FilterLab, KEELOQ, microID, MPLAB, PIC, PICmicro, PICMASTER, PICSTART, PRO MATE, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. dsPIC, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, microPort, Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM, MXDEV, PICC, PICDEM, PICDEM.net, rfPIC, Select Mode and Total Endurance are trademarks of Microchip Technology Incorporated in the U.S.A. Serialized Quick Turn Programming (SQTP) is a service mark of Microchip Technology Incorporated in the U.S.A. All other trademarks mentioned herein are property of their respective companies. (c) 2002, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received QS-9000 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona in July 1999. The Company's quality system processes and procedures are QS-9000 compliant for its PICmicro(R) 8-bit MCUs, KEELOQ(R) code hopping devices, Serial EEPROMs and microperipheral products. In addition, Microchip's quality system for the design and manufacture of development systems is ISO 9001 certified.
2002 Microchip Technology Inc.
M
WORLDWIDE SALES AND SERVICE
AMERICAS
Corporate Office
2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7200 Fax: 480-792-7277 Technical Support: 480-792-7627 Web Address: http://www.microchip.com
ASIA/PACIFIC
Australia
Microchip Technology Australia Pty Ltd Suite 22, 41 Rawson Street Epping 2121, NSW Australia Tel: 61-2-9868-6733 Fax: 61-2-9868-6755
Japan
Microchip Technology Japan K.K. Benex S-1 6F 3-18-20, Shinyokohama Kohoku-Ku, Yokohama-shi Kanagawa, 222-0033, Japan Tel: 81-45-471- 6166 Fax: 81-45-471-6122
Rocky Mountain
2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 480-792-7966 Fax: 480-792-7456
China - Beijing
Microchip Technology Consulting (Shanghai) Co., Ltd., Beijing Liaison Office Unit 915 Bei Hai Wan Tai Bldg. No. 6 Chaoyangmen Beidajie Beijing, 100027, No. China Tel: 86-10-85282100 Fax: 86-10-85282104
Korea
Microchip Technology Korea 168-1, Youngbo Bldg. 3 Floor Samsung-Dong, Kangnam-Ku Seoul, Korea 135-882 Tel: 82-2-554-7200 Fax: 82-2-558-5934
Atlanta
500 Sugar Mill Road, Suite 200B Atlanta, GA 30350 Tel: 770-640-0034 Fax: 770-640-0307
Singapore
Microchip Technology Singapore Pte Ltd. 200 Middle Road #07-02 Prime Centre Singapore, 188980 Tel: 65-334-8870 Fax: 65-334-8850
Boston
2 Lan Drive, Suite 120 Westford, MA 01886 Tel: 978-692-3848 Fax: 978-692-3821
China - Chengdu
Microchip Technology Consulting (Shanghai) Co., Ltd., Chengdu Liaison Office Rm. 2401, 24th Floor, Ming Xing Financial Tower No. 88 TIDU Street Chengdu 610016, China Tel: 86-28-6766200 Fax: 86-28-6766599
Taiwan
Microchip Technology Taiwan 11F-3, No. 207 Tung Hua North Road Taipei, 105, Taiwan Tel: 886-2-2717-7175 Fax: 886-2-2545-0139
Chicago
333 Pierce Road, Suite 180 Itasca, IL 60143 Tel: 630-285-0071 Fax: 630-285-0075
Dallas
4570 Westgrove Drive, Suite 160 Addison, TX 75001 Tel: 972-818-7423 Fax: 972-818-2924
China - Fuzhou
Microchip Technology Consulting (Shanghai) Co., Ltd., Fuzhou Liaison Office Unit 28F, World Trade Plaza No. 71 Wusi Road Fuzhou 350001, China Tel: 86-591-7503506 Fax: 86-591-7503521
EUROPE
Denmark
Microchip Technology Nordic ApS Regus Business Centre Lautrup hoj 1-3 Ballerup DK-2750 Denmark Tel: 45 4420 9895 Fax: 45 4420 9910
Detroit
Tri-Atria Office Building 32255 Northwestern Highway, Suite 190 Farmington Hills, MI 48334 Tel: 248-538-2250 Fax: 248-538-2260
China - Shanghai
Microchip Technology Consulting (Shanghai) Co., Ltd. Room 701, Bldg. B Far East International Plaza No. 317 Xian Xia Road Shanghai, 200051 Tel: 86-21-6275-5700 Fax: 86-21-6275-5060
Kokomo
2767 S. Albright Road Kokomo, Indiana 46902 Tel: 765-864-8360 Fax: 765-864-8387
France
Microchip Technology SARL Parc d'Activite du Moulin de Massy 43 Rue du Saule Trapu Batiment A - ler Etage 91300 Massy, France Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79
Los Angeles
18201 Von Karman, Suite 1090 Irvine, CA 92612 Tel: 949-263-1888 Fax: 949-263-1338
China - Shenzhen
Microchip Technology Consulting (Shanghai) Co., Ltd., Shenzhen Liaison Office Rm. 1315, 13/F, Shenzhen Kerry Centre, Renminnan Lu Shenzhen 518001, China Tel: 86-755-2350361 Fax: 86-755-2366086
New York
150 Motor Parkway, Suite 202 Hauppauge, NY 11788 Tel: 631-273-5305 Fax: 631-273-5335
Germany
Microchip Technology GmbH Gustav-Heinemann Ring 125 D-81739 Munich, Germany Tel: 49-89-627-144 0 Fax: 49-89-627-144-44
San Jose
Microchip Technology Inc. 2107 North First Street, Suite 590 San Jose, CA 95131 Tel: 408-436-7950 Fax: 408-436-7955
Hong Kong
Microchip Technology Hongkong Ltd. Unit 901-6, Tower 2, Metroplaza 223 Hing Fong Road Kwai Fong, N.T., Hong Kong Tel: 852-2401-1200 Fax: 852-2401-3431
Italy
Microchip Technology SRL Centro Direzionale Colleoni Palazzo Taurus 1 V. Le Colleoni 1 20041 Agrate Brianza Milan, Italy Tel: 39-039-65791-1 Fax: 39-039-6899883
Toronto
6285 Northam Drive, Suite 108 Mississauga, Ontario L4V 1X5, Canada Tel: 905-673-0699 Fax: 905-673-6509
India
Microchip Technology Inc. India Liaison Office Divyasree Chambers 1 Floor, Wing A (A3/A4) No. 11, O'Shaugnessey Road Bangalore, 560 025, India Tel: 91-80-2290061 Fax: 91-80-2290062
United Kingdom
Arizona Microchip Technology Ltd. 505 Eskdale Road Winnersh Triangle Wokingham Berkshire, England RG41 5TU Tel: 44 118 921 5869 Fax: 44-118 921-5820
01/18/02
2002 Microchip Technology Inc.


▲Up To Search▲   

 
Price & Availability of AN584

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X