Electronic Components Datasheet Search
  British  ▼
ALLDATASHEET.CO.UK

X  

MPXM2102AS Datasheet(PDF) 489 Page - Motorola, Inc

Part # MPXM2102AS
Description  Sensor
PDF  670 Pages
Scroll/Zoom Zoom In 100%  Zoom Out
Manufacturer  MOTOROLA [Motorola, Inc]
Direct Link  http://www.freescale.com
Logo MOTOROLA - Motorola, Inc

MPXM2102AS Datasheet(HTML) 489 Page - Motorola, Inc

Back Button MPXM2102AS Datasheet HTML 485Page - Motorola, Inc MPXM2102AS Datasheet HTML 486Page - Motorola, Inc MPXM2102AS Datasheet HTML 487Page - Motorola, Inc MPXM2102AS Datasheet HTML 488Page - Motorola, Inc MPXM2102AS Datasheet HTML 489Page - Motorola, Inc MPXM2102AS Datasheet HTML 490Page - Motorola, Inc MPXM2102AS Datasheet HTML 491Page - Motorola, Inc MPXM2102AS Datasheet HTML 492Page - Motorola, Inc MPXM2102AS Datasheet HTML 493Page - Motorola, Inc Next Button
Zoom Inzoom in Zoom Outzoom out
 489 / 670 page
background image
AN1551
3–343
Motorola Sensor Device Data
www.motorola.com/semiconductors
SOFTWARE EXAMPLES
The following example listings show how a user may
communicate with the smart sensor via a master MCU. The
software example shown assumes that the master MCU is an
MC68HC11. Any MCU with the proper I/O functionality will
operate similarly with the smart sensor system.
When using parallel I/O instead of an SPI port to interface
the smart sensor, the user must “bit bang” the clock and data
out of the parallel I/O, so as to simulate the SPI port. As long
as the timing relationships of data and clock follow those of
Figure 3 (see also Table 3), the smart sensor will function
properly when interfaced to a processor with a parallel type
interface. In the following two code examples, the sensor unit
is interfaced to the master MCU via the SPI port, and the
sensor’s CS input is connected to the HC11’s Port D pin 5.
This example is coded in ‘C’ for the MC68HC11:
/* FIRST INITIALIZE THE I/O (INCLUDE A HEADER FILE TO INCLUDE I/O DEFINITIONS) */
void init_io(void)
{
PORTD = 0X29; /* SS* PD5 = 1, PD3 = 1, PD0 = 1 */
DDRD = 0X3B; /* SS* PD5 = 1, PD3 = 1, PD1 = 1, PD0 = 1 */
SPCR = 0X5E; /* ENABLE THE SPI, MAKE MCU THE MASTR, SCK = E CLK /4 */
/* I/O INITIALIZATION IS COMPLETE */
}
/* WE NEED A FUNCTION TO WRITE TO AND READ FROM THE SPI */
write_spi(char data)
{
SPDR = data; /* WRITE THE DATA TO THE SPI DATA PORT */
while( ! (SPSR & 0x80 )); /* WAIT UNTIL DATA HAS SHIFTED OUT OF AND
BACK INTO THE SPI */
return(SPDR): /* RETRIEVE THE RESULTS OF THE LAST COMMAND TO
THE SENSOR AND RETURN */
}
/* NOW WE NEED TO CALL THE ABOVE */
void main(void)
{
char rtn_data; /* rtn_data IS THE RETURNED DATA FROM THE SENSOR */
init_io();
while(1) /* JUST LOOP FOREVER */
rtn_data = write_spi(0x01); /* 0x01 IS THE COMMAND TO THE SENSOR
THAT REQUESTS PRESSURE. THE VALUE IN
rtn_data WILL BE IN THE RANGE OF
0..0XFF = 0..100% FULL SCALE PRESSURE THE
SECOND TIME THROUGH THE LOOP. THE INITIAL
TIME THROUGH THE LOOP, THE DATA
RETURNED IS INDETERMINATE */
}
The next example is coded in assembly for the MC68HC11:
* PORT OFFSETS INTO THE I/O MAP
PORTS
EQU
$1000
ASSUME THE I/O STARTS AT $1000
PORTD
EQU
$8
DDRD
EQU
$9
SPCR
EQU
$8
SPSR
EQU
$29
SPDR
EQU
$2A
ORG
$E000
* FIRST INITIALIZE THE I/O
INITIO
LDX
#PORTS
BASE ADDRESS OF THE I/O
LDAA
#$29
STAA
PORTD,X
SS* PD5 = 1, PD3 = 1, PD0 = 1
LDAA
#$3B
STAA
DDRD,X
SS* PD5 = 1, PD3 = 1, PD1 = 1, PD0 = 1
LDAA
#$5E
STAA
SPCR,X
ENABLE THE SPI, MAKE MCU THE MASTR,
*
SCK = E CLK /4
RTS
I/O INITIALIZATION IS COMPLETE
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com



Html Pages

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100  ...More


Datasheet Download

Go To PDF Page


Link URL



Does ALLDATASHEET help your business so far?  [ DONATE ] 

About Alldatasheet   |   Advertisement   |   Contact us   |   Privacy Policy   |   Link to Datasheet    |   Link Exchange   |   Manufacturer List
All Rights Reserved©Alldatasheet.com


Mirror Sites
English : Alldatasheet.com  |   English : Alldatasheet.net  |   Chinese : Alldatasheetcn.com  |   German : Alldatasheetde.com  |   Japanese : Alldatasheet.jp
Russian : Alldatasheetru.com  |   Korean : Alldatasheet.co.kr  |   Spanish : Alldatasheet.es  |   French : Alldatasheet.fr  |   Italian : Alldatasheetit.com
Portuguese : Alldatasheetpt.com  |   Polish : Alldatasheet.pl  |   Vietnamese : Alldatasheet.vn
Indian : Alldatasheet.in  |   Mexican : Alldatasheet.com.mx  |   British : Alldatasheet.co.uk  |   New Zealand : Alldatasheet.co.nz
Family Site : ic2ic.com  |   icmetro.com