?? spi.lst
字號:
C51 COMPILER V8.08 SPI 07/26/2007 15:52:32 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE SPI
OBJECT MODULE PLACED IN .\obj\SPI.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SRC\SPI.C BROWSE DEBUG OBJECTEXTEND PRINT(.\lst\SPI.lst) OBJECT(.\obj\SPI.o
-bj)
line level source
1 #ifdef PH_932
#include <reg915.h>
#include "spi.h"
#include "message.h"
// flag to indicate if SPI is currently involved in a transfer or not
// stops a write to the SPI bus while a write is in progress
#define INFORMATION_CNT 4
#define DISC_TYPE_POSI 0
#define INPUT_MODE_POSI 1
#define SAMPLE_FREQ_POSI 2
#define WORD_LENGTH_POSI 3
static bit mspibusy;
bit spi_valid = 0;
char information[INFORMATION_CNT];
char spi_cnt = 0;
unsigned char spi_cmd = 0;
/***********************************************************************
DESC: SPI Interrupt Service Routine
Called when byte transmitted and/or byte received
or if mode changed to slave by Slave Select pin
RETURNS: Nothing
************************************************************************/
void spi_isr () interrupt 9 using 3
{
// clear SPIF bit by writing 1 to it
SPSTAT |= 0x80;
spi_cmd = SPDAT;
/* spi_valid = 1;*/
/*
while(RI == 1);
SBUF = SPDAT;
while(TI == 0);
TI = 0;
*/
// SPI not busy
mspibusy = 0;
} // spi_isr
/***********************************************************************
DESC: Initializes the SPI peripheral
SPI Clock frequency = 250 kHz
Set EA to 1 after calling
RETURNS: Nothing
************************************************************************/
void spi_init()
{
// set MOSI, MISO, /SS and SPICLK as quasi-bidirectional
P2M1 &= 0xC3;
P2M2 &= 0xC3;
C51 COMPILER V8.08 SPI 07/26/2007 15:52:32 PAGE 2
// configure SPI
SPCTL = 0x4C;
// SPI initially not busy
mspibusy = 0;
// set SPI interrupt priority to 0
IP1 &= ~0x08;
IP1H &= ~0x08;
// enable SPI interrupt
ESPI = 1;
} // spi_init
#endif
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = ---- ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = ---- ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -