MCP cover image
See in Github
2016-07-14

MCP25625的库单击板

5

Github Watches

15

Github Forks

8

Github Stars

MikroE

MCP25625 click


Product Page

Manual Page

Learn Page


General Description

The MCP25625 is a complete, cost-effective and small-footprint CAN solution that can be easily added to a microcontroller with an available SPI interface. The MCP25625 interfaces directly with microcontrollers operating at 2.7V to 5.5V, there are no external level shifters required. In addition, the MCP25625 connects directly to the physical CAN bus, supporting all requirements for CAN high-speed transceivers. The MCP25625 meets the automotive requirements for high-speed (up to 1 Mb/s), low quiescent current, electromagnetic compatibility (EMC) and electrostatic discharge (ESD).


Features

  • Vdd : 3.3 / 5.5V
  • Implements CAN 2.0B (ISO11898-1)
  • Three Transmit Buffers with Prioritization and Abort Feature
  • Two Receive Buffers
  • Six Filters and Two Masks, with Optional Filtering on the First Two Data Bytes
  • Supports SPI Modes 0,0 and 1,1
  • Specific SPI Commands to Reduce SPI Overhead
  • Buffer Full, and Request-to-Send Pins Configurable as General Purpose I/O
  • One Interrupt Output Pin

Example

Configuration

  • MCU: P18F87K22
  • Dev.Board: EasyPIC Pro v7
  • Oscillator: 16 Mhz
  • Ext. Modules: MCP25625 click
  • SW: MikroC PRO for PIC
#include "MCP25625.h"
#include "resources.h"

/*
 * TFT pins
 ******************************************************************************/
char TFT_DataPort at LATD;
sbit TFT_WR at LATB1_bit;
sbit TFT_RD at LATB0_bit;
sbit TFT_CS at LATB4_bit;
sbit TFT_RS at LATB2_bit;
sbit TFT_RST at LATB5_bit;
char TFT_DataPort_Direction at TRISD;
sbit TFT_WR_Direction at TRISB1_bit;
sbit TFT_RD_Direction at TRISB0_bit;
sbit TFT_CS_Direction at TRISB4_bit;
sbit TFT_RS_Direction at TRISB2_bit;
sbit TFT_RST_Direction at TRISB5_bit;

/*
 * MCP25625 pins
 ******************************************************************************/
sbit MCP25625_CS          at LATE0_bit;
sbit MCP25625_CS_DIR      at TRISE0_bit;
sbit MCP25625_RST         at LATC0_bit;
sbit MCP25625_RST_DIR     at TRISC0_bit;
sbit MCP25625_STB         at LATA0_bit;
sbit MCP25625_STB_DIR     at TRISA0_bit;
sbit MCP25625_TX0         at LATC7_bit;
sbit MCP25625_TX0_DIR     at TRISC7_bit;
sbit MCP25625_RX0         at LATC6_bit;
sbit MCP25625_RX0_DIR     at TRISC6_bit;
sbit MCP25625_TX1         at LATC3_bit;
sbit MCP25625_TX1_DIR     at TRISC3_bit;
sbit MCP25625_RX1         at LATC4_bit;
sbit MCP25625_RX1_DIR     at TRISC4_bit;

/*
 * Global vars
 ******************************************************************************/
uint32_t EID          = 0;
char EID_text[ 50 ]   = { 0 };
uint8_t tx_test[ 10 ] = { 'M', 'S', 'G', '\0' };

/*
 * Prototypes
 ******************************************************************************/
void system_init( void );
void display_init( void );

/*
 * Functions
 ******************************************************************************/
void system_init()
{
    TRISA            = 0xFF;
    TRISG            = 0xFF;
    MCP25625_CS_DIR  = 0;
    MCP25625_RST_DIR = 0;
    MCP25625_STB_DIR = 0;
    MCP25625_TX0_DIR = 0;
    MCP25625_RX0_DIR = 1;
    MCP25625_TX1_DIR = 0;
    MCP25625_RX1_DIR = 1;
    Delay_ms( 200 );
    
    SPI1_Init_Advanced( _SPI_MASTER_OSC_DIV16, _SPI_DATA_SAMPLE_MIDDLE,
                        _SPI_CLK_IDLE_HIGH, _SPI_LOW_2_HIGH );
    Delay_ms( 200 );
}

