当前位置: 首页 > wzjs >正文

西安学校网站建设费用沈阳网站关键词排名

西安学校网站建设费用,沈阳网站关键词排名,网站服务类型,做视频网站可行吗前言 CYT4BB7芯片,在开发过程中,通过Eclipse IDE for ModusToolbox™ 3.4的开发环境可以配置很多功能,其中就包括串口。配置起来很省事,配置完成后保存代码自动生成,在main方法中给串口初始化一下就可以实现发送的功能…

前言

CYT4BB7芯片,在开发过程中,通过Eclipse IDE for ModusToolbox™ 3.4的开发环境可以配置很多功能,其中就包括串口。配置起来很省事,配置完成后保存代码自动生成,在main方法中给串口初始化一下就可以实现发送的功能了。以下就是配置串口的前置条件和方法。

1.准备环境

安装Eclipse IDE for ModusToolbox™ 3.4开发环境,以及gcc编译相关软件。具体参考英飞凌官方文档。

2.创建Application

2.1 在quick panel中点击New Application按钮

2.2 Create from MPN

2.3 选择对应芯片型号

2.4 点击Close

 2.5 Next

2.6 Create

 3. 创建Application后首次编译

3.1 注掉报错代码

打开main.c文件,并注释掉#include "mtb_hal.h",否则编译会报错

3.2 首次编译

点击Quick Panel中的Build Project 

 4. 配置串口

 4.1 打开配置工具

 4.2 选择配置串口

 4.3 串口配置

 此时还没有配置后,如果按CTRL+S后会报错,因为时钟和引脚都还没配置。

4.4 时钟配置

4.4.1 System配置

在配置时钟之前,需要先配置System,以便时钟可以正确选择。

UART打算采用Periheral group1组的时钟,因此需要使能CLK_HF2,通路选择CLK_PATH3

Periheral group1组的时钟频率为100MHz。

4.4.2 时钟设置和关联

4.4.3 再次配置串口

OverSample需要设置成12后,实际波特率才能接近115200,但是会存在一些误差。

引脚选择15.0是接收,15.1是发送。

4.5 保存并生成代码

5. 编码实现串口发送 

5.1 配置后生成的代码

5.2 时钟等的初始化

main函数中的cybsp_init方法,会调用cycfg_config_init()方法。这个初始化方法已经把系统、时钟、引脚等都初始化好了。

void cycfg_config_init(void)
{init_cycfg_system();init_cycfg_clocks();init_cycfg_routing();init_cycfg_peripherals();init_cycfg_pins();
}

5.3 串口初始化

参考网页中的初始化方法(网页是在配置中点击打开网页的)

 给出main.c的代码示例

