0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
AN2264

AN2264

  • 厂商:

    MOTOROLA

  • 封装:

  • 描述:

    AN2264 - Freescale Semiconductor, Inc. - Motorola, Inc

  • 数据手册
  • 价格&库存
AN2264 数据手册
Freescale Semiconductor, Inc. Application Note AN2264/D Rev. 0, 3/2002 LIN Node Temperature Display by Freescale Semiconductor, Inc... Peter Topping 8/16 Bit Applications Engineering Motorola, East Kilbride Introduction Many of the problems of excessive wiring within a car can be resolved by using a serial multiplex bus like CAN or LIN. The LIN (Local Interconnect Network, reference 1) bus is lower in cost and ideally suited to use within a door or in other areas in the car where its limited data rate of 20,000 baud is adequate. The display of external temperature is an application which falls into this category. As a common location for the outside temperature sensor is in a wing mirror, the data often originates from the door. The actual display is, however, within the car some distance away and the LIN bus is eminently suitable to facilitate the connection. A LIN node requires only 3 wires; there is one LIN data line, the other two connections being the positive and negative supplies. This application note presents the design of a temperature display LIN slave node. It was developed as part of a complete door project which also included the keypad module described in application note AN2205. The messaging scheme for the door incorporated a byte for temperature in the mirror response field as shown in table 1. The LIN master is, in this case, the body controller. On a regular basis, say every 100ms, the master sends a frame header with the mirror’s ID and it responds with the two-byte message shown. It includes a byte with the temperature encoded in half Centigrade degree increments from –30°C to 97.5°C. In this case the data is read directly by the temperature display node (slave to slave communication) but could alternatively be read by the master and retransmitted to the relevant slave node. © Motorola, Inc., 2002 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D ID $CA bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 Temperature Sensor (byte 0) Error status. (byte 1) LIN – bit error LIN – checksum error LIN – identifier parity error Temperature sensor data encoded in half Centigrade degree increments from –30°C ($00) to 97.5°C ($FF). LIN – slave not responding error LIN – inconsistent sync. error LIN – no bus activity error not used not used Freescale Semiconductor, Inc... Table 1. Format of mirror response data Hardware The target MCU for the temperature display module is the MC68HC908EY16. As this MCU was not available at the time of writing, this application note employs an MC68HC908AZ60A. Implementation on an MC68HC908EY16 would significantly reduce the cost. Not only is the MC68HC908EY16 a lower pin-count lower cost device but it will include an on-chip Internal Clock Generator (ICG) obviating the need for a crystal or ceramic resonator. The circuit diagram used in the temperature display application is shown in figure 1. Apart from the MCU itself, two chips are required to facilitate a simple LIN node. These are the LIN interface, in this case the MC33399 and a 5 volt regulator. These chips will be replaced in the future by a single chip, the LIN SBC. The regulator used is the 8-pin LT1121 which has the capability of shutting down into a low power sleep mode under the control of the MCU. In the arrangement shown it can be woken up via the MC33399 by LIN bus activity. The MC33399 includes the 30kohm LIN pull-up so this does not need to be included on the PCB. The only discrete components required are pull-up resistors for the IRQ and Reset pins, decoupling capacitors and a crystal and its associated components. Two PortC pull-ups and a 9 volts zener circuit were also included to facilitate entry into monitor mode using an external serial interface. This facilitated in-circuit programming of the on-chip flash memory. The software was developed on the prototype PCB fitted with a target header for the MMDS development system rather than with an actual MC68HC908AZ60A. 2 LIN Node Temperature Display MOTOROLA For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Hardware As the LEDs are driven directly by the MCU, care had to be taken to avoid drawing excessive currents from port pins or exceeding the specified current or dissipation capability of the 5 volt regulator. The digit current for an acceptable brightness is too high for a port pin so FET buffers are incorporated. The segment resistors of 220R were chosen to give a segment current of 10mA so the digit current can be up to 80mA. As the digits are driven with a 25% duty cycle this corresponds to an average current of 2.5mA per segment and 20mA for a digit with all 8 segments lit. The highest total current is drawn with a display of 88.0. This involves 21 active segments which, with a duty cycle of 25%, requires 52.5mA (2.5mA x 21). Freescale Semiconductor, Inc... 1 segment Peak Average 10mA 2.5mA 1 digit (all segments) 80mA 20mA Display: 88.0 80mA 52.5mA With an MCU Idd of 15mA and 9 volts across the regulator (assuming a VBat of 14volts), the maximum dissipation of the LT1121 can be calculated: Dissipation = 9volts x (52.5mA+15mA) ~ 610mW. With an assumed ambient temperature of 26°C and a junction to ambient thermal resistance of 100C°/W, the maximum junction temperature of the LT1121 is: TJ = TAmb + 610mW x 100C°/W = 26 + 61 = 87°C This is well within the specified maximum of 125°C. If a significantly higher segment current were required, then segment drivers and a higher dissipation regulator should be employed. Current versions of the MC68HC908AZ60A data sheet specify a maximum total source current of only 10mA. This was inserted as an interim figure while characterisation was done to check that the Voh and Vol level specifications were met under all possible conditions. In this application these levels are not critical so the only concern is that the total current is not high enough to cause long term damage to the device. There is, however no risk of this as long as the absolute maximum figure of 100mA per pin is observed. In this case the maximum Idd is significantly less than 100mA. Future versions of the data sheet will remove this unnecessary limitation. A simple sleep mode was incorporated in the module when no bus activity occurs for 2 seconds. When this condition is detected, the MCU lowers the enable line to the MC33399 which in turn lowers the inhibit signal to the LT1121 regulator. The regulator goes into its standby mode and powers down the MCU. A resumption of bus activity wakes the MC33399 and the regulator switches the MCU on. In order to facilitate low sleep mode current consumption, an MOTOROLA LIN Node Temperature Display 3 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D additional link was included to isolate the zener diode used to supply the high voltage required to enter monitor mode. The measured current consumption in sleep mode was 40µA. This is the combined standby current of the MC33399 and the LT1121 (both about 20µΑ). Vbat 8 LT1121 5 3 1 Vdd (5 volts) 10M 100k 100k 22 55 44 54 22pF 22pF Freescale Semiconductor, Inc... Supply/ref: Oscillator: I/O: Monitor: SCI: IRQ: Reset: CAN unused: I/O unused: 7 3 13 4 2 1 1 2 31 --64 7 Vsup LIN Temperature display node (AZ60A) 10k 0.1uF 3 Reset 8MHz 59 Osc1 58 Osc2 220 x 8 D0 42 43 46 47 50 51 52 53 dp jumper 1k jumper 2 IRQ Vdd Vdda Vddaref Vrefh 9.1volt zener D1 D2 g f e d c b a 8 INH EN Tx Rx Gnd 5 1 2 4 15 13 14 57 22nF 61 C1 E2 E0 E1 SCI LIN 6 LIN MC68HC908AZ60A D3 D4 D5 D6 MC33399 3 Wake 4-digit 7-segment common-cathode LED display CGMXFC D7 100k Vdd F3 100k x 2 60 63 C0 C3 F0 F2 F1 7 6 5 4 FDV303N x 4 A0 Vss Vssa Avss/Vrefl 21 56 45 Monitor mode 26 Figure 1. Temperature display module circuit diagram 4 LIN Node Temperature Display MOTOROLA For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Software Software The temperature display module uses the Motorola/Metrowerks LIN drivers so all I/O activity is handled outwith the application code which simply uses a “LIN_GetMsg()” to receive the data provided by the sensor in the door mirror. The use of the LIN drivers results in fairly simple application software for the temperature node. In order to respond to a master request command frame (ID 0x3C), the user code has to include the function void LIN_Command(). This is, for instance, how the master would request all slave nodes to go into their low-power standby or “sleep” mode. In this application, sleep mode is entered when there is no bus activity and this function is just a dummy while(1). The main software flow diagram is shown in figure 2 and the complete code listed in section 5. Once the variables have been declared, the CONFIG and I/O registers are initialised. The CONFIG1 value of 0x71 disables the COP while the CONFIG2 value of 0x19 configures the MCU as an MC68HC908AZ60A (as opposed to an AS60A). Interrupts are enabled so that the LIN drivers, once initialised by LIN_init(), can function. The main while loop uses the programmable interrupt timer (PIT) to facilitate a 200Hz repetition rate based on an 8MHz crystal. Once every 5ms the PIT overflow flag is set and the main loop is executed to convert the binary input data into 7-segment format. The 200Hz rate is also used to cycle round the 4 LED digits facilitating a flicker free 50Hz multiplexed display. Although the LIN buffer is read and the temperature converted into 4-digit 7-segment format every time, only one digit is actually driven every 5ms. The LIN driver function LIN_IdleClock can check whether or not there is any bus activity. If not it increments a counter whose value is compared with LIN_IDLETIMEOUT (defined in slave.cfg). If this number is exceeded the function LIN_DriverStatus() ceases to return a 1 (LIN_STATUS_RUN) indicating that the bus has been idle for, in this application, 2 seconds. If this is detected, the enable pin of the MC33399 is taken low and the MCU is powered down by the disabling of the LT1121. The code also sets the display to “….”. This is irrelevant in the powered down application but gave an indication of a detected idle condition in the development environment where the emulated MCU’s power was not controlled by the LT1121. In this application it also made sense to show a special display if temperature data was not being provided to the module. Without this addition the display would continue to show the last received temperature (or –30°C if none had been received since the last power up). This feature was incorporated using LIN_MsgStatus(0x0A) in conjunction with the variable error_count and forces the display to “----” after a second of not receiving a LIN message with an ID of 0A (see figure 4). To perform the conversion, the temperature byte is transferred to the variable bits and, if the temperature is positive, the offset of 60 (30 C°) subtracted. This would result in an incorrect underflowed value in bits if the temperature is Freescale Semiconductor, Inc... MOTOROLA LIN Node Temperature Display 5 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D negative ( 200) { display[0] = 0x02; display[1] = 0x02; display[2] = 0x02; display[3] = 0x02; } /* yes, clear it */ /* check for bus activity */ /* bus idle for 400 trys ? */ /* /* /* /* /* LIN_STATUS_IDLE is 2 but 3 is returned display ....(MMDS only) real AZ60A powers down from MC33399 enable low */ */ */ */ */ Freescale Semiconductor, Inc... /* /* /* /* /* bus active but have we had an ID of 0x0A ? no, error counter already 201 ? no, inc error counter */ */ */ */ */ /* yes, new data available */ /* data in last second ? /* /* /* /* no, display ---to signify no valid data from temperature sensor */ */ */ */ */ else { LIN_GetMsg (0x0A, Mirror_data); bits = Mirror_data[0]; if (bits < 60) { bits = 60 - bits; negative = 1; } else { bits = bits - 60; negative = 0; } display[3] = seg7[0]; if (bits & 0x01 == 0x01) { display[3] = seg7[5]; } bits = bits/2; tens = bits/10; units = bits%10; /* yes, data available /* read sensor message /* and extract temp. byte /* negative ? */ */ */ */ /* yes,convert to positive */ /* but remember it wasn’t */ /* no, remove offset and /* clear negative flag */ */ /* display zero after */ /* decimal point but if LS */ /* bit is a 1 display 5 */ /* lose LS bit /* find tens digit /* and units digit */ */ */ 12 LIN Node Temperature Display MOTOROLA For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Software listing display[2] = 1 | seg7[units]; display[1] = 0x00; display[0] = 0x00; if (tens != 0) { display[1] = seg7[tens]; if (negative) { display[0] = 0x02; } } else if (negative) { display[1] = 0x02; } } } /* units w. decimal point /* clear tens digit /* and hundreds digit /* tens digit zero ? /* no, display it /* negative ? */ */ */ */ */ */ /* yes put "-" in hundreds */ /* tens zero, negative ? /* yes, put "-" in tens /* */ */ */ Freescale Semiconductor, Inc... dcount ++; /* increment digit counter */ PTF = (PTF & 0xF0) | scan[dcount & 0x03]; /* and use the two LS bits */ PTD = display[dcount & 0x03]; /* to get data from arrays */ } } } MOTOROLA LIN Node Temperature Display 13 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Appendix I — LIN driver project set-up This application was developed on a Motorola MMDS development system using the Metrowerks Codewarrior development environment. The easiest way to generate an MC68HC908AZ60A LIN Codewarrior project is to “clone” the example application included with the LIN drivers. This automatically ensures that the compiling, linking and building process is configured correctly. An appropriate procedure is shown below. 1. In the LIN driver directory …\lin08\sample, make an additional copy of the folder slave and give it an appropriate name. In this application temp08 was used. 2. Delete the slave.c source file from the new folder …\lin08\sample\temp08 and add application source file(s). 3. In the LIN driver directory …\lin08\sample\ide, make an additional copy of the folder slave and give it the same name as that used in step 1. 4. Delete all files from …\lin08\sample\ide\temp08\slave_Data\LIN08_slave\objectCode and …\lin08\sample\ide\temp08\bin. This is not essential but makes it easier to see if the compiler and linker output files are being correctly generated. 5. Launch Codewarrior, close any open projects and drag in the file …\lin08\sample\ide\temp08\slave.mcp. 6. Remove slave.c from the project by selecting the file (in files folder) and deleting it using the “Edit” pull-down menu. 7. Add the required source file(s) to the project by selecting “Add Files” from the “project” pull-down menu. Browse for the file(s), select and click on “add”. In this application the single file …\lin08\sample\temp08\tempaz was required. If the added file appears in an inappropriate position in the list of project files it can be dragged to a more suitable place. 8. Use the LIN slave settings (leftmost) icon to select “target – access paths”. Remove path (Project)..\..\slave to ensure that it isn’t inadvertently accessed. The path (Project)..\..\temp08 is required but should already have been added automatically. 9. If any include files are required they should be added to folder …\lin08\inc. In this application, the file hc08az60.h (see appendix II) was added. Include files can optionally be added to the project as described above for source files. 10. The LIN driver’s .prm file hc08az32.prm will have been copied to …\lin08\sample\ide\temp08\hc08AZ32.prm. and this file should be inspected and edited or replaced as necessary. In this application, no modification was necessary. Freescale Semiconductor, Inc... 14 LIN Node Temperature Display MOTOROLA For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Appendix I — LIN driver project set-up 11. In cloned projects, compiler macros set up to use slave.cfg in place of lincfg.h and slave.id in place of linmsgid.h (see reference [2]). slave.cfg and slave.id will have been copied into …\lin08\sample\temp08 and should be inspected and edited if changes are required. In this application slave.id was modified to specify the appropriate IDs and slave.cfg was modified to enter the appropriate values for the baud rate (0x30) and the bus timeout (400). slave.cfg and slave.id are shown in appendix II. 12. Many files within the project, for instance the output files slave.abs and slave.sx will have retained their original “slave” names. The simplest option is to retain these names as they are but they can be changed if desired. Slave.sx is the S19 record file required to program the flash of an MC68HC908AZ60A. 13. Close Codewarrior. When relaunched, the newly created project will be available for simulation and/or dubugging under “open recent” in the file pull-down menu. Freescale Semiconductor, Inc... MOTOROLA LIN Node Temperature Display 15 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Appendix IIa — Include file (register definitions for the 908AZ60A). /***************************************************** HC08AZ60.H Register definitions for the MC68HC908AZ60(A) P. Topping 1-06-01 *****************************************************/ Freescale Semiconductor, Inc... #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define #define PTA PTB PTC PTD PTE PTF PTG PTH DDRA DDRB DDRC DDRD DDRE DDRF DDRG DDRH *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile *((volatile unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned unsigned char char char char char char char char char char char char char char char char *)0x0000) *)0x0001) *)0x0002) *)0x0003) *)0x0008) *)0x0009) *)0x000A) *)0x000B) *)0x0004) *)0x0005) *)0x0006) *)0x0007) *)0x000C) *)0x000D) *)0x000E) *)0x000F) #define CONFIG1 *((volatile unsigned char *)0x001F) #define CONFIG2 *((volatile unsigned char *)0xFE09) #define #define #define #define #define PITSC PCNTH PCNTL PMODH PMODL *((volatile *((volatile *((volatile *((volatile *((volatile unsigned unsigned unsigned unsigned unsigned char char char char char *)0x004B) *)0x004C) *)0x004D) *)0x004E) *)0x004F) #define VECTF (void(*const)()) /* Vector table function specifier */ 16 LIN Node Temperature Display MOTOROLA For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Appendix IIb — slave.cfg (LIN configuration file). Appendix IIb — slave.cfg (LIN configuration file). #ifndef LINCFG_H #define LINCFG_H /****************************************************************************** * * Copyright (C) 2001 Motorola, Inc. * All Rights Reserved * * The code is the property of Motorola GSG St.Petersburg * Software Development * and is Motorola Confidential Proprietary Information. * * The copyright notice above does not evidence any * actual or intended publication of such source code. * * Filename: $Source: /net/sdt/vault-rte/cvsroot/lin/release/hc08/sample/slave/slave.cfg,v $ * Author: $Author: kam $ * Locker: $Locker: $ * State: $State: Exp $ * Revision: $Revision: 1.12 $ * * Functions: LIN Driver static configuration file for LIN08 Slave sample * with Motorola API * * History: Use the CVS command log to display revision history * information. * * Description: It is allowed to modify by the user. * * Notes: * ******************************************************************************/ #if defined (HC08) /* External MCU frequency = 16MHz /* SCI Baud rate = 15.6K /* This definition configures the LIN bus baud rate. This value shall be set according to target MCU SCI register usage. HC08AZ32: the 8-bit value will be masked by 0x37 and put into SCBR register. */ #define LIN_BAUDRATE /* This definition set the number of user-defined time clocks (LIN_IdleClock service calls), recognized as "no-bus-activity" condition. T|his number shall not be greater than 0xFFFF. */ #define LIN_IDLETIMEOUT #endif /* defined (HC08) */ #endif /* !define (LINCFG_H) */ 400u 0x30u */ */ Freescale Semiconductor, Inc... MOTOROLA LIN Node Temperature Display 17 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Appendix IIc — slave.id (LIN message ID file). #ifndef LINMSGID_H #define LINMSGID_H /****************************************************************************** * * Copyright (C) 2001 Motorola, Inc. * All Rights Reserved * * The code is the property of Motorola GSG St.Petersburg * Software Development * and is Motorola Confidential Proprietary Information. * * The copyright notice above does not evidence any * actual or intended publication of such source code. * * Filename: $Source: /net/sdt/vault-rte/cvsroot/lin/release/hc08/sample/slave/slave.id,v $ * Author: $Author: snl $ * Locker: $Locker: $ * State: $State: Exp $ * Revision: $Revision: 1.8 $ * * Functions: Message Identifier configuration for LIN08 Slave sample * with Motorola API * * History: Use the CVS command log to display revision history * information. * * Description: * * Notes: * ******************************************************************************/ #define #define #define #define /* this #define #define #define #define LIN_MSG_09 LIN_MSG_0A LIN_MSG_21 LIN_MSG_20 LIN_RECEIVE LIN_RECEIVE LIN_RECEIVE LIN_SEND Freescale Semiconductor, Inc... string is not necessary - just as an example */ LIN_MSG_20_LEN 4 /* standard length */ LIN_MSG_09_LEN 2 /* standard length */ LIN_MSG_0A_LEN 2 /* standard length */ LIN_MSG_21_LEN 4 /* standard length */ #endif /* defined(LINMSGID_H)*/ 18 LIN Node Temperature Display MOTOROLA For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. AN2264/D Appendix IIc — slave.id (LIN message ID file). Freescale Semiconductor, Inc... This Page Has Been Intentionally Left Blank MOTOROLA LIN Node Temperature Display 19 For More Information On This Product, Go to: www.freescale.com Freescale Semiconductor, Inc. HOW TO REACH US: USA/EUROPE/LOCATIONS NOT LISTED: Motorola Literature Distribution; P.O. Box 5405, Denver, Colorado 80217 1-303-675-2140 or 1-800-441-2447 JAPAN: Motorola Japan Ltd.; SPS, Technical Information Center, 3-20-1, Minami-Azabu Minato-ku, Tokyo 106-8573 Japan 81-3-3440-3569 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre, 2 Dai King Street, Tai Po Industrial Estate, Tai Po, N.T., Hong Kong 852-26668334 TECHNICAL INFORMATION CENTER: 1-800-521-6274 HOME PAGE: http://www.motorola.com/semiconductors Information in this document is provided solely to enable system and software implementers to use Motorola 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. Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Motorola 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 Motorola 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 technical experts. Motorola does not convey any license under its patent rights nor the rights of others. Motorola 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 Motorola product could create a situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola 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 Motorola was negligent regarding the design or manufacture of the part. Freescale Semiconductor, Inc... Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark Office. digital dna is a trademark of Motorola, Inc. All other product or service names are the property of their respective owners. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2002 For More Information On This Product, Go to: www.freescale.com AN2264/D
AN2264 价格&库存

很抱歉,暂时无法提供与“AN2264”相匹配的价格&库存,您可以联系我们找货

免费人工找货