⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spi_mcp.h

📁 pic单片机工程
💻 H
字号:
/*
 *                         Copyright 1999 by KVASER AB            
 *                   P.O Box 4076 SE-51104 KINNAHULT, SWEDEN
 *             E-mail: staff@kvaser.se   WWW: http://www.kvaser.se
 *
 * This software is a part of the MCP2510 Evaluation Kit from Microchip, Inc.
 *
 * $Header: /Customers/MicroChip/Code/mcTest/inc/spi_mcp.h 1     99-06-29 15:26 Mats $
 * $Revision:: 1    $   $NoKeywords: $
 *
 * Description:
 *   Header file for spi_mcp.c (PIC) and spi_mcpx.c (PC).
 *   These routines are the basic SPI handling routines.
 *   qqq the comments are not good.
 */
#ifndef _SPI_MCP_H_
#define _SPI_MCP_H_

#include "..\inc\std.h"

// ***************** MCP Commands on SPI ****************
#define  RESET      0xc0        // Reset internal registers to default state, set conf mode
#define  RTS        0x80        // Trigg transmission
#define  RD_STAT    0xA0        // Start reading status
#define  BIT_MOD    0x05        // Bit modify command data == MASK, BITS
#define  READ       0x03        // Read data from memory
#define  WRITE      0x02        // Write data to memory

#define TX0RTS      0x01        // Bit flags in the RTS command
#define TX1RTS      0x02
#define TX2RTS      0x04

/*
* Select the MCP2510 by hardware signal CS
*/
void SPI_mcp_select (void);

/*
* Remove the CS from the MCP
*/
void SPI_mcp_unselect (void);

/*
* Reset the MCP2510
*/
void SPI_mcp_reset(void);

/*
* Start reading from device from selected address
next read from incremented address
*/
void SPI_mcp_RD_address(unsigned char output);

/*
* Start writting to device from selected address
* next write to incremented address
*/
void SPI_mcp_WR_address(unsigned char output);

/*
* Function to set the data bits in the register according to value in data for
* the bits set to 1 in the mask register.
*/
void SPI_mcp_write_bits( uchar MCPaddr, uchar data, uchar mask );


/*
* Read the memory status
* Note will return status but all other read will give status
* until CS is removed
*/
uchar SPI_mcp_RD_status ( void );

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -