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是兼容的.读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现 ...
随机推荐
- BUAA_OO_博客作业一
BUAA_OO_博客作业一 (一)程序结构分析 1.代码统计 第一次作业 第二次作业 第三次作业 代码复杂度展示第三次作业的 method ev(G) iv(G) v(G) Constant.Cons ...
- BZOJ 4278 [ONTAK2015]Tasowanie (后缀数组)
题目链接: https://www.lydsy.com/JudgeOnline/problem.php?id=4278 题解: 居然把后缀数组写成n^2的..我真厉害.. 想了无数种方法,最后发现就是 ...
- 洛谷——P2722 总分 Score Inflation
https://www.luogu.org/problem/show?pid=2722 题目背景 学生在我们USACO的竞赛中的得分越多我们越高兴. 我们试着设计我们的竞赛以便人们能尽可能的多得分,这 ...
- Maven 的dependency 的 classifier的作用
直接看一个例子,maven中要引入json包,于是使用了 <dependency> <groupId>net.sf.json-lib</groupId> <a ...
- Android使用GestureDetector实现手势滑动效果
直接看实例: package com.example.gesturedetector; import android.os.Bundle; import android.app.Activity; i ...
- Vim技巧之四大模式_普通模式
Vim技巧之四大模式_普通模式 一见不钟情的普通模式 普通模式以下的强悍操作 什么是操作符 什么是动作命令 误操作怎么办 那种操作更划算 普通模式下的神奇大招 Vim技巧之四大模式_普通模式 众所周知 ...
- ip地址转换成16进制long
<span style="font-size:18px;">public class IpUtil { /** * ip地址转换成16进制long * @param i ...
- C++中的inline的用法
C++中的inline的用法 参考:http://www.cnblogs.com/fnlingnzb-learner/p/6423917.html 1. 引入inline关键字的原因 在c/c++中 ...
- AAC头部格式,RTP打包格式
一共有2种AAC头格式,一种是StreamMuxConfig,另一种是AudioSpecificConfig 1.AudioSpecificConfig 读写header的代码参考 ffmpeg ...
- insufficient space