-
FreeRTOS+FreeModbus+STM32F107VC
/*
* FreeModbus Libary: BARE Port
* Copyright (C) 2006 Christian Walter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* File: $Id: porttimer.c,v 1.1 2006/08/22 21:35:13 wolti Exp $
*/
/* ----------------------- Platform includes --------------------------------*/
#include
#include "port.h"
/* ----------------------- Modbus includes ----------------------------------*/
#include "mb.h"
#include "mbport.h"
/* ----------------------- static functions ---------------------------------*/
static void prvvTIMERExpiredISR( void );
/* ----------------------- Start implementation -----------------------------*/
BOOL
xMBPortTimersInit( USHORT usTim1Timerout50us )
{
NVIC_InitTypeDef NVIC_InitStructure;
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
USHORT PrescalerValue = 0;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Enable the TIM5 gloabal Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = TIM5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* TIM5 clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE);
PrescalerValue = (USHORT) (SystemCoreClock / 20000) - 1;
TIM_TimeBaseStructure.TIM_Period = usTim1Timerout50us;
TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
TIM_TimeBaseStructure.TIM_ClockDivision = 0;
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInit(TIM5, &TIM_TimeBaseStructure);
TIM_ClearITPendingBit(TIM5, TIM_IT_Update);
//TIM_ITConfig(TIM5, TIM_IT_Update, DISABLE);
//TIM_Cmd(TIM5, ENABLE);
return TRUE;
}
void vMBPortTimersEnable( void )
{
/* Enable the timer with the timeout passed to xMBPortTimersInit( ) */
ENTER_CRITICAL_SECTION();
TIM_ClearITPendingBit(TIM5, TIM_IT_Update);
TIM_ITConfig(TIM5, TIM_IT_Update, ENABLE);
TIM_SetCounter(TIM5, 0x0000);
TIM_Cmd(TIM5, ENABLE);
EXIT_CRITICAL_SECTION();
}
void vMBPortTimersDisable( void )
{
/* Disable any pending timers. */
ENTER_CRITICAL_SECTION();
TIM_ClearITPendingBit(TIM5, TIM_IT_Update);
TIM_ITConfig(TIM5, TIM_IT_Update, DISABLE);
TIM_SetCounter(TIM5, 0x0000);
TIM_Cmd(TIM5, DISABLE);
EXIT_CRITICAL_SECTION();
}
/* Create an ISR which is called whenever the timer has expired. This function
* must then call pxMBPortCBTimerExpired( ) to notify the protocol stack that
* the timer has expired.
*/
static void prvvTIMERExpiredISR( void )
{
( void )pxMBPortCBTimerExpired( );
}
void TIM5_IRQHandler(void)
{
if (TIM_GetITStatus(TIM5, TIM_IT_Update) == SET) {
TIM_ClearITPendingBit(TIM5, TIM_IT_Update);
prvvTIMERExpiredISR();
}
}
- 2021-08-22 00:30:59下载
- 积分:1
-
bombsetting
VC++编写的完整布雷程序,已经过测试,性能稳定,包含源文件和可执行文件.(VC++ written a complete mining process ,which has been tested, It s a stable performance, including the source files and executable file.)
- 2010-07-04 20:50:39下载
- 积分:1
-
c++
对于c++的课程设计,自己做的,希望对大家有所帮助(For c++ Of curriculum design, own, and I hope all of you to help)
- 2008-01-19 22:57:30下载
- 积分:1
-
5
说明: 本书作者根据自己学习C++的亲身体会及多年教学经验,用简单的例子和简练的叙述讲解C++编程,别具特色。
全书共分十八章(此为第10到12章),内容涉及对象的演化、数据抽象、隐藏实现、初始化与清除、函数重载与缺省参数、输入输出流介绍、常量、内联函数、命名控制、引用和拷贝构造函数、运算符重载、动态对象创建、继承和组合、多态和虚函数、模板和包容器类、多重继承、异常处理和运行时类型识别。
本书作为正式教材和自学用书均非常优秀,作为程序设计者的参考用书亦极为合适。
(Of this book to learn C++ based on their personal experience and years of teaching experience, using simple examples and concise narrative explaining C++ programming, unique.
The book is divided into eighteen chapters, covering the evolution of objects, data abstraction, hiding implementation, initialization and removal, function overloading and default parameters, input and output streams introduced constants, inline functions, named control, reference and copy constructors, operator overloading, dynamic object creation, inheritance and composition, polymorphism and virtual functions, templates, and the container classes, multiple inheritance, exception handling and runtime type identification.
Book as an official textbook, and a self-learning books are very good, as the programmer s reference book is also very appropriate.)
- 2010-12-14 19:20:09下载
- 积分:1
-
MexFunction
这个程序使用vc++实现的一个工程,这个工程的作用就是完整实现了MATLAB和vc++混合编程的关键函数的功能-mexfunction。有其详细的开源代码!(This program uses the vc++ implementation of a project, the role of this project is to complete implementation of the MATLAB and vc++ mixed programming function of the key functions-mexfunction. Has its open source code in detail!)
- 2010-12-28 11:02:57下载
- 积分:1
-
c51
单片机时钟编程,包括秒表,时钟以及闹钟,亲测可用,包括DSN文件(Microcontroller clock programming, including a stopwatch, clock, and alarm clock, pro-test are available, including DSN file)
- 2013-07-24 11:39:55下载
- 积分:1
-
Software-Testing
随着计算机技术的迅速发展和越来越广泛深入地应用于国民经济和社会生活的各个方面,随着 软件系统的规模和复杂性与日俱增,软件的生产成本和软件中存在的缺陷和故障造成的各类损失也 大大增加,甚至会带来灾难性的后果。软件质量问题已成为所有使用软件和开发软件的人关注的焦 点。由于软件是人脑的高度智力化的体现和产品这一特殊性,不同于其他科技和生产领域,因此软件与生俱来就有可能存在着缺陷。(With the rapid development of computer technology and the more extensively used in the national economy and social life in all its aspects, with the growing size and complexity of software systems, software production costs and software defects and faults caused various types of losses also increased significantly, even catastrophic consequences. Software quality has become the focus of all those who use the software and software development concern. Because the software is highly intellectual expression and product of the special nature of the human brain, unlike other areas of technology and production, so the software may be born with a defect exists.)
- 2013-12-04 22:25:34下载
- 积分:1
-
24C08
24c08程序,模拟I2C总线,进行读取和写入操作(24c08 program to simulate I2C bus, read and write operations)
- 2012-10-21 00:08:32下载
- 积分:1
-
WinEditor
最近做了一个类似Windows画图板的小程序,拿来和大家分享一下。功能和界面全部模仿于Windows自带的画图板,界面如截图。功能主要有: 手绘线、简单图形、文字输入、图块拖放、重复撤销、画面缩放、打开保存图片文件,另外为了直接从数据库或者XML中存取图片,另外还提供了从Base64编码存取图片的接口,其他还实现了和画图板同样效果的工具箱及颜料盒。(Recently to do a similar drawing board a small Windows program, use and share with you. Features and interfaces in Windows, bringing all to imitate the drawing board, such as interface screenshot. The main features include: hand-painted lines, simple graphics, text input, drag and drop block, duplicate revoked, screen zoom, open the Save picture files, the other in order to directly from the database or XML access picture also provides a survival from the Base64 encoding Photos from the interface, the other also drawing board and achieve the same effect toolbox and paint boxes.)
- 2009-03-17 11:51:59下载
- 积分:1
-
Expert.C.Programming
很好的C语言学习原文书籍,对于C的初学者有很好的引导作用(All C programs do the same thing: look at a character and do nothing with it.)
- 2018-01-12 14:36:32下载
- 积分:1