ECE 4510 Introduction to Microprocessors. Chapter 10

Size: px
Start display at page:

Download "ECE 4510 Introduction to Microprocessors. Chapter 10"

Transcription

1 ECE 451 Introduction to Microprocessors Chapter 1 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences

2 Chapter 1 Serial Peripheral Interface (SPI) Extended serial string transmission ECE 451 2

3 What is Serial Peripheral Interface (SPI)? SPI is a synchronous serial protocol proposed by Motorola to be used as standard for interfacing peripheral chips to a microcontroller. Devices are classified into the master or slaves. The SPI protocol uses four wires to carry out the task of data communication: MOSI: master out slave in MISO: master in slave out SCK: serial clock SS: slave select An SPI data transfer is initiated by the master device. A master is responsible for generating the SCK signal to synchronize the data transfer. The SPI protocol is mainly used to interface with shift registers, LED/LCD drivers, phase locked loop chips, memory components with SPI interface, or A/D or D/A converter chips. ECE 451 3

4 Memory Addresses ECE 451 4

5 The HCS12 SPI Modules The MC9S12DP512 has three SPI modules: SPI, SPI1, and SPI2. By default, the SPI share the use of the upper 4 Port S pins: PS7 SS (can be rerouted to PM3) PS6 SCK (can be rerouted to PM5) PS5 MOSI (can be rerouted to PM4) PS4 MISO (can be rerouted to PM2) By default, the SPI1 shares the use of the lower 4 Port P pins: PP3 SS1 (can be rerouted to PH3) PP2 SCK1 (can be rerouted to PH2) PP1 MOSI1 (can be rerouted to PH1) PP MISO1 (can be rerouted to PH) By default, the SPI2 shares the use of the upper 4 Port P pins: PP6 SS2 (can be rerouted to PH7) PP7 SCK2 (can be rerouted to PH6) PP5 MOSI2 (can be rerouted to PH5) PP4 MISO2 (can be rerouted to PH4) It is important to make sure that there is no conflict in the use of signal pins when making rerouting decision. ECE 451 5

6 Adapt9S12DP512 I/O Pins ECE 451 6

7 SPI Related Registers (1 of 6) The operating parameters of each SPI module are controlled via two control registers: SPIxCR1: (x =, 1, or 2) SPIxCR2 The baud rate of SPI transfer is controlled by the SPIxBR register. The operation status of the SPI operation is recorded in the SPIxSR register. The contents of the SPIxCR1, SPIxCR2, SPIxBR, and SPIxSR registers are illustrated in Figure 1.1 to 1.4, respectively. The SS pin may be disconnected from SPI by clearing the SSOE bit in the SPIxCR1 register. After that, it can be used as a general I/O pin. If the SSOE bit in the SPIxCR1 register is set to 1, then the SS signal will be asserted to enable the slave device whenever a new SPI transfer is started. The equation for setting the SPI baud rate is given in Figure 1.3. ECE 451 7

8 SPI Related Registers (2 of 6) SPIE SPE SPTIE MSTR CPOL CPHA SSOE LSBFE reset: 1 SPIE: SPI interrupt enable bit = SPI interrupts are disabled 1 = SPI interrupts are enabled SPE: SPI system enable bit = SPI disabled 1 = SPI enabled and pins PS4-PS7 are dedicated to SPI function SPTIE: SPI transmit interrupt enable = SPTEF interrupt disabled 1 = SPTEF interrupt enabled MSTR: SPI master/slave mode select bit = slave mode 1 = master mode CPOL: SPI clock polarity bit = active high clocks selected; SCK idle low 1 = active low clocks selected, SCK idle high CPHA: SPI clock phase bit = The first SCK edge is issued one-half cycle into the 8-cycle transfer operation. 1 = The SCK edge is issued at the beginning of the 8-cycle transfer operation. SSOE: slave select output enable bit The SS output feature is enabled only in master mode by asserting the SSOE bit and the MODFEN bit of the SPIxCR2 register. LSBF: SPI least-significant-bit first enable bit = data is transferred most-significant bit first 1 = data is transferred least-significant bit first ECE 451 Figure 1.1 SPI control register 1 (SPIxCR1, x =, 1, or 2) 8

9 SPI Related Registers (3 of 6) MODFEN BIDIROE SPSWAI SPC reset: 1 MODFEN: Mode fault enable bit = Disable the MODF error 1 = Enable settinig the MODF error BIDIROE: Output enable in the bidirectional mode of operation = Output buffer disabled 1 = Output buffer enabled SPSWAI: SPI stop in wait mode = SPI clock operates normally in stop mode 1 = Stop SPI clock generation in Wait mode SPC: Serial pin control bit With the MSTR bit in the SPIxCR1 register, this bit enables bidirectional pin configuration as shown in Table 1.1. Figure 1.2 SPI control register 2 (SPIxCR2, x =, 1, or 2) ECE 451 9

10 SPI Related Registers (4 of 6) Table 1.1 SS input/output selection MODFEN SSOE Master Mode Slave mode SS not used by SPI SS not used by SPI SS input with MODF feature SS output SS input SS input SS input SS input ECE 451 1

11 SPI Related Registers (5 of 6) SPPR2 SPPR1 SPPR SPR2 SPR1 SPR reset: SPPR2~SPPR: SPI baud rate preselection bits SPR2~SPR: SPI baud rate selection bits BaudRateDivisor = (SPPR + 1) 2 (SPR + 1) Baud Rate = Bus Clock BaudRateDivisor Figure 1.3 SPI baud rate register (SPIxBR, x =, 1, or 2) SPIF SPTEF MODF reset: 1 SPIF: SPI interrupt request bit SPIF is set after the eight SCK cycles in a data transfer, and it is cleared by reading the SPSR register (with SPIF set) followed by a read access to the SPI data register. = transfer not yet complete 1 = new data copied to SPIxDR SPTEF: SPI data register empty interrupt flag = SPI data register not empty 1 = SPI data register empty MODF: mode error interrupt status flag = mode fault has not occurred ECE = mode fault has occurred 11 Material from or based Figure on: The 1.4 HCS12/9S12: SPI status An register Introduction (SPIxSR) to Software & Hardware

12 SPI Related Registers (6 of 6) Example 1.1 Give a value to be loaded to the SPIxBR register to set the baud rate to 2 MHz for a 24 MHz bus clock. Solution: 24 MHz 2 MHz = 12. One possibility is to set SPPR2-SPPR and SPR2-SPR to 1 and 1, respectively. The value to be loaded into the SPIxBR register is $21. Example 1.2 What is the highest possible baud rate for the SPI with 24 MHz bus clock? Solution: The highest SPI baud rate occurs when both the SPPR2-SPPR and SPR2-SPR are. In this case the baud rate is 24 MH 2 = 12 MHz. ECE

13 SPI Transmission Format (1 of 3) The data bits can be shifted on the rising or the falling edge of the SCK clock. Since the SCK can be idle high or idle low, there are four possible combinations as shown in Figure 1.5 and 1.6. To shift data bits on the rising edge, set CPOL-CPHA to or 11. To shift data bits on the falling edge, set CPOL-CPHA to 1 or 1. Data byte can be shifted in and out most significant bit first or least significant bit first. ECE

