freemodbus程序解读之port.c

2020-02-22 12:53

/*

* FreeModbus Libary: LPC214X Port

* Copyright (C) 2007 Tiago Prado Lone *

* 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: port.c,v 1.1 2007/04/24 23:15:18 wolti Exp $ */

/* ----------------------- System includes --------------------------------*/ #include

/* ----------------------- Modbus includes ----------------------------------*/

/* ----------------------- Variables ----------------------------------------*/ int VIC_Temp;

/* ----------------------- Start implementation -----------------------------*/

//本文件共两个函数,EnterCriticalSection( )和 ExitCriticalSection( ), //使用的时候必定一起先后使用、

//当进入串口中断的时候,将 VICIntEnable写入VICIntEnClr,可以关闭所有中断位置, //从而避免其他中断将串口的现成挂起

//当函数执行完成时,将 VIC_Temp写入 VICIntEnable,恢复中断位置的状态 //注意,中断位置的清除并不是串口中断的清除,中断位置只是绑定了串口中断 void

EnterCriticalSection( ) {

VIC_Temp = VICIntEnable; /* Save VICIntEnable */ // VICIntEnable, 中断使能寄存器,保存目前的值 // 共16个中断位置,bit为1时候使能

VICIntEnClr = VIC_Temp; /* Disable Interruptions */ // VICIntEnClr,中断清除寄存器 //控制16个中断位置复位,bit写入1复位

//将本身的值写入清除寄存器,就将所有的中断位置清除 } void

ExitCriticalSection( ) {

VICIntEnable = VIC_Temp; /* Restore VICIntEnable */ }

//再次恢复15个中断位置的配置

//当函数执行完成时,将 VIC_Temp写入VICIntEnable, //恢复中断位置的状态


freemodbus程序解读之port.c.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2013-2014年小学二年级数学下册期末试卷2

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: