AN2600 Freescale Semiconductor / Motorola, AN2600 Datasheet

no-image

AN2600

Manufacturer Part Number
AN2600
Description
A Simple Keypad Using LIN with the MC68HC908QT/QY MCU
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
AN2600/D
12/2003
A Simple Keypad Using LIN
with the MC68HC908QT/QY
MCU
By: David Svrcek and Zdenek Kaspar
General Description
Metrowerks
byteflight
This product incorporates SuperFlash
Motorola Czech System Laboratories
Roznov p.R., Czech Republic
®
is a registered trademark of the BMW Group.
®
and CodeWarrior
NOTE:
®
This document describes an implementation of a LIN slave simple keypad
based on the MC68HC908QY/QT Family of microcontroller units (MCUs).
LIN (local interconnect network) is a low-cost, serial communication system
intended for use in distributed electronic systems in vehicles. LIN’s features,
such as baud rate, cannot compete against much more sophisticated networks
such as CAN (controller area network) and MOST (media-oriented system
transport) or byteflight
make it ideal for applications that do not require more sophisticated networks.
LIN applications are very common and located in numerous places throughout
a vehicle:
This implementation uses MC68HC908QY/QT, the smallest member of
Motorola 8-bit M68HC08 MCU Family. All family members use the enhanced
M68HC08 central processor unit (CPU08), and are available with a variety of
modules, memory sizes and types, and package types.
With the exception of mask set errata documents, if any other Motorola document
contains information that conflicts with the information in the device data sheet, the
data sheet should be considered to have the most current and correct data.
are registered trademarks of Metrowerks Inc., a wholly owned subsidiary of Motorola Inc.
Freescale Semiconductor, Inc.
®
For More Information On This Product,
Door — Mirrors, window lifting, door locks
Engine — Sensors and small motors
Roof — Rain or light sensors
Steering wheel — Radio, cruise control, and lights
Seats — Position motors, occupant sensors
Dash board
HVAC — Flap control, sensors, blower motor, and control panels
technology licensed from SST.
Go to: www.freescale.com
®
. However, LIN’s simplicity and very low module price
© Motorola, Inc., 2003

Related parts for AN2600

AN2600 Summary of contents

Page 1

... Freescale Semiconductor, Inc. Application Note AN2600/D 12/2003 A Simple Keypad Using LIN with the MC68HC908QT/QY MCU By: David Svrcek and Zdenek Kaspar Motorola Czech System Laboratories Roznov p.R., Czech Republic General Description This document describes an implementation of a LIN slave simple keypad based on the MC68HC908QY/QT Family of microcontroller units (MCUs). ...

Page 2

... Freescale Semiconductor, Inc. AN2600/D Main LIN Features The main features of the LIN network are: • • • • • • • • Application Introduction This implementation shows the usage of a 6-key keypad and one LED as an output indicator. The MC68HC908QY/QT MCU has as many as 13 general-purpose input/output (GPIO) pins ...

Page 3

... MCU. This option is not used in this application. The MC33399 includes a 30-kΩ LIN pullup, so this does not need to be included on the PCB. MOTOROLA A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Figure 1. Go to: www.freescale.com AN2600/D Keypad Construction 3 ...

Page 4

... Freescale Semiconductor, Inc. AN2600/D The LIN driver uses the pin PTA1 for LIN Rx channel. This is a fixed configuration because PTA1 is the timer channel 1 (TCH1) pin. Any GPIO port can be used for the LIN Tx channel. In this application the PTB2 pin. The switches are connected to port B with pull-up resistors activated ...

Page 5

... ID with ID Sender Parity 0x1A Master 0x5B Keypad slave LIN_PutMsg() — loads data into message buffer to be sent to the master LIN_GetMsg() —used for receiving data from the master. Go to: www.freescale.com AN2600/D Application Software Length Message [Bytes] Data 2 See Table 3 2 See Table 2 ...

Page 6

... Freescale Semiconductor, Inc. AN2600/D Main Programming In the main loop of the application (depicted in Loop LIN_Msg() functions are called. The first function (Read_Button()) reads the port B values (where the switches are connected). They are compared to the previous values. If both values are equal, the counter keypadcount is used for the debouncing delay and also to decide if the same state has been present for long enough ...

Page 7

... Application source code (also at LIN_Keypad_QY.c) vector.c files Driver source with files of the Motorola LIN QY/QT driver software Driver config contains LINmsg.c and TxConfig.h files section. TX_Config.h specifies which pin of the Go to: www.freescale.com AN2600/D Application Software Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 — ...

Page 8

... Freescale Semiconductor, Inc. AN2600/D contain the LIN driver implementation code, which should not normally be modified by the user. The subfolder Prm contains the project parameter files (.prm), to define the ROM/RAM memory locations of the MCU. In folders Startup Code and Libs are the header/implementation files and the necessary libraries — ...

Page 9

... The driver consists of LINapi.c, LINdriver.c, LINdriver.h, LINmsg.c, and Tx_Config.h files. project tree (for example into the folders Sources\Driver source and Sources\Driver config). driver with: #include "LINdriver.h" Configuration File. Go to: www.freescale.com AN2600/D Application Software LIN Message 9 ...

Page 10

... Freescale Semiconductor, Inc. AN2600/D 6. Define the transmit pin of the LIN node in the Tx_Config.h file; default is 7. Update the vectors of the project in vector.c file. Specifically NOTE: The driver uses only timer channel 1, but usage of the timer modulus counter is prohibited because the driver assumes that the overflow value of the timer is set to 0xFFFF ...

Page 11

... Figure 5. Reception of One Data Byte (0x00) — Detail, 9600 bps Baud Rate MOTOROLA A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Go to: www.freescale.com AN2600/D CPU Usage LIN BUS ACTIVITY INTERRUPT ENTRY (RISING EDGE) AND EXIT (FALLING EDGE) ...

Page 12

... Freescale Semiconductor, Inc. AN2600/D Figure 6. Reception of a Full Message — Sync Break, a Sync Field, ID 0x1A, Two Data Bytes (Both of 0x00) and a Checksum Field, 9600 bps Figure 7. Reception of One Data Byte (0x00), 19200 bps Baud Rate 12 A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Go to: www ...

Page 13

... ID 0x1A, Two Data Bytes (Both of 0x00) and a Checksum Field, 19200 bps MOTOROLA A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, 19200 bps Baud Rate Go to: www.freescale.com AN2600/D CPU Usage LIN BUS ACTIVITY INTERRUPT ENTRY (RISING EDGE) AND EXIT (FALLING EDGE) ...

Page 14

... Freescale Semiconductor, Inc. AN2600/D References 1. MC68HC908QY/QT Data Sheet, 2. LIN Specification Package, Revision 1.3, 12 December 2002 3. Generic LIN Driver for MC68HC908QY4, 4. LINkits LIN Evaluation Boards, 5. Car Door Keypad Using LIN, Acronyms LIN CAN MOST GPIO PCB ID A/D MCU LSB ISR 14 A Simple Keypad Using LIN with the MC68HC908QT/QY MCU ...

Page 15

... ID for receiving /* ID for sending /* bit 0 in data st. reg set LED on PTA3 pin /* clear LED on PTA3 pin /* forever loop /* keypad status 1 /* keypad status 2 /* transmitted data Go to: www.freescale.com AN2600/D Application Source Code * * * * * * * * * * * ...

Page 16

... Freescale Semiconductor, Inc. AN2600/D unsigned char MsgRcvd [2]; #pragma DATA_SEG DEFAULT /****************************************************************************** * * Function name: Main * Originator: D.Svrcek * Date: 8th August 2003 * Function: The microprocessor is configured and initialized the main never ending loop two functions are called, * ‘Read-Button’ and ‘LIN_Msg’. * ******************************************************************************/ void main (void) { CONFIG1 = 0x09 ...

Page 17

... Go to: www.freescale.com AN2600/D Application Source Code * * * * * * * * * * ...

Page 18

... Freescale Semiconductor, Inc. AN2600/D else { keypadcount = 0; keypad_last = keypad; data1 = 0; data2 = /****************************************************************************** * * Function name: LIN_Msg * Originator: D.Svrcek * Date: 8th August 2003 * Function: The keypad status variables are saved to the buffer used * by the drivers for sending. The function ‘LIN_GetMsg’ * receive two bytes, if bit 0 in the first byte is set, * then the LED on the PTA3 pin is enabled ...

Page 19

... Byte count incl Checksum; /* Must be setup in the same order as ..... U8 const near MessageCountTbl[] = {0x13, 0x03}; MOTOROLA A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, MSHB =>F=Ignore Receive,0 = Send;*/ Go to: www.freescale.com AN2600/D Application Source Code */ */ */ */ */ */ ...

Page 20

... Freescale Semiconductor, Inc. AN2600/D /* LIN_LIST_SIZE is the number of Id:s in the IdTbl[] #define LIN_LIST_SIZE (( sizeof(IdTbl)) / sizeof( IdTbl[ No_of_Ids is the number of Ids in IdTbl[] U8 const No_of_Ids = LIN_LIST_SIZE store message status, e.g. LIN_MSG_NODATA or LIN_MSG_UPDATED U8 volatile LinMsgStatus[LIN_LIST_SIZE]; /**************** END LIN Frame setup dependant variables. *******************/ 20 A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Go to: www ...

Page 21

... Freescale Semiconductor, Inc. MOTOROLA A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Go to: www.freescale.com AN2600/D 21 ...

Page 22

... Freescale Semiconductor, Inc. AN2600 Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Go to: www.freescale.com MOTOROLA ...

Page 23

... Freescale Semiconductor, Inc. MOTOROLA A Simple Keypad Using LIN with the MC68HC908QT/QY MCU For More Information On This Product, Go to: www.freescale.com AN2600/D 23 ...

Page 24

... 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 Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2003 AN2600/D Go to: www.freescale.com ...

Related keywords