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是兼容的.读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现 ...
随机推荐
- 【codeforces 776E】The Holmes Children
[题目链接]:http://codeforces.com/contest/776/problem/E [题意] f(n)是小于n的不同整数对(x,y)这里x+y==n且gcd(x,y)==1的个数; ...
- Wizard's Tour
F. Wizard's Tour time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- sgu 176 有源汇有上下界的最小流模板题
/*参考博文:http://hi.baidu.com/dragon_eric123/item/82e259200ece744046996282 有上下界的有源最小流 */ #include<st ...
- 如何删除电脑中使用过的COM端口
打开注册表编辑器:开始--运行中输入regedit就可以了 打开注册表 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\COM Name Arb ...
- [bzoj1704][Usaco2007 Mar]Face The Right Way 自动转身机_贪心
Face The Right Way 自动转身机 bzoj-1704 Usaco-2007 Mar 题目大意:不想描述题意系列++... ...题目链接 注释:略. 想法:我们直接枚举k,然后从左往右 ...
- scp and tar
scp 命令随记 scp file username@remoteIp:directory 创建tar包 tar zcvf file.tar.gz directory tar zcvf hadoop. ...
- C语言指针实现字符串的反转
题目要求: 编敲代码:从键盘随意输入一个字符串,输出该字符串. 然后.将该字符串逆序存放后再输出,要求用字符指针完毕. 代码: //解法一 #include <stdio.h> #incl ...
- python 005 正则表达式
. 任意字符 ^ 匹配字符串开始 $ 匹配字符串结尾 * 匹配前面出现了零次或多次 + 匹配前面出现了一次或多次 ? 匹配前面出现零次或一次 {N} 匹配前面出现了N次 {M,N} 匹配重复出现M-N ...
- 为什么是kafka?
MQ在分布式场景下的应用已经非常广泛了.可是在全部的MQ使用场景中,大多都要求不能丢消息.意味着必须有持久化的能力,传统行业经常使用的activemq.rabbitmq尽管有持久化能力,无奈的是性能太 ...
- mongoDB学习笔记——安装及启动
WINDOWS环境下: 一.安装 步骤一: 下载MongoDB url下载地址: http://downloads.mongodb.org/win32/ 步骤二: 设置MongoDB程序存放目 ...