mcp2510的can总线收发器程序

mcp2510的can总线收发器程序


2023年11月22日发(作者:1050ti和1650哪个好)

mcp2510can总线收发器程序

pcbomb 发表于 2008-6-30 14:47:00 阅读全文(769) | 回复(1) | 引用通告(0) | 编辑

i nclude

i nclude "mcp2510.h"

void mcp_reset(void)

{

SPI_init_hw(); //设置成SPI方式

init_can_io(); //

SPI_mcp_reset(); //

}

void mcp_read( unsigned char MCPaddr, unsigned char* readdata, unsigned char length )

{

unsigned char loopCnt;

SPI_mcp_select(); // Select the MCP device at the SPI bus

// Start reading and set first address

SPI_mcp_RD_address(MCPaddr);

for (loopCnt=0; loopCnt < length; loopCnt++)

{

// Get a byte and store at pointer

*readdata = SPI_putch(MCPaddr);

// Increment the pointers to next location

// Test++;

MCPaddr++;

SPI_mcp_unselect();

{

unsigned int canid;

unsigned char tbufdata[4];

canid = (unsigned int)(can_id & 0x0FFFF);

***********/

unsigned char mcp_transmit_busy(unsigned send_buf)

{

unsigned char temp;

switch(send_buf)

{

{

SPI_mcp_write_bits(mcp_addr, TXB_TXREQ_M, TXB_TXREQ_M);

{


发布者:admin,转转请注明出处:http://www.yc00.com/num/1700605794a1013321.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信