openMSP430之io_test
openMSP430: IO functionality test with interupt
#include "omsp_system.h" volatile char shift = 0x01; // Global variable int main(void)
{ WDTCTL = WDTPW | WDTHOLD; // Disable watchdog timer P2DIR = 0xff; // Port 2.0-2.7 = output
P2OUT = shift; // Initialize Port 2 P1DIR = 0x00; // Port 1.0-1.7 = input
P1IE = 0x01; // Port 1.0 interrupt enabled
P1IES = 0x00; // Port 1.0 interrupt edge selection (0=pos 1=neg)
P1IFG = 0x00; // Clear all Port 1 interrupt flags (just in case) eint(); // Enable interrupts while ()
{
if (P2OUT == 0x00)
{
P2OUT = shift;
}
else if (shift == 0x01)
{
P2OUT = (P2OUT << );
}
else
{
P2OUT = (P2OUT >> );
}
}
} // Port1 Interrupt Service Routine
interrupt(PORT1_VECTOR) port1_isr(void)
{
if (P1IFG & 0x01)
{
shift ^= 0x81;
P1IFG &= ~0x01; // Clear Port 1.0 interrupt flag
}
}
openMSP430之io_test的更多相关文章
- openMSP430之openmsp430-loader
openmsp430-loader This simple program allows the user to load the openMSP430 program memory with an ...
- openMSP430之Custom linker script
The use of the -mmcu switch is of course NOT mandatory. It is simply a convenient way to use the pre ...
- Verilog之openMSP430(1)
openMSP430_IO interrupt Verilog file: omsp_gpio.v //================================================ ...
- bench.sh 跑分测速
#!/bin/bash #==============================================================# # Description: bench te ...
- [spoj Favorite Dice ][期望dp]
(1)https://vjudge.net/problem/SPOJ-FAVDICE 题意:有一个n面的骰子,每一面朝上的概率相同,求所有面都朝上过至少一次的总次数期望. 题解:令dp[i]表示 i ...
- [小明打联盟][斜率/单调队列 优化dp][背包]
链接:https://ac.nowcoder.com/acm/problem/14553来源:牛客网 题目描述 小明很喜欢打游戏,现在已知一个新英雄即将推出,他同样拥有四个技能,其中三个小技能的释放时 ...
- [cf1025D][区间dp]
http://codeforces.com/contest/1025/problem/D D. Recovering BST time limit per test 1 second memory l ...
- [cf1038E][欧拉路]
http://codeforces.com/contest/1038/problem/E E. Maximum Matching time limit per test 2 seconds memor ...
- 【Python】【IO】
# [[IO]] # [文件读写] '''读写文件是最常见的IO操作.Python内置了读写文件的函数,用法和C是兼容的.读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现 ...
随机推荐
- python--(十步代码学会线程)
python--(十步代码学会线程) 一.线程的创建 Thread实例对象的方法 # isAlive(): 返回线程是否活动的. # getname(): 返回线程名. # setName(): 设置 ...
- 第六节:pandas函数应用
1.pipe() :表格函数应用: 2.apply():表格行列函数应用: 3.applymap():表格元素应用.
- CODEVS 3500
题目描述 输入3个数a,b,c,求a^b mod c=?输入描述 三个数a,b,c输出描述 一个数,即a^b mod c 的答案.样例输入5 10 9样例输出 4 基 ...
- ThinkPHP5 自定义异常
1.配置config.php 自定义异常路径: // 默认AJAX 数据返回格式,可选json xml ...'default_ajax_return' => 'json', 'exceptio ...
- 【DEBUG】 Visual Studio 2005 DEBUG集
一. fatal error C1083: 无法打开包括文件:"stdint.h": No such file or directory stdint.h是c99标准的头文件,vc ...
- 激活Windows
额外的启动参数(键):/win=act – 在隐藏模式下运行程序,激活 Windows 并退出程序./ofs=act – 在隐藏模式下运行程序,激活 Office 并退出程序./wingvlk – 在 ...
- nyoj_212_K尾相等数_210402272239
K尾相等数 时间限制:3000 ms | 内存限制:65535 KB 难度:1 描述 输入一个自然数K(K>1),如果存在自然数M和N(M>N),使得K^M和K^N均大于等于100 ...
- mongodb之存储引擎
前言 存储引擎是Mongodb管理数据存储主要的组件,Mongodb支持多种存储引擎,每种存储引擎适合特定的场景 WiredTiger 特性 1. version >= 3.2版本默认存储引擎2 ...
- MapReduce编程实战之“高级特性”
本篇介绍MapReduce的一些高级特性,如计数器.数据集的排序和连接.计数器是一种收集作业统计信息的有效手段.排序是MapReduce的核心技术,MapReduce也可以运行大型数据集间的" ...
- cocos2d-html5开发之本地数据存储
做游戏时常常须要的一个功能呢就是数据的保存了,比方游戏最高分.得到的金币数.物品的数量等等.cocos2d-html5使用了html5.所以html5的数据保存方法是对引擎可用的: html5本地数据 ...