void display_init()
{
    TFT_Init_ILI9341_8bit( 320, 240 );
    TFT_Set_Pen( CL_WHITE, 1 );
    TFT_Set_Brush( 1, CL_WHITE, 0, 0, 0, 0 );
    TFT_Set_Font( TFT_defaultFont, CL_BLACK, FO_HORIZONTAL );
    TFT_Fill_Screen( CL_WHITE );
    TFT_Set_Pen( CL_BLACK, 1 );
    TFT_Line(  20,  46, 300,  46 );
    TFT_Line(  20,  70, 300,  70 );
    TFT_Line(  20, 220, 300, 220 );
    TFT_Line(  20, 145, 300, 145 );
    TFT_Set_Pen( CL_WHITE, 1 );
    TFT_Set_Font( &HandelGothic_BT21x22_Regular, CL_RED, FO_HORIZONTAL );
    TFT_Write_Text( "MCP25625", 110, 14 );
    TFT_Set_Font( &Tahoma15x16_Bold, CL_BLUE, FO_HORIZONTAL );
    TFT_Write_Text( "CAN Controller - TX node", 80, 50 );
    TFT_Set_Font( &Verdana12x13_Regular, CL_BLACK, FO_HORIZONTAL );
    TFT_Write_Text( "EasyPIC PRO v7", 19, 223 );
    TFT_Set_Font( &Verdana12x13_Regular, CL_RED, FO_HORIZONTAL );
    TFT_Write_Text( "www.mikroe.com", 200, 223 );
    TFT_Set_Font( &Tahoma15x16_Bold, CL_BLACK, FO_HORIZONTAL );
    TFT_Write_Text( "Message EID :", 40, 75 );
    Delay_ms( 200 );
}

void main() 
{
    system_init();
    display_init();
    mcp25625_init( OPMODE_NORMAL );
    
    LongIntToHex( EID, EID_text );
    Ltrim( EID_text );
    TFT_Set_Font( &Tahoma15x16_Bold, CL_RED, FO_HORIZONTAL );
    TFT_Write_Text( EID_text, 140, 75 );
    
    while( 1 )
    {
        if( Button( &PORTA, 4, 50, 1 ) )
        {
            EID++;
            LongIntToHex( EID, EID_text );
            Ltrim( EID_text );
            TFT_Set_Font( &Tahoma15x16_Bold, CL_RED, FO_HORIZONTAL );
            TFT_Rectangle( 138, 74, 338, 90 );
            TFT_Rectangle( 135, 110, 338, 135 );
            TFT_Write_Text( EID_text, 140, 75 );
        }

        if( Button( &PORTG, 0, 200, 1 ) )
        {
            if( !mcp25625_msg_load( TXB0, tx_test, 4, EID, true, false ) && \
                !mcp25625_msg_send( TXB0 ) )
            {
                TFT_Set_Font( &HandelGothic_BT21x22_Regular, CL_GREEN, FO_HORIZONTAL );
                TFT_Rectangle( 135, 110, 338, 135 );
                TFT_Write_Text( "SENT", 135, 110 );
            }
            else {
            
                TFT_Set_Font( &HandelGothic_BT21x22_Regular, CL_RED, FO_HORIZONTAL );
                TFT_Rectangle( 135, 110, 338, 135 );
                TFT_Write_Text( "ERROR", 135, 110 );
            }
        }
    }
}

相关推荐

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • n8n-io
  • 具有本机AI功能的公平代码工作流程自动化平台。将视觉构建与自定义代码,自宿主或云相结合,400+集成。

    Reviews

    1 (1)
    Avatar
    user_WoJUGLUq
    2025-04-17

    As a loyal user of MCP applications, I must say the Click_MCP25625 by MikroElektronika is an excellent choice for CAN bus communication. Its seamless integration and reliable performance make it a standout product. Highly recommended for anyone looking to enhance their projects with robust CAN capabilities. Check it out on GitHub!