📄 spi1.c
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : SPI1.C
** Project : touchpanal
** Processor : MC9S08QG8CDT
** Beantype : Init_SPI
** Version : Bean 01.073, Driver 01.10, CPU db: 2.87.115
** Compiler : CodeWarrior HCS08 C Compiler
** Date/Time : 2007-10-10, 10:01
** Abstract :
** This file implements the SPI (SPI) module initialization
** according to the Peripheral Initialization Bean settings, and defines
** interrupt service routines prototypes.
** The SPI module is the serial peripheral interface module,which allows
** full-duplex, synchronous, serial communications with peripheral devices.
** Settings :
** Bean name : SPI1
** Device : SPI
** Settings
** Clock settings
** Value of Preselection : 8
** Value of Selection : 8
** Frequency : 65.4 kHz
** Mode Select : Master
** Clock Polarity : active-high
** Clock Phase : First edge
** Data shift order : MSB first
** Bidirectional mode : Disabled
** Output enable in Bidirect. : no
** Stop in Wait Mode : Disabled
** Pins
** SCK pin : PTB2_KBIP6_SPSCK_ADP6
** SCK pin signal :
** MISO pin allocation : Enabled
** MISO pin : PTB4_MISO
** MISO pin signal :
** MOSI pin allocation : Enabled
** MOSI pin : PTB3_KBIP7_MOSI_ADP7
** MOSI pin signal :
** SS pin allocation : Enabled
** SS pin mode : General Purpose I/O
** SS pin : PTB5_TPMCH1_SS
** SS pin signal :
** Interrupts
** Interrupt : Vspi
** Receive and fault interrupt : Disabled
** Transmit Interrupt : Enabled
** ISR name : SPITransmitISR
** Initialization
** Call Init in CPU init. code : yes
** Enable SPI system : yes
** Contents :
** Init - void SPI1_Init(void);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2006
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/*
** ###################################################################
**
** The interrupt service routine(s) must be implemented
** by user in one of the following user modules.
**
** If the "Generate ISR" option is enabled, Processor Expert generates
** ISR templates in the CPU event module.
**
** User modules:
** touchpanal.c
** Events.c
**
** ###################################################################
ISR( SPITransmitISR)
{
// NOTE: The routine should include the following actions to obtain
// correct functionality of the hardware.
//
// Receive interrupt flag is cleared by reading the SPI status register
// followed by reading the SPI data register.
// Transmit interrupt flag is cleared by reading the SPI status register
// followed by write the SPI data register.
// Mode Fault interrupt flag is cleared by reading the SPI status register
// followed by write to the SPI control register.
// Example: Status = SPIS;
// DataIn = SPID;
// SPID = DataOut;
}
*/
/* MODULE SPI1. */
#include "SPI1.h"
/*
** ===================================================================
** Method : SPI1_Init (bean Init_SPI)
**
** Description :
** This method initializes registers of the SPI module
** according to this Peripheral Initialization Bean settings.
** Call this method in user code to initialize the module.
** By default, the method is called by PE automatically; see
** "Call Init method" property of the bean for more details.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
void SPI1_Init(void)
{
/* SPIC1: SPIE=0,SPE=0,SPTIE=0,MSTR=0,CPOL=0,CPHA=0,SSOE=0,LSBFE=0 */
setReg8(SPIC1, 0x00); /* Disable the SPI module clearing the SPRF flag */
/* SPIC2: ??=0,??=0,??=0,MODFEN=0,BIDIROE=0,??=0,SPISWAI=0,SPC0=0 */
setReg8(SPIC2, 0x00);
/* SPIBR: ??=0,SPPR2=1,SPPR1=1,SPPR0=1,??=0,SPR2=0,SPR1=1,SPR0=0 */
setReg8(SPIBR, 0x72);
(void)getReg8(SPIS); /* Dummy read of the SPIS registr to clear the MODF flag */
/* SPIC1: SPIE=0,SPE=1,SPTIE=1,MSTR=1,CPOL=0,CPHA=0,SSOE=0,LSBFE=0 */
setReg8(SPIC1, 0x70);
}
/* END SPI1. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 3.00 [03.89]
** for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -