• 大小: 3.31MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-10
  • 语言: 其他
  • 标签: STM32  VGA  

资源简介

STM32模拟VGA显示的小程序,亲测能用,代码是从国外一个技术网站下载,根据自己的需要,移植并修改。

资源截图

代码片段和文件信息

#include “can.h“
#include “delay.h“


CanRxMsg RxMessageBuf;
u8 CAN_INT_Flag=0;
u16 Total_Voltage;
u16 Total_Current;
u8 BAT_SOC;
u8 BAT_GroupTemprature1;
u8 BAT_GroupTemprature2;
u16 BAT_Voltage[12];
u16 BAT_Current[12];
u8 BMS_Temprature1;
u8 BMS_Temprature2;
//u32 CAN_id;

u8 CAN_Mode_Init(u8 tsjwu8 tbs2u8 tbs1u16 brpu8 mode)
{
GPIO_InitTypeDef  GPIO_InitStructure; 
CAN_InitTypeDef         CAN_InitStructure;
CAN_FilterInitTypeDef   CAN_FilterInitStructure;
NVIC_InitTypeDef   NVIC_InitStructure;

RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_CAN1 ENABLE);

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //复用推挽
GPIO_Init(GPIOA &GPIO_InitStructure); //初始化IO

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //上拉输入
GPIO_Init(GPIOA &GPIO_InitStructure); //初始化IO

//CAN单元设置
CAN_InitStructure.CAN_TTCM=DISABLE; //非时间触发通信模式  
CAN_InitStructure.CAN_ABOM=DISABLE; //软件自动离线管理  
CAN_InitStructure.CAN_AWUM=DISABLE; //睡眠模式通过软件唤醒(清除CAN->MCR的SLEEP位)
CAN_InitStructure.CAN_NART=ENABLE; //禁止报文自动传送 
CAN_InitStructure.CAN_RFLM=DISABLE;   //报文不锁定新的覆盖旧的  
CAN_InitStructure.CAN_TXFP=DISABLE; //优先级由报文标识符决定 
CAN_InitStructure.CAN_Mode= mode;         //模式设置: mode:0普通模式;1回环模式; 
//设置波特率
CAN_InitStructure.CAN_SJW=tsjw; //重新同步跳跃宽度(Tsjw)为tsjw+1个时间单位  CAN_SJW_1tq  CAN_SJW_2tq CAN_SJW_3tq CAN_SJW_4tq
CAN_InitStructure.CAN_BS1=tbs1;  //Tbs1=tbs1+1个时间单位CAN_BS1_1tq ~CAN_BS1_16tq
CAN_InitStructure.CAN_BS2=tbs2; //Tbs2=tbs2+1个时间单位CAN_BS2_1tq ~ CAN_BS2_8tq
CAN_InitStructure.CAN_Prescaler=brp;        //分频系数(Fdiv)为brp+1
CAN_Init(CAN1 &CAN_InitStructure);         //初始化CAN1 

CAN_FilterInitStructure.CAN_FilterNumber=0; //过滤器0
CAN_FilterInitStructure.CAN_FilterMode=CAN_FilterMode_IdMask;  //屏蔽位模式
CAN_FilterInitStructure.CAN_FilterScale=CAN_FilterScale_32bit;  //32位宽 
CAN_FilterInitStructure.CAN_FilterIdHigh=0x0000; //32位ID
CAN_FilterInitStructure.CAN_FilterIdLow=0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh=0x0000;//32位MASK
CAN_FilterInitStructure.CAN_FilterMaskIdLow=0x0000;
CAN_FilterInitStructure.CAN_FilterFIFOAssignment=CAN_Filter_FIFO0;//过滤器0关联到FIFO0
CAN_FilterInitStructure.CAN_FilterActivation=ENABLE;//激活过滤器0

CAN_FilterInit(&CAN_FilterInitStructure); //滤波器初始化
CAN_ITConfig(CAN1CAN_IT_FMP0ENABLE); //FIFO0消息挂号中断允许.     

NVIC_InitStructure.NVIC_IRQChannel = USB_LP_CAN1_RX0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3;     // 主优先级为1
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;            // 次优先级为0
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);

return 0;
}

void USB_LP_CAN1_RX0_IRQHandler(void)
{
u32 CAN_id;
// CAN_ITConfig(CAN1CAN_IT_FMP0DISABLE);
if(CAN_GetITStatus(CAN1CAN_IT_FM

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5668  2018-05-07 16:02  F103REt_StdLib_VGA _Test20180507\Bsp\can.c

     文件        392  2018-05-07 15:26  F103REt_StdLib_VGA _Test20180507\Bsp\can.h

     文件       1634  2018-03-31 19:46  F103REt_StdLib_VGA _Test20180507\Bsp\delay.c

     文件        178  2018-03-31 19:21  F103REt_StdLib_VGA _Test20180507\Bsp\delay.h

     文件       7791  2018-05-07 19:11  F103REt_StdLib_VGA _Test20180507\Bsp\font5x7.c

     文件      13325  2018-05-02 22:28  F103REt_StdLib_VGA _Test20180507\Bsp\gdi.c

     文件       2873  2018-04-27 17:06  F103REt_StdLib_VGA _Test20180507\Bsp\gdi.h

     文件       1377  2012-12-16 22:24  F103REt_StdLib_VGA _Test20180507\Bsp\gdptypes.h

     文件       5248  2012-12-16 22:23  F103REt_StdLib_VGA _Test20180507\Bsp\mth.c

     文件       1212  2012-12-16 22:25  F103REt_StdLib_VGA _Test20180507\Bsp\mth.h

     文件       9577  2018-05-21 09:21  F103REt_StdLib_VGA _Test20180507\Bsp\video.c

     文件       1516  2018-05-04 11:14  F103REt_StdLib_VGA _Test20180507\Bsp\video.h

     文件      17273  2010-06-07 10:25  F103REt_StdLib_VGA _Test20180507\Core\core_cm3.c

     文件      85714  2011-02-09 14:59  F103REt_StdLib_VGA _Test20180507\Core\core_cm3.h

     文件      15503  2018-05-03 11:16  F103REt_StdLib_VGA _Test20180507\Core\startup_stm32f10x_hd.s

     文件      12765  2011-03-10 10:52  F103REt_StdLib_VGA _Test20180507\Core\startup_stm32f10x_md.s

     文件       8982  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\misc.h

     文件      21690  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_adc.h

     文件       7555  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_bkp.h

     文件      27559  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_can.h

     文件       6573  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_cec.h

     文件       2162  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_crc.h

     文件      15233  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_dac.h

     文件       3818  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_dbgmcu.h

     文件      20754  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_dma.h

     文件       6824  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_exti.h

     文件      25445  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_flash.h

     文件      27016  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_fsmc.h

     文件      20175  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_gpio.h

     文件      30029  2011-03-10 10:47  F103REt_StdLib_VGA _Test20180507\FWLib\inc\stm32f10x_i2c.h

............此处省略143个文件信息

评论

共有 条评论