14 SPI Transmission Format (2 of 3) Transfer SS (O) master only Begin End SS (I) SCK (CPOL = ) SCK (CPOL = 1) Sample I MOSI/MISO Change O MOSI Pin Change O MISO Pin MSB first (LSBF = ) LSB first (LSBF = 1) t L MSB LSB Bit 6 Bit 1 Bit 5 Bit 2 Bit 4 Bit 3 Bit 3 Bit 4 Bit 2 Bit 5 Bit 1 Bit 6 LSB MSB t T t I t L Minimum 1/2 SCK for t T, t I, t L Figure 1.5 SPI Clock format (CPHA = ) ECE

15 SPI Transmission Format (3 of 3) Transfer SS (O) master only Begin End SS (I) SCK (CPOL = ) SCK (CPOL = 1) Sample I MOSI/MISO Change O MOSI Pin Change O MISO Pin MSB first (LSBF = ) LSB first (LSBF = 1) t L MSB LSB Bit 6 Bit 1 Bit 5 Bit 2 Bit 4 Bit 3 Bit 3 Bit 4 Bit 2 Bit 5 Bit 1 Bit 6 LSB MSB t T t I t L Minimum 1/2 SCK for t T, t I, t L Figure 1.6 SPI Clock format 1 (CPHA = 1) ECE

16 Bidirectional Mode (MOMI or SISO) A mode that uses only one data pin to shift data in and out. This mode is provided to deal with peripheral devices with only one data pin. Either the MOSI pin or the MISO pin can be used as the bidirectional pin. When the SPI is configured to the master mode (MSTR bit = 1), the MOSI pin is used in data transmission and becomes the MOMI pin. When the SPI is configured to the slave mode (MSTR bit = ), the MISO pin is used in data transmission and becomes the SISO pin. The direction of each serial pin depends on the BIDIROE bit of the SPIxCR2 register. The pin configuration for MOSI and MISO are illustrated in Figure 1.7. To read data from the peripheral device, clear the BIDIROE bit to. To output data to the peripheral device, set the BIDIROE bit to 1. The use of the this mode is illustrated in exercise problem 1.8. ECE

17 Normal and Bidirectional Mode When SPE = 1 Master mode MSTR = 1 Slave Mode MSTR = Normal Mode SPC = Serial Out SPI Serial In MOSI MISO Serial In SPI Serial Out MOSI MISO SWOM enables open-drain output SWOM enables open-drain output Bi-directional mode SPC = 1 Serial Out SPI Serial In BIDIROE MOMI Serial In SPI Serial Out BIDIROE SISO Figure 1.7 Normal mode and bidirectional mode ECE

18 Mode Fault Error If the SSx signal goes low while the SPIx is configured as a master, it indicates a system error where more than one master may be trying to drive the MOSIx and SCKx pins simultaneously. The MODF bit in the SPIxSR register will be set to 1 when mode fault condition occurs. When mode fault occurs, the MSTR bit will be cleared to and the output enable for the MOSIx and SCKx pins will be deasserted. ECE

19 SPI Circuit Connection In an SPI system, one device is configured as a master. Other devices are configured as slaves. The circuit connection for a single-slave system is shown in Figure 1.8. A multi-slave system may have two different connection methods as illustrated in Figure 1.9 and 1.1. In Figure 1.9, the master can exchange data with each individual slave without affecting other slaves. In Figure 1.1, all the slaves are configured into a larger ring. A data transmission with certain slaves will go through other slaves. ECE

20 Single IC Interconnection Master SPI Shift register MISO MISO Slave SPI MOSI SCK MOSI SCK Shift register Baud Rate Generator SS V DD SS Figure 1.8 Master/slave transfer block diagram ECE 451 2

21 SS Multiple IC Interconnection +5V Slave Slave 1 Slave k SPI Master (HCS12) SS Shift register MOSI SCK MISO SS Shift register MOSI SCK MISO SS... Shift register MOSI SCK MISO SS SCKx MOSIx MISOx PP PP PPk Figure 1.9 Single-master and multiple-slave device connection (method 1) ECE

22 Daisy Chained Multiple IC Interconnection Slave Slave 1 Slave k SPI Master (HCS12) +5V Shift register MOSI SCK MISO SS Shift register MOSI SCK MISO SS... Shift register MOSI SCK MISO SS SS SCKx... MOSIx MISOx Figure 1.1 Single-master and multiple-slave device connection (method 2) ECE

23 Example 1.3 Example 1.3 Configure the SPI to operate with the following setting assuming that Eclock is 24 MHz: 6 MHz baud rate Enable SPI to master mode SCK pin idle low with data shifted on the rising edge of SCK Transfer data most significant bit first and disable interrupt Disable SS function Stop SPI in Wait mode Normal SPI operation (not bidirectional mode) ECE

24 Example 1.3 Solution: f E / baud rate = 24 MHz/6 MHz = 4. We need to set SPPR2-SPPR and SPR2-SPR to 1 and, respectively. Write the value $1 into the SPIBR register. The following instruction sequence will configure the SPI as desired: movb #$1, SPIBR ; set baud rate to 6 MHz movb #$5, SPICR1 ; disable interrupt, enable SPI, SCK idle low, data ; latched on rising edge, data transferred msb first movb #$2, SPICR2 ; disable bidirectional mode, stop SPI in wait mode movb #, WOMS ; enable Port S pull-up ECE

25 SPI Desirable Utility Functions The following operations are common in many applications and should be made into library functions to be called by many SPI applications: Send a character to SPI putcspix (x =, 1, or 2) Send a string to SPI putsspix (x =, 1, or 2) Read a character from SPI getcspix (x =, 1, or 2) Read a string from SPI getsspix (x =, 1, or 2) ECE

26 Function putcspi putcspi: brclr SPISR,SPTEF, putcspi ; wait until write operation is permissible staa SPIDR ; output the character to SPI pcsp_lp: brclr SPISR,SPIF, pcsp_lp ; wait until the byte is shifted out ldaa SPIDR ; clear the SPIF flag rts void putcspi (char cx) { char temp; while(!(spisr & SPTEF)); /* wait until write is permissible */ SPIDR = cx; /* output the byte to the SPI */ while(!(spisr & SPIF)); /* wait until write operation is complete */ temp = SPIDR; /* clear the SPIF flag */ } ECE

27 Function putsspi ; the string to be output is pointed to by X putsspi: ldaa 1,x+ ; get one byte to be output to SPI port beq doneps ; reach the end of the string? jsr putcspi ; call subroutine to output the byte bra putsspi ; continue to output doneps: rts void putsspi(char *ptr) { while(*ptr) { /* continue until all characters have been output */ putcspi(*ptr); ptr++; } } ECE

28 Function getcspi ; This function reads a character from SPI and returns it in accumulator A getcspi: brclr SPISR,SPTEF, getcspi ; wait until write operation is permissible staa SPIDR ; trigger eight clock pulses for SPI transfer gcsp_lp: brclr SPISR,SPIF, gcsp_lp ; wait until a byte has been shifted in ldaa SPIDR ; return the byte in A and clear the SPIF flag rts char getcspi(void) { while(!(spisr & SPTEF)); /* wait until write is permissible */ SPIDR = x; /* trigger 8 SCK pulses to shift in data */ while(!(spisr & SPIF)); /* wait until a byte has been shifted in */ return SPIDR; /* return the character */ } ECE

29 Function getsspi ; This function reads a string from the SPI and store it in a buffer pointed to by X ; The number of bytes to be read in passed in accumulator B getsspi: tstb ; check the byte count beq donegs ; return when byte count is zero jsr getcspi ; call subroutine to read a byte staa 1,x+ ; save the returned byte in the buffer decb ; decrement the byte count bra getsspi donegs: clr,x ; terminate the string with a NULL character rts void getsspi(char *ptr, char count) { while(count) { /* continue while byte count is nonzero */ *ptr++ = getcspi(); /* get a byte and save it in buffer */ count--; } *ptr = ; /* terminate the string with a NULL */ } ECE

30 SPI ICs: The HC595 Shift Register The HC595 consists of an 8-bit shift register and a D-type latch with three-state parallel output. The shift register provides parallel data to the latch. The maximum data shift rate is 1 MHz (Philips part). DS 14 SC 11 Shift register Latch Q A Q B Q C Q D Q E Q F Q G Q H Reset LC OE VCC = Pin 16 GND = Pin 8 ECE 451 Figure 1.11 The 74HC595 block diagram and pin assignment 3 9 SQ H

31 Signal Pins of the HC595 DS: serial data input SC: shift clock. A low-to-high transition on this pin causes the data at the serial input pin to be shifted into the 8-bit shift register. Reset: A low on this pin resets the shift register portion of this device. LC: latch clock. A low-to-high transition on this pin loads the contents of the shift register into the output latch. OE: output enable. A low on this pin allows the data from the latches to be presented at the outputs. QA to QH: tri-state latch output SQH: the output of the eight stage of the shift register ECE

32 Applications of the HC595 (1 of 2) The HC595 is often used to add parallel ports to the microcontroller. Both the connection methods shown in Figure 1.9 and 1.1 can be used to add parallel ports to the MCU. ECE

33 Example 1.5 Example 1.5 Describe how to use two 74HC595s to drive eight common cathode seven-segment displays assuming that the E clock frequency of the HCS12 is 24 MHz. Solution: Use the circuit in figure 1.12 to connect two 74HC595s to the HCS12. MOSI OE 5V reset 74HC595 Q G Q F... Q A DS SC LC SQ H 5V reset DS Q H 3 3 R... a b g 2N2222 #7 #6 # a a b b SCK SC R Q 2N2222. G. PK7 LC... OE. R Q 2N2222 A HCS12 ECE HC Figure 1.12 Two Interfacing, 74HC595s Thomson together Delmar drive Learning, eight 26. seven-segment displays... common cathode g common cathode g common cathode I MAX = 7 ma

34 ASM Program to display on display #7 to # (1 of 2) #include c:\miniide\hcs12.inc".org $1 disptab:.byte $8,$7F,$4,$7,$2,$5F,$1,$5B.byte $8,$33,$4,$79,$2,$6D,$1,$3 icnt:.blkb 1 ; loop count.text _main:: lds #$3C ; set up stack pointer bset DDRK,$8 ; configure the PK7 pin for output jsr openspi ; configure SPI forever: ldx #disptab ; use X as a pointer to the table movb #8,icnt ; set loop count to 8 loop: ldaa 1,x+ ; send the digit select byte to the 74HC595 jsr putcspi ; " ldaa 1,x+ ; send segment pattern to 74HC595 jsr putcspi ; " bclr PTK,BIT7 ; transfer data from shift register to output bset PTK,BIT7 ; latch ldy #1 ; display the digit for one ms jsr delayby1ms ; " dec icnt ; bne loop ; if not reach digit 1, then next bra forever ; start from the start of the table ECE

35 ASM Program to display on display #7 to # (2 of 2) openspi: movb #,SPIBR ; set baud rate to 12 MHz movb #$5,SPICR1 ; disable interrupt, enable SPI, SCK idle low, ; latch data on rising edge, transfer data msb first movb #$2,SPICR2 ; disable bidirectional mode, stop SPI in wait mode movb #,WOMS ; enable Port S pull-up rts #include "c:\miniide\delay.asm" #include "c:\miniide\spiutil.asm" ECE

36 C Program #include c:\egnu91\include\hcs12.h #include c:\egnu91\include\spiutil.c #include c:\egnu91\include\delay.c void openspi(void); void main (void) { unsigned char disp_tab[8][2] = {{x8,x7f},{x4,x7},{x2,x5f},{x1,x5b}, {x8,x33},{x4,x79},{x2,x6d},{x1,x3}}; char i; openspi(); /* configure the SPI module */ DDRK = BIT7; /* configure pin PK7 as output */ while(1) { for (i = ; i < 8; i++) { putcspi(disp_tab[i][]); /* send out digit select value */ putcspi(disp_tab[i][1]); /* send out segment pattern */ PTK &= ~BIT7; /* transfer values to latches of 74HC595s */ PTK = BIT7; /* " */ delayby1ms(1); /* display a digit for 1 ms */ } } ECE }

37 The TC72 Digital Thermometer 1-bit resolution and SPI interface Pin assignment and block diagram shown in Figure Capable of reading temperature from -55oC to 125oC. Can be used in continuous temperature conversion or one-shot conversion mode. Has internal clock generator to control the automatic temperature conversion sequence V DD Internal diode temperature sensor TC72 NC CE SCK GND 1 2 TC V DD NC SDI SDO 1-bit sigma Delta A/D converter temperature register Manufacturer ID register Serial Port Interface CE SCK SDO SDI GND Control Register ECE Material Figure from or 1.13 based TC72 on: The pin HCS12/9S12: assignment An and Introduction functional to Software block diagram & Hardware

38 Temperature Data Format Temperature is represented by a 1-bit two s complement word with a resolution of.25oc per least significant bit. The converter is scaled from -128oC to +127oC with oc represented as x. The temperature value is stored in two 8-bit registers. Whenever the most significant bit is 1, the temperature is negative. A sample of temperature reading is shown. Table 1.3 TC72 Temperature output data Binary high byte/low byte 1 1/1 1 11/1 1 11/11 1/1 / / / / 11 11/1 Hex 214 4A8 1AC 18 FF8 F2C E7 C9 Temperature o C 74.5 o C o C 1.5 o C o C -.5 o C o C -24 o C -55 o C ECE

39 TC72 s Serial Interface The CE input to the TC72 must be asserted (high) to enable SPI transfer. Data can be shifted on the rising edge or the falling edge depending on the idle polarity of the SCK source. Data transfer to and from the TC72 consists of one address byte followed by one or multiple data (2 to 4) bytes. The TC72 registers and their addresses are shown in Table 1.4. The most significant bit of the address byte determines whether a read (A7 = ) or a write (A7 = 1) operation will occur. A multiple byte read operation will start from high address toward lower addresses. The user can send in the temperature result high byte address and read the temperature result high byte, low byte, and the control registers. Table 1.4 Register for TC72 Register Read address Write address Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit Value on POR/BOR Control LSBtemperature MSBtemperature ManufacturerID x x1 x2 x3 Note. 1. OS is One-Shot 2. SHDN is Shutdown x8 N/A N/A N/A T1 T9 T T8 1 ECE T7 OS T6 1 T5 T4 1 T3 SHDN T2 x5 x x x54

40 Procedure for Reading Temperature (1 of 2) Step 1 Pull the CE pin high to enable SPI transfer. Step 2 Send the temperature result high byte read address (x2) to the TC72. Wait until the SPI transfer is complete. Step 3 Read the temperature result high byte. The user needs to write a dummy byte into the SPI data register to trigger eight clock pulses. Step 4 Read the temperature result low byte. Again, the user needs to write a dummy byte into the SPI data register to trigger eight clock pulses. Step 5 Pull CE pin to low so that a new transfer can be started. ECE 451 4

41 Procedure for Reading Temperature (2 of 2) CE SCK SDI A7 = A 7 A 6 A 5 A 4 A 3 A 2 A 1 A SDO High Z D 7 D 6 D 5 D 4 D 3 D 2 D 1 D high Z Figure 1.15b Single data byte read operation CE SCK Write operation SDI Read operation Address byte = x2 A 7 A SDO D 7 D D 7 D D 7 D Figure 1.15c SPI multiple data byte transfer ECE

42 Control Register The control register is used to select the shutdown, continuous, or one-shot conversion operating mode. The temperature conversion mode selection logic is shown in Table 1.5. At power up, the SHDN bit is 1. Thus the TC72 is in the shutdown mode. If the SHDN bit is, the TC72 will perform a temperature conversion approximately every 15 ms. A temperature conversion will be initiated by a write operation into the control register to select the continuous mode or one-shot mode. A typical circuit connection between the TC72 and the HCS12 is shown in Figure Table 1.5 Control register temperature conversion mode selection Operationmode Continuoustemperatureconversion Shutdown Continuoustemperatureconversion One-shot One-Shot bit 1 1 Shutdown bit 1 1 ECE

43 Example 1.6: Reading Temp. Write a C program to read the temperature every 2 ms. Convert the temperature to a string so that it can be displayed in an appropriate output device. A pointer to hold the string will be passed to this function. The bus clock is 24 MHz. V DD.1 F TC72 VDD CE SCK SDO SDI GND HCS12 MCU PK7 SCK MISO MOSI Figure 1.16 Circuit connection between the TC72 and the HCS12 ECE

44 C Code (1 of 4) #include c:\egnu91\include\hcs12.h #include c:\egnu91\include\spiutil.c #include c:\egnu91\include\delay.c #include c:\egnu91\include\convert.c void read_temp (char *ptr); void openspi(void); char buf[1]; void main (void) { DDRM = BIT1; /* configure the PM1 pin for output */ openspi(); /* configure SPI module */ read_temp(&buf[]); } void openspi(void) { SPIBR = x1; /* set baud rate to 6 MHz */ SPICR1 = x5; /* enable SPI to master mode, select rising edge to shift data in and out */ SPICR2 = x2; /* select normal mode and stop SPI in wait mode */ WOMS = x; /* enable Port S pull-up */ ECE 451 } 44

45 C Code (2 of 4) void read_temp (char *ptr) { char hi_byte, lo_byte, temp, *bptr; unsigned int result; bptr = ptr; PTM = BIT1; /* enable TC72 data transfer */ putcspi(x8); /* send out TC72 control register write address */ putcspi(x11); /* perform one shot conversion */ PTM &= ~BIT1; /* disable TC72 data transfer */ delayby1ms(2); /* wait until temperature conversion is complete */ PTM = BIT1; /* enable TC72 data transfer */ putcspi(x2); /* send MSB temperature read address */ hi_byte = getcspi(); /* read the temperature high byte */ lo_byte = getcspi(); /* save temperature low byte and clear SPIF */ PTM &= ~BIT1; /* disable TC72 data transfer */ lo_byte &= xc; /* make sure the lower 6 bits are s */ result = (int) hi_byte * (int) lo_byte; if (hi_byte & x8) { /* temperature is negative */ result = ~result + 1; /* take the two' complement of result */ result >>= 6; ECE

46 temp = result & x3; /* place the lowest two bits in temp */ result >>= 2; /* get rid of fractional part */ *ptr++ = x2d; /* store the minus sign */ int2alpha(result, ptr); } else { /* temperature is positive */ result >>= 6; temp = result & x3; /* save fractional part */ result >>= 2; /* get rid of fractional part */ int2alpha(result, ptr); /* convert to ASCII string */ } while(*bptr){ /* search the end of the string */ bptr++; }; switch (temp){ /* add fractional digits to the temperature */ case : break; case 1: /* fractional part is.25 */ *bptr++ = x2e; /* add decimal point */ *bptr++ = x32; *bptr++ = x35; *bptr = '\'; C Code (3 of 4) ECE Material break; from or based on: The HCS12/9S12: An Introduction to Software & Hardware

47 C Code (4 of 4) } } case 2: /* fractional part is.5 */ *bptr++ = x2e; /* add decimal point */ *bptr++ = x35; *bptr = '\'; break; case 3: /* fractional part is.75 */ *bptr++ = x2e; /* add decimal point */ *bptr++ = x37; *bptr++ = x35; *bptr = '\'; break; default: break; ECE

ECE 4510/5530 Microcontroller Applications Week 6

ECE 4510/5530 Microcontroller Applications Week 6 ECE 4510/5530 Microcontroller Applications Week 6 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences Lab 5 Element Hardware

More information

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide

The 9S12 Serial Peripheral Inteface (SPI) Huang Section 10.2 through 10.6 SPI Block User Guide The 9S12 Serial Peripheral Inteface (SPI) Huang Section 102 through 106 SPI Block User Guide The 9S12 Serial Peripheral Interface (SPI) The 9S12 has a Synchronous Serial Interface On the 9S12 it is called

More information

Module 3.C. Serial Peripheral Interface (SPI) Tim Rogers 2017

Module 3.C. Serial Peripheral Interface (SPI) Tim Rogers 2017 Module 3.C Serial Peripheral Interface (SPI) Tim Rogers 2017 Learning Outcome #3 An ability to effectively utilize the wide variety of peripherals integrated into a contemporary microcontroller How? A:

More information

More on the 9S12 SPI Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI

More on the 9S12 SPI Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI More on the 9S12 SPI Using the Dallas Semiconductor DS1302 Real Time Clock with the 9S12 SPI Using the 9S12 SPI The SPI has a data register (SPIDR) and a shift register. To write data to the SPI, you write

More information

SPI Block User Guide V02.07

SPI Block User Guide V02.07 DOCUMENT NUMBER S12SPIV2/D SPI Block User Guide V02.07 Original Release Date: 21 JAN 2000 Revised: 11 Dec 2002 Motorola, Inc. Motorola reserves the right to make changes without further notice to any products

More information

EE 308 Spring Using the 9S12 SPI

EE 308 Spring Using the 9S12 SPI Using the 9S12 SPI The SPI has a data register (SPIDR) and a shift register. To write data to the SPI, you write to the SPIDR data register. The 9S12 automatically transfers the data to the shift register

More information

spi 1 Fri Oct 13 13:04:

spi 1 Fri Oct 13 13:04: spi 1 Fri Oct 1 1:: 1.1 Introduction SECTION SERIAL PERIPHERAL INTERFACE (SPI) The SPI module allows full-duplex, synchronous, serial communication with peripheral devices.. Features Features of the SPI

More information

Serial Peripheral Interface (SPI) Host Controller Data Sheet

