- 博客(7)
- 收藏
- 关注
原创 收集的一些小玩意
#define setbit(x,y) x|=(1<<y) //指定的某一位数置1#define clrbit(x,y) x&=~(1<<y) //指定的某一位数置0#define reversebit(x,y) x^=(1<<y) //指定的某一位数取反#define ge...
2020-02-18 15:14:42
196
原创 将modbus协议加入程序
注:此为本人使用的ModBus协议,对其他使用者参考价值不大1.相关文件(如modbus_slave.h,modbus_slave.c等)移入文件夹(一般是user),加入路径2.轮询方式,将"MODS_Poll();"加入while(1)中,可能会因程序原因无法及时接收到数据,可隔几行加一个"MODS_Poll();"3.tim中断中写入代码段,定时器可以用任意,但建议用tim3,因...
2019-11-25 16:08:29
432
原创 手动修改hal程序,添加定时器中断
拿到一份hal库的程序,想在程序中添加定时器中断以作他用,又不想修改太多内容,故使用cubeMX生成一份配置,复制粘贴以减少工作量,但在配置过程中出现了一些问题,一一解决后记录在此。选择配置定时器2(TIM2)中断由cubeMX生成的代码,时钟频率48MHz,配置48000分频,重载数5000,更新中断/* TIM2 init function */static void MX_T...
2019-11-02 17:38:30
1061
原创 stm32管脚初始化时请给所有可操作状态赋值
单片机初始化时,需要注意将初始化中各项明确赋值,不能忽略,如以如下代码对gpio进行初始化,GPIO_InitTypeDef GPIO_InitStructure;RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;GPIO_InitStructur...
2019-09-28 11:23:58
1826
原创 杭电oj第1001题—— Sum Problem
题述如下Problem DescriptionIn this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n. InputThe input will consist of a series of integers n, one integer per line.OutputFor each cas...
2019-02-15 11:43:43
989
原创 杭电oj第1000题—— A + B Problem
题述如下:Problem DescriptionCalculate A + B.InputEach line will contain two integers A and B. Process to end of file.OutputFor each case, output A + B in one line. \\注意,此处强调一行一输出,即输出后跟“\n”S...
2019-02-15 11:23:16
1629
原创 Verilog编程中自己出过的错误
1.Error (10137): Verilog HDL Procedural Assignment error at freq_test.v(36): object "dataoutf" on left-hand side of assignment must have a variable data type 原因:数据类型定义错误 或者 赋值类型错误解决方法: 在always 过程块中被赋值...
2018-04-01 16:49:18
32695
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人