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的更多相关文章

  1. openMSP430之openmsp430-loader

    openmsp430-loader This simple program allows the user to load the openMSP430 program memory with an ...

  2. 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 ...

  3. Verilog之openMSP430(1)

    openMSP430_IO interrupt Verilog file: omsp_gpio.v //================================================ ...

  4. bench.sh 跑分测速

    #!/bin/bash #==============================================================# # Description: bench te ...

  5. [spoj Favorite Dice ][期望dp]

    (1)https://vjudge.net/problem/SPOJ-FAVDICE 题意:有一个n面的骰子,每一面朝上的概率相同,求所有面都朝上过至少一次的总次数期望. 题解:令dp[i]表示 i ...

  6. [小明打联盟][斜率/单调队列 优化dp][背包]

    链接:https://ac.nowcoder.com/acm/problem/14553来源:牛客网 题目描述 小明很喜欢打游戏,现在已知一个新英雄即将推出,他同样拥有四个技能,其中三个小技能的释放时 ...

  7. [cf1025D][区间dp]

    http://codeforces.com/contest/1025/problem/D D. Recovering BST time limit per test 1 second memory l ...

  8. [cf1038E][欧拉路]

    http://codeforces.com/contest/1038/problem/E E. Maximum Matching time limit per test 2 seconds memor ...

  9. 【Python】【IO】

    # [[IO]] # [文件读写] '''读写文件是最常见的IO操作.Python内置了读写文件的函数,用法和C是兼容的.读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现 ...

随机推荐

  1. TOYS POJ 2318 计算几何 叉乘的应用

    Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 15060   Accepted: 7270 Description Calc ...

  2. js中call()和apply()的区别

    · 它们的共同之处: 都“可以用来代替另一个对象调用一个方法,将一个函数的对象上下文从初始的上下文改变为由 thisObj 指定的新对象.” · 它们的不同之处: apply: 最多只能有两个参数—— ...

  3. svn重新定位或checkout,提示输入用户名密码,输入后报错

    在MyEclipse中,source——>clean up.然后重新定位或checkout

  4. Android面试准备 第一天 第2-4例

    參考:http://blog.csdn.net/lmj623565791/article/details/24015867. .假设有个100M大的文件.须要上传至server中.而serverfor ...

  5. Struts2—Action

    二.命名空间namespace ·命名空间namespace须要放在相应的package下 ·Namespace必须以"/开头". ·Result的name是"succe ...

  6. Pig 在 shell script中被调用,批量载入处理文件

    首先,我想达到的目的是批量的处理一个目录下的的很多文档,这些文档保存了我要处理的数据,由于pig是初学..所以不知到该怎么批量的load,没有写过 自己的UDF,仅仅能一个一个文件的load,然后处理 ...

  7. iOS:在UITextField中加入图标

    //最左側加图片是下面代码 右側相似 UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&q ...

  8. EJB是什么鸟东西?

    到底EJB是什么 到底EJB是什么?被口口相传的神神秘秘的,百度一番,总觉得没有讲清楚的,仍觉得一头雾水.百度了很久,也从网络的文章的只言片语中,渐渐有了头绪. 用通俗话说,EJB就是:"把 ...

  9. Codeforces--630K--Indivisibility(容斥)

     K - Indivisibility Crawling in process... Crawling failed Time Limit:500MS     Memory Limit:65536 ...

  10. B1051 受欢迎的牛 tarjan缩点

    就是一道tarjan缩点的板子,之前在洛谷做过.但是我发现一个事,就是函数里面有一句话: void tarjan(int x) { dfn[x] = low[x] = ++tot; str[++top ...