Serial Peripheral Interface (SPI) Host Controller Data Sheet Serial Peripheral Interface (SPI) Host Controller Data Sheet Proven System Block (PSB) for QuickLogic Customer Specific Standard Products (CSSPs) Features Supports Master configuration (Multi-Master configuration

More information

Microcontrollers and Interfacing

Microcontrollers and Interfacing Microcontrollers and Interfacing Week 10 Serial communication with devices: Serial Peripheral Interconnect (SPI) and Inter-Integrated Circuit (I 2 C) protocols College of Information Science and Engineering

More information

Menu. What is SPI? EEL 3744 EEL 3744 SPI

Menu. What is SPI? EEL 3744 EEL 3744 SPI Menu Concepts >Problems in serial communications Timing Synchronization: How do you line up the bit boundaries? Message Synchronization: How do you line up messages? Look into my... >Synchronous data solves

More information

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave.

EE 456 Fall, Table 1 SPI bus signals. Figure 1 SPI Bus exchange of information between a master and a slave. EE 456 Fall, 2009 Notes on SPI Bus Blandford/Mitchell The Serial Peripheral Interface (SPI) bus was created by Motorola and has become a defacto standard on many microcontrollers. This is a four wire bus

More information

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI

Embedded Systems and Software. Serial Interconnect Buses I 2 C (SMB) and SPI Embedded Systems and Software Serial Interconnect Buses I 2 C (SMB) and SPI I2C, SPI, etc. Slide 1 Provide low-cost i.e., low wire/pin count connection between IC devices There are many of serial bus standards

More information

ECE 4510/5530 Microcontroller Applications Week 10

ECE 4510/5530 Microcontroller Applications Week 10 ECE 4510/5530 Microcontroller Applications Week 10 Dr. Bradley J. Bazuin Associate Professor Department of Electrical and Computer Engineering College of Engineering and Applied Sciences ECE 4510/5530

More information

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions

Review for Exam 3. Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions Review for Exam 3 A/D Converter Power-up A/D converter (ATD0CTL2) Write 0x05 to ATD0CTL4 to set at fastest conversion speed and 10-bit conversions Write 0x85 to ATD0CTL4 to set at fastest conversion speed

More information

Introduction to Serial Communication. ECE/CS 5780/6780: Embedded System Design. A Serial Channel. Definitions. SCI versus SPI.

Introduction to Serial Communication. ECE/CS 5780/6780: Embedded System Design. A Serial Channel. Definitions. SCI versus SPI. Introduction to Serial Communication ECE/CS 5780/6780: Embedded System Design Chris J. Myers Lecture 14: Serial I/O Devices Serial communication transmits of one bit of information at a time. One bit is

More information

CS/ECE 5780/6780: Embedded System Design

CS/ECE 5780/6780: Embedded System Design CS/ECE 5780/6780: Embedded System Design John Regehr Lecture 15: Serial I/O Devices Today Quick overview of serial communication in general SCI Serial Communication Interface SCI on the HCS12 Introduction

More information

ECE/CS 5780/6780: Embedded System Design. Introduction to Serial Communication

ECE/CS 5780/6780: Embedded System Design. Introduction to Serial Communication ECE/CS 5780/6780: Embedded System Design Scott R. Little Lecture 15: Serial I/O Devices Scott R. Little (Lecture 15: Serial I/O) ECE/CS 5780/6780 1 / 69 Introduction to Serial Communication Serial communication

More information

EE345L Fall 2008 Final Page 1 of 12

EE345L Fall 2008 Final Page 1 of 12 EE345L Fall 2008 Final Page 1 of 12 Jonathan W. Valvano First: Last: This is the closed book section. You must put your answers in the boxes on this answer page. When you are done, you turn in the closed-book

More information

< W3150A+ / W5100 Application Note for SPI >

< W3150A+ / W5100 Application Note for SPI > < W3150A+ / W5100 Application Note for SPI > Introduction This application note describes how to set up the SPI in W3150A+ or W5100. Both the W3150A+ and W5100 have same architecture. W5100 is operated

More information

Serial Peripheral Interface (SPI)

Serial Peripheral Interface (SPI) SPI = Simple, 3 wire, full duplex, synchronous serial data transfer Interfaces to many devices, even many non-spi peripherals Can be a master or slave interface 4 interface pins: -MOSI master out slave

More information

Using the Z8051 MCU s USI Peripheral as an SPI Interface

Using the Z8051 MCU s USI Peripheral as an SPI Interface Using the Z8051 MCU s USI Peripheral as an SPI Interface AN035901-0513 Abstract This document describes how to configure Zilog s Z8051 Universal Serial Interface (USI) peripheral to operate as Serial Peripheral

More information

Interfacing the HI7190 to a Microcontroller

Interfacing the HI7190 to a Microcontroller Interfacing the to a Microcontroller Application Note September 1995 AN9527 Authors: Stephen LaJeunesse and John Kornblum Introduction The Intersil is a 24-bit monolithic instrumentation sigma delta A/D

More information

PIN ASSIGNMENT PIN DESCRIPTION

PIN ASSIGNMENT PIN DESCRIPTION www.dalsemi.com FEATURES Temperature measurements require no external components Measures temperatures from -55 C to +120 C. Fahrenheit equivalent is -67 F to +248 F Thermometer accuracy is ±2.0 C Thermometer

More information

OUTLINE. SPI Theory SPI Implementation STM32F0 SPI Resources System Overview Registers SPI Application Initialization Interface Examples

OUTLINE. SPI Theory SPI Implementation STM32F0 SPI Resources System Overview Registers SPI Application Initialization Interface Examples SERIAL PERIPHERAL INTERFACE (SPI) George E Hadley, Timothy Rogers, and David G Meyer 2018, Images Property of their Respective Owners OUTLINE SPI Theory SPI Implementation STM32F0 SPI Resources System

More information

Design with Microprocessors

Design with Microprocessors Design with Microprocessors Lecture 6 Interfaces for serial communication Year 3 CS Academic year 2017/2018 1 st Semester Lecturer: Radu Dănescu Serial communication modules on AVR MCUs Serial Peripheral

More information

Understanding SPI with Precision Data Converters

Understanding SPI with Precision Data Converters Understanding SPI with Precision Data Converters By: Tony Calabria Presented by: 1 Communication Comparison SPI - Serial Peripheral Interface Bus I2C - Inter- Integrated Circuit Parallel Bus Advantages

More information

An SPI interface for the 65(C)02 family of microprocessors

An SPI interface for the 65(C)02 family of microprocessors Rev 4/B Dec 30, 2011 65SPI/B An SPI interface for the 65(C)02 family of microprocessors This device was created to provide a basic SPI interface for the 65xx family of microprocessors. Currently, the only

More information

AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL

AREA OPTIMIZATION OF SPI MODULE USING VERILOG HDL International Journal of Electronics and Communication Engineering & Technology (IJECET) Volume 7, Issue 3, May June 2016, pp. 38 45, Article ID: IJECET_07_03_005 Available online at http://www.iaeme.com/ijecet/issues.asp?jtype=ijecet&vtype=7&itype=3

More information

AT89S4D12. 8-Bit Microcontroller with 132K Bytes Flash Data Memory AT89S4D12. Features. Description. Pin Configurations

AT89S4D12. 8-Bit Microcontroller with 132K Bytes Flash Data Memory AT89S4D12. Features. Description. Pin Configurations Features Compatible with MCS-51 Products 128K Bytes of In-System Reprogrammable Flash data memory and 4K Bytes of Downloadable Flash Program Memory Endurance: 1,000 Write/Erase Cycles per Sector Data Retention:

More information

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus Application Note An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus AN012703-0608 Abstract This Application Note provides an overview of Zilog s Z8 Encore! Serial Peripheral Interface (SPI)

More information

DS1306. Serial Alarm Real Time Clock (RTC)

DS1306. Serial Alarm Real Time Clock (RTC) www.dalsemi.com FEATURES Real time clock counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap year compensation valid up to 2100 96-byte nonvolatile RAM for data

More information

DS1305EN. Serial Alarm Real-Time Clock

DS1305EN. Serial Alarm Real-Time Clock Serial Alarm Real-Time Clock www.maxim-ic.com FEATURES Real-time clock (RTC) counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap-year compensation valid up to

More information

Digital Thermometers and Thermostats with SPI/3-Wire Interface

Digital Thermometers and Thermostats with SPI/3-Wire Interface 19-5629; Rev 0; 11/10 Digital Thermometers and Thermostats General Description The digital thermometers and thermostats with an SPI /3-wire interface provide temperature readings that indicate the device

More information

Application Note. Interfacing the CS5521/22/23/24/28 to the 68HC05. Figure 1. 3-Wire and 4-Wire Interfaces

Application Note. Interfacing the CS5521/22/23/24/28 to the 68HC05. Figure 1. 3-Wire and 4-Wire Interfaces Application Note Interfacing the CS5521/22/23/24/28 to the 68HC05 TABLE OF CONTENTS 1. INTRODUCTION... 1 2. ADC DIGITAL INTERFACE... 1 3. SOFTWARE DESCRIPTION... 2 3.1 Initialize... 2 3.2 Write Channel

More information

Interfacing Techniques in Embedded Systems

Interfacing Techniques in Embedded Systems Interfacing Techniques in Embedded Systems Hassan M. Bayram Training & Development Department training@uruktech.com www.uruktech.com Introduction Serial and Parallel Communication Serial Vs. Parallel Asynchronous

More information

AN-145 ARINC 429 / SPI Demonstration board HI-3585, HI-3598/HI-3599 Applications Note

AN-145 ARINC 429 / SPI Demonstration board HI-3585, HI-3598/HI-3599 Applications Note December 2017 AN-145 ARINC 429 / SPI Demonstration board HI-3585, HI-3598/HI-3599 Applications Note INTRODUCTION The Holt HI-3598 and HI-3599 are silicon gate CMOS ICs for interfacing eight ARINC 429 receive

More information

Freescale Semiconductor, Inc.

Freescale Semiconductor, Inc. Order this document by /D Software I 2 C Communications By Brad Bierschenk MMD Applications Engineering Austin, Texas Introduction I 2 C Overview The I 2 C (inter-integrated circuit) protocol is a 2-wire

More information

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso

Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Design and development of embedded systems for the Internet of Things (IoT) Fabio Angeletti Fabrizio Gattuso Microcontroller It is essentially a small computer on a chip Like any computer, it has memory,

More information

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly.

EE 308 Spring A software delay. To enter a software delay, put in a nested loop, just like in assembly. More on Programming the 9S12 in C Huang Sections 5.2 through 5.4 Introduction to the MC9S12 Hardware Subsystems Huang Sections 8.2-8.6 ECT_16B8C Block User Guide A summary of MC9S12 hardware subsystems

More information

Lecture 14 Serial Peripheral Interface

Lecture 14 Serial Peripheral Interface www.atomicrhubarb.com/systems Lecture 14 Serial Peripheral Interface Section Topic Where in the books Zilog PS220 "Enhanced Serial Peripheral Interface" Assorted datasheets Synchronous Serial Buses 1-wire

More information

Serial Peripheral Interface (SPI) Last updated 8/7/18

Serial Peripheral Interface (SPI) Last updated 8/7/18 Serial Peripheral Interface (SPI) Last updated 8/7/18 MSP432 SPI eusci = enhanced Universal Serial Communications Interface 2 tj MSP432 SPI ARM (AMBA Compliant) 7/8 bit transmission Master/Slave LSB/MSB

More information

AN-150 HI-3598, HI-3599 Design Example Applications Note

AN-150 HI-3598, HI-3599 Design Example Applications Note July 2008 AN-150 HI-3598, HI-3599 Design Example Applications Note INTRODUCTION The Holt HI-3598 and HI-3599 are silicon gate CMOS ICs for interfacing eight ARINC 429 receive buses to a high-speed Serial

More information

Serial versus Parallel Data Transfers

Serial versus Parallel Data Transfers Serial versus Parallel Data Transfers 1 SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Serial communications Most communications is carried out over serial links Fewer wires needed Less electronics

More information

Synchronous = SPI (3 options)

Synchronous = SPI (3 options) CS/ECE 6780/5780 Al Davis Today s topics: Last lecture general serial I/O concepts more specifics on asynchronous SCI protocol Today specifics of synchronous SPI details of the SCI programming ritual 1

More information

The Serial Peripheral Interface

The Serial Peripheral Interface (SPI) ARSLAB - Autonomous and Robotic Systems Laboratory Dipartimento di Matematica e Informatica - Università di Catania, Italy santoro@dmi.unict.it L.S.M. 1 Course What is SPI? The SPI Serial Peripheral

More information

Serial Peripheral Interface (SPI)

Serial Peripheral Interface (SPI) Serial Peripheral Interface (SPI) MSP432 SPI eusci = enhanced Universal Serial Communications Interface 2 tj MSP432 SPI ARM (AMBA Compliant) 7/8 bit transmission Master/Slave LSB/MSB first Separate RX/TX

More information

SPI 3-Wire Master (VHDL)

SPI 3-Wire Master (VHDL) SPI 3-Wire Master (VHDL) Code Download Features Introduction Background Port Descriptions Clocking Polarity and Phase Command and Data Widths Transactions Reset Conclusion Contact Code Download spi_3_wire_master.vhd

More information

User-configurable Resolution. 9 to 12 bits (0.5 C to C)

User-configurable Resolution. 9 to 12 bits (0.5 C to C) AT30TS75A 9- to 12-bit Selectable, ±0.5 C Accurate Digital Temperature Sensor DATASHEET See Errata in Section 12. Features Single 1.7V to 5.5V Supply Measures Temperature -55 C to +125 C Highly Accurate

More information

User-configurable Resolution. 9 to 12 bits (0.5 C to C)

User-configurable Resolution. 9 to 12 bits (0.5 C to C) AT30TS74 9- to 12-bit Selectable, ±1.0 C Accurate Digital Temperature Sensor DATASHEET Features Single 1.7V to 5.5V Supply Measures Temperature From -55 C to +125 C Highly Accurate Temperature Measurements

More information

Application Note. Interfacing the CS5525/6/9 to the 68HC05. By Keith Coffey MOSI (PD3) SDO MISO (PD2) SCLK. Figure 1. 3-Wire and 4-Wire Interfaces

Application Note. Interfacing the CS5525/6/9 to the 68HC05. By Keith Coffey MOSI (PD3) SDO MISO (PD2) SCLK. Figure 1. 3-Wire and 4-Wire Interfaces Application Note Interfacing the CS5525/6/9 to the 68HC05 By Keith Coffey INTRODUCTION This application note details the interface of Crystal Semiconductor s CS5525/6/9 Analog-to-Digital Converter (ADC)

More information

Digital Thermometer and Thermostat

Digital Thermometer and Thermostat General Description The DS75 digital thermometer and thermostat provides 9, 10, 11, or 12-bit digital temperature readings over a -55 C to +125 C range with ±2 C accuracy over a -25 C to +100 C range.

More information

Serial Communication Through an Asynchronous FIFO Buffer

Serial Communication Through an Asynchronous FIFO Buffer Serial Communication Through an Asynchronous FIFO Buffer Final Project Report December 9, 2000 E155 Nick Bodnaruk and Andrew Ingram Abstract: For our clinic, we need to be able to use serial communication

More information

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680 Application Note Getting Started with ESPI Interface Using the Z8 Encore! XP F1680 AN027301-0308 Abstract This application note demonstrates how to use the Enhanced Serial Peripheral Interface (ESPI) in

More information

a Serial Peripheral Interace (SPI). Embedded RISC Microcontroller Core Peripheral

a Serial Peripheral Interace (SPI). Embedded RISC Microcontroller Core Peripheral Features Full-duplex, 3-wire Synchronous Data Transfer Master or Slave Operation Maximum Bit Frequency of f CLOCK /4 (in M-bits/second) LSB First or MSB First Data Transfer Four Programmable Bit Rates

More information

XEN1210 Magnetic Sensor

XEN1210 Magnetic Sensor Features Single axis magnetic measurement One chip solution 15nT resolution Unmatched low offset (Sub-µT) and gain precision Wide magnetic field range (±63mT) No magnetic hysteresis Measurement rate up

More information

Introduction to I2C & SPI. Chapter 22

Introduction to I2C & SPI. Chapter 22 Introduction to I2C & SPI Chapter 22 Issues with Asynch. Communication Protocols Asynchronous Communications Devices must agree ahead of time on a data rate The two devices must also have clocks that are

More information

DS1305EN. Serial Alarm Real-Time Clock

DS1305EN. Serial Alarm Real-Time Clock Serial Alarm Real-Time Clock www.maxim-ic.com FEATURES Real-time clock (RTC) counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap-year compensation valid up to

More information

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016

McMaster University Embedded Systems. Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016 McMaster University Embedded Systems Computer Engineering 4DS4 Lecture 6 Serial Peripherals Amin Vali Feb. 2016 Serial Peripherals I2C Inter-IC Bus X/Y Coord. RGB data LCD config controller LCD data controller

More information

Temperature Sensor TMP2 PMOD Part 1

Temperature Sensor TMP2 PMOD Part 1 Temperature Sensor TMP2 PMOD Part 1 Overview of the Temperature Sensor and I 2 C Interfacing Reference Sites: Diligent Temp2 PMOD: http://www.digilentinc.com/products/detail.cfm?navpath=2,401,961&prod=pmod-tmp2

More information

For reference only Refer to the latest documents for details

For reference only Refer to the latest documents for details STM32F3 Technical Training For reference only Refer to the latest documents for details Serial peripheral interface SPI 3 SPI Features (1/2) 3 Full duplex synchronous transfers (3 lines) Half duplex/simplex

More information

AN1745. Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas. Introduction

AN1745. Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas. Introduction Order this document by /D Interfacing the HC705C8A to an LCD Module By Mark Glenewinkel Consumer Systems Group Austin, Texas Introduction More and more applications are requiring liquid crystal displays

More information

DS1306 Serial Alarm Real-Time Clock

DS1306 Serial Alarm Real-Time Clock Serial Alarm Real-Time Clock www.maxim-ic.com FEATURES Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the Week, and Year with Leap-Year Compensation Valid Up to

More information

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide

Introduction the Serial Communications Huang Sections 9.2, 10.2 SCI Block User Guide SPI Block User Guide Introduction the Serial Communications Huang Sections 9.2,.2 SCI Block User Guide SPI Block User Guide Parallel Data Transfer Suppose you need to transfer data from one HCS2 to another. How can you do

More information

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4

IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4 IV B.Tech. I Sem (R13) ECE : Embedded Systems : UNIT -4 1 UNIT 4 4.1. Serial data communication basics ----------- 1 4.2. UART ------------------------------------------------ 4 4.3. Serial Peripheral

More information

Introduction to the MC9S12 Hardware Subsystems

Introduction to the MC9S12 Hardware Subsystems Setting and clearing bits in C Using pointers in C o Program to count the number of negative numbers in an area of memory Introduction to the MC9S12 Hardware Subsystems o The MC9S12 timer subsystem Operators

More information

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085. (1) Draw and explain the internal architecture of 8085. The architecture of 8085 Microprocessor is shown in figure given below. The internal architecture of 8085 includes following section ALU-Arithmetic

More information

Asynchronous & Synchronous Serial Communications Interface. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name

Asynchronous & Synchronous Serial Communications Interface. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name MPSD Serial Communication Lab Exercise Asynchronous & Synchronous Serial Communications Interface Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name Notes: You must work

More information

C8051F700 Serial Peripheral Interface (SPI) Overview

C8051F700 Serial Peripheral Interface (SPI) Overview C8051F700 Serial Peripheral Interface (SPI) Overview Agenda C8051F700 block diagram C8051F700 device features SPI operation overview SPI module overview Where to learn more 2 Introducing The C8051F700

More information

Input and Output Ports. How do you get data into a computer from the outside?

Input and Output Ports. How do you get data into a computer from the outside? Input and Output Ports How do you get data into a computer from the outside? SIMPLIFIED INPUT PORT D 7 Any read from address $0000 gets signals from outside H C 2 D a t a D D D4 D3 S i g n a l s F r o

More information

Amarjeet Singh. January 30, 2012

Amarjeet Singh. January 30, 2012 Amarjeet Singh January 30, 2012 Website updated - https://sites.google.com/a/iiitd.ac.in/emsys2012/ Lecture slides, audio from last class Assignment-2 How many of you have already finished it? Final deadline

More information

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1 M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The

More information

Universität Dortmund. IO and Peripheral Interfaces

Universität Dortmund. IO and Peripheral Interfaces IO and Peripheral Interfaces Microcontroller System Architecture Each MCU (micro-controller unit) is characterized by: Microprocessor 8,16,32 bit architecture Usually simple in-order microarchitecture,

More information

Lecture 13 Serial Interfaces

Lecture 13 Serial Interfaces CPE 390: Microprocessor Systems Spring 2018 Lecture 13 Serial Interfaces Bryan Ackland Department of Electrical and Computer Engineering Stevens Institute of Technology Hoboken, NJ 07030 Adapted from HCS12/9S12

More information

DataFlash. Application Note. Using Atmel s DataFlash. Introduction (AN-4)

DataFlash. Application Note. Using Atmel s DataFlash. Introduction (AN-4) Using Atmel s DataFlash Introduction In the past, engineers have struggled to use Flash memory for data storage applications. The traditional Flash memory devices, with their large page sizes of 4K to

More information

DS75 Digital Thermometer and Thermostat

DS75 Digital Thermometer and Thermostat www.maxim-ic.com FEATURES Temperature Measurements Require No External Components Measures Temperatures from -55 C to +125 C (-67 F to +257 F) 2 C Accuracy Over a -25 C to +100 C Range Thermometer Resolution

More information

Part 1 Using Serial EEPROMs

Part 1 Using Serial EEPROMs Part 1 Using Serial EEPROMs copyright 1997, 1999 by Jan Axelson If you have a project that needs a modest amount of nonvolatile, read/write memory, serial EEPROM may be the answer. These tiny and inexpensive

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (Sept. 30, 2013) 1/15 538 Lecture Notes Week 5 Answers to last week's questions 1. With the diagram shown for a port (single bit), what happens if the Direction Register is read?

More information

538 Lecture Notes Week 5

538 Lecture Notes Week 5 538 Lecture Notes Week 5 (October 4, 2017) 1/18 538 Lecture Notes Week 5 Announements Midterm: Tuesday, October 25 Answers to last week's questions 1. With the diagram shown for a port (single bit), what

More information

Section 5 SERCOM. Tasks SPI. In this section you will learn:

Section 5 SERCOM. Tasks SPI. In this section you will learn: Section 5 SERCOM SPI Tasks In this section you will learn: SPI protocol SERCOM Engine on SAMD20 How to use SERRCOM in SPI mode Implementation of SPI communication 04/12/2013 Table of Contents 1. The SPI

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Serial Perpherial Interface (SPI) Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 9, 2018 Aly El-Osery

More information

ECE 471 Embedded Systems Lecture 20

ECE 471 Embedded Systems Lecture 20 ECE 471 Embedded Systems Lecture 20 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 20 October 2017 Announcements Project coming Only one person was in class Wednesday due to Career

More information

Raspberry Pi - I/O Interfaces

Raspberry Pi - I/O Interfaces ECE 1160/2160 Embedded Systems Design Raspberry Pi - I/O Interfaces Wei Gao ECE 1160/2160 Embedded Systems Design 1 I/O Interfaces Parallel I/O and Serial I/O Parallel I/O: multiple input/output simultaneously

More information

PARALLEL COMMUNICATIONS

PARALLEL COMMUNICATIONS Parallel Data Transfer Suppose you need to transfer data from one HCS12 to another. How can you do this? You could connect PORTA of the sending computer (set up as an output port) to PORTA of the receiving

More information

Product Family Specification

Product Family Specification Doc.Nr. 8260800.06 Product Family Specification Absolute pressure sensor SCP1000-D01 SCP1000-D11 Note: Reader is advised to notice that this Product Family Specification applies to SCP1000 version which

More information

Serial Peripheral Interface Bus SPI

Serial Peripheral Interface Bus SPI Serial Peripheral Interface Bus SPI SPI Bus Developed by Motorola in the mid 1980 s Full-duplex, master-slave serial bus suited to data streaming applications for embedded systems Existing peripheral busses

More information

Growing Together Globally Serial Communication Design In Embedded System

Growing Together Globally Serial Communication Design In Embedded System Growing Together Globally Serial Communication Design In Embedded System Contents Serial communication introduction......... 01 The advantages of serial design......... 02 RS232 interface......... 04 RS422

More information

DS1305 Serial Alarm Real Time Clock (RTC)

DS1305 Serial Alarm Real Time Clock (RTC) Serial Alarm Real Time Clock (RTC) www.dalsemi.com FEATURES Real time clock counts seconds, minutes, hours, date of the month, month, day of the week, and year with leap year compensation valid up to 2100

More information

EE 308 Spring A software delay

EE 308 Spring A software delay A software delay To enter a software delay, put in a nested loop, just like in assembly. Write a function delay(num) which will delay for num milliseconds void delay(unsigned int num) volatile unsigned

More information

LAB4. Program the on chip SPI module

LAB4. Program the on chip SPI module LAB4 Program the on chip SPI module Outline Learn to utilize the on-chip SPI module Implement it in C Translate it to ARM Assembly Test and verify the result using oscilloscope and shift register. Serial

More information

Real Time Embedded Systems. Lecture 1 January 17, 2012

Real Time Embedded Systems.  Lecture 1 January 17, 2012 SPI 4-Wire 3-Wire Real Time Embedded Systems www.atomicrhubarb.com/embedded Lecture 1 January 17, 2012 Topic Section Topic Where in the books Catsoulis chapter/page Simon chapter/page Zilog UM197 (ZNEO

More information

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses

Serial Peripheral Interface. What is it? Basic SPI. Capabilities. Protocol. Pros and Cons. Uses Serial Peripheral Interface What is it? Basic SPI Capabilities Protocol Serial Peripheral Interface http://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/ SPI_single_slave.svg/350px-SPI_single_slave.svg.png

More information

ECE Microcontrollers. Serial Peripheral Interface (SPI) & NRF24 Radio

ECE Microcontrollers. Serial Peripheral Interface (SPI) & NRF24 Radio ECE 381 - Microcontrollers Serial Peripheral Interface (SPI) & NRF24 Radio Lab 9 Summary We will develop a wireless temperature sensor Once a second, sample LM34CZ voltage Convert to floating point with

More information

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud.

Chapter 1. Microprocessor architecture ECE Dr. Mohamed Mahmoud. Chapter 1 Microprocessor architecture ECE 3130 Dr. Mohamed Mahmoud The slides are copyright protected. It is not permissible to use them without a permission from Dr Mahmoud http://www.cae.tntech.edu/~mmahmoud/

More information

Discontinued IP. Slices. LUTs. FFs. Block RAMs. Instantiation

Discontinued IP. Slices. LUTs. FFs. Block RAMs. Instantiation 0 OPB Serial Peripheral Interface (SPI) (v1.00e) DS464 July 21, 2006 0 0 Introduction The Xilinx OPB Serial Peripheral Interface (SPI) connects to the OPB and provides the controller interface to any SPI

More information

DS Wire Digital Thermometer and Thermostat

DS Wire Digital Thermometer and Thermostat www.maxim-ic.com FEATURES Temperature measurements require no external components with ±1 C accuracy Measures temperatures from -55 C to +125 C; Fahrenheit equivalent is -67 F to +257 F Temperature resolution

More information

FPGA Implementation Of SPI To I2C Bridge

FPGA Implementation Of SPI To I2C Bridge FPGA Implementation Of SPI To I2C Bridge Abhilash S.Warrier Akshay S.Belvadi Dhiraj R.Gawhane Babu Ravi Teja K Abstract Today s electronic system is not a standalone unit instead working in a group, where

More information

Serial Peripheral Interface (SPI)

Serial Peripheral Interface (SPI) SPI and I 2 C 1 Serial Peripheral Interface (SPI) SPI allow half/full duplex, synchronous, serial communication with external devices The interface can be configured as master for MCU board Communication

More information

SPI Protocol of the TLE941xy family

SPI Protocol of the TLE941xy family Protocol of the TLE941xy family Application Note Rev 1.0, 2016-04-25 Automotive Power Table of Contents 1 Abstract........................................................................ 3 2 Introduction.....................................................................

More information

Pmod modules are powered by the host via the interface s power and ground pins.

Pmod modules are powered by the host via the interface s power and ground pins. 1300 Henley Court Pullman, WA 99163 509.334.6306 www.store. digilent.com Digilent Pmod Interface Specification 1.2.0 Revised October 5, 2017 1 Introduction The Digilent Pmod interface is used to connect

More information

EE345L Spring 2004 Final Version 3 Page 1 of 8

EE345L Spring 2004 Final Version 3 Page 1 of 8 EE345L Spring 2004 Final Version 3 Page 1 of 8 Jonathan W. Valvano May 12, 2004, 9am-12noon This is a closed book exam. You must put your answers in the boxes on the answer pages. You have 3 hours, so

More information