/*******************************************************************************
* File Name:   main.c
*
* Description: This is the source code for the Empty Application Example
*              for ModusToolbox.
*
* Related Document: See README.md
*
*******************************************************************************
* Copyright 2024, Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation.  All rights reserved.
*
* This software, including source code, documentation and related
* materials ("Software") is owned by Cypress Semiconductor Corporation
* or one of its affiliates ("Cypress") and is protected by and subject to
* worldwide patent protection (United States and foreign),
* United States copyright laws and international treaty provisions.
* Therefore, you may use this Software only as provided in the license
* agreement accompanying the software package from which you
* obtained this Software ("EULA").
* If no EULA applies, Cypress hereby grants you a personal, non-exclusive,
* non-transferable license to copy, modify, and compile the Software
* source code solely for use in connection with Cypress's
* integrated circuit products.  Any reproduction, modification, translation,
* compilation, or representation of this Software except as specified
* above is prohibited without the express written permission of Cypress.
*
* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
* reserves the right to make changes to the Software without notice. Cypress
* does not assume any liability arising out of the application or use of the
* Software or any product or circuit described in the Software. Cypress does
* not authorize its products for use in any products where a malfunction or
* failure of the Cypress product may reasonably be expected to result in
* significant property damage, injury or death ("High Risk Product"). By
* including Cypress's product in a High Risk Product, the manufacturer
* of such system or application assumes all risk of such use and in doing
* so agrees to indemnify Cypress against all liability.
*******************************************************************************//*******************************************************************************
* Header Files
*******************************************************************************/
//#include "mtb_hal.h"
#include "cybsp.h"/*******************************************************************************
* Macros
*******************************************************************************//*******************************************************************************
* Global Variables
*******************************************************************************//*******************************************************************************
* Function Prototypes
*******************************************************************************//*******************************************************************************
* Function Definitions
*******************************************************************************//*******************************************************************************
* Function Name: main
********************************************************************************
* Summary:
* This is the main function for CPU. It...
*    1.
*    2.
*
* Parameters:
*  void
*
* Return:
*  int
*
*******************************************************************************/
uint8_t txBuffer[1024] =  "Hello World!\r\n";
cy_stc_scb_uart_context_t uartContext;void uart_send_datas(uint8_t *buf, uint32_t len)
{Cy_SCB_UART_PutArrayBlocking(SCB9, buf, len);/* Blocking wait for transfer completion */while (!Cy_SCB_UART_IsTxComplete(SCB9)){}
}void delay_ms(uint32_t ms)
{uint32_t tmp = 0, outj = 0;for(outj = 0; outj < ms; outj++){for(tmp = 0; tmp < 3200; tmp++){__ASM ("NOP");}}
}int main(void)
{cy_rslt_t result;/* Initialize the device and board peripherals */result = cybsp_init();/* Board init failed. Stop program execution */if (result != CY_RSLT_SUCCESS){CY_ASSERT(0);}Cy_SCB_UART_Init(SCB9, &scb_9_config, &uartContext);Cy_SCB_UART_Enable(SCB9);/* Enable global interrupts */__enable_irq();for (;;){uart_send_datas(txBuffer, 14);delay_ms(1000);}
}/* [] END OF FILE */

6. 编译烧录

编译完成后,烧录固件。

7. 测试结果

http://www.dtcms.com/wzjs/525858.html

相关文章:

  • 小型公司网站建设论文太原网络营销公司
  • 制作网页的视频教程seo常用工具包括
  • 互联网网站建设哪家好线上营销推广
  • 创建公司网站免费网络营销知识
  • 做推文封面的网站谷歌浏览器下载手机版app
  • 平面设计招聘唐山家庭优化大师下载
  • 高质量网站内容建设标准发布广告的平台免费
  • 吉林省建设工程监理检测网站国外搜索网站排名
  • 郑州网站建设丶汉狮网络武汉网络推广平台
  • 如何制作外贸网站百度在线咨询
  • 网站建设公司盈利搜索引擎地址
  • css做的简单网站如何注册域名及网站
  • 软件技术论文题目百度关键词优化专家
  • 宣传文案模板杭州seo排名优化
  • 沧州最火网站seo研究中心教程
  • 南阳高质量建设大城市网站网站搜索优化技巧
  • 怎么用花生壳做网站seo基础理论
  • wordpress4.6教程seo线上培训多少钱
  • 常州网站建设设计百度seo关键词优化公司
  • 禹城网站建设费用新航道培训机构怎么样
  • 一级做爰片a视频网站试看中国新闻网最新消息
  • 辽宁建设厅网站监管处今日广州新闻最新消息
  • 电子购物网站建设外贸建站公司
  • javaweb网站开发方法网络营销外包
  • 温岭网站建设厦门谷歌seo公司
  • 广东高端网站建设报价电商网站分析
  • 国际新闻最新消息今天200字关键词优化排名第一
  • 南京网站建设公司哪家好香飘飘奶茶软文
  • 中国建设银行甘肃省分行官网站企业网站优化关键词
  • 网站建设 注意事项seo营销优化软件