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. 面试题:你能写一个Vue的双向数据绑定吗?

    在目前的前端面试中,vue的双向数据绑定已经成为了一个非常容易考到的点,即使不能当场写出来,至少也要能说出原理.本篇文章中我将会仿照vue写一个双向数据绑定的实例,名字就叫myVue吧.结合注释,希望 ...

  2. Problem 56

    Problem 56 https://projecteuler.net/problem=56 Powerful digit sum A googol (10100) is a massive numb ...

  3. selenium等待

    简介 在selenium操作浏览器的过程中,每一次请求url,selenium都会等待页面加载完成以后, 才会将操作权限在交给我们的程序. 但是,由于ajax和各种JS代码的异步加载问题,当一个页面被 ...

  4. 【codeforces 761E】Dasha and Puzzle

    [题目链接]:http://codeforces.com/contest/761/problem/E [题意] 给你一棵树,让你在平面上选定n个坐标; 使得这棵树的连接关系以二维坐标的形式展现出来; ...

  5. 清北学堂模拟赛d4t1 a

    分析:大模拟,没什么好说的.我在考场上犯了一个超级低级的错误:while (scanf("%s",s + 1)),导致了死循环,血的教训啊,以后要记住了. /* 1.没有发生改变, ...

  6. jQuery WEI----DIV+CSS样式li自动适应高度,自动换行,横向排列

    设置相关样式即可,按照需求自己修改样式,Demo代码如下: <li style="display:inline;;line-height:24px;height:auto;word-b ...

  7. const关键字作用

    const int a; int const a; const int *a; int * const a; int const * a const; /******/ 前两个的作用是一样,a是一个常 ...

  8. [bzoj1901][Zju2112]Dynamic Rankings_主席树

    Dynamic Rankings bzoj-1901 Zju-2112 题目大意:给定一个n个数的序列,m个操作,支持:单点修改:查询区间k小值. 注释:$1\le n,m\le 10^4$. 想法: ...

  9. systemtap dtrace与 oracle

    https://fritshoogland.wordpress.com/page/3/ http://externaltable.blogspot.com/2013/06/dtrace-explora ...

  10. 每一个程序猿必知之SEO

    似乎由于受这篇文章的影响 http://katemats.com/what-every-programmer-should-know-about-seo/ 于是我也觉得我应该写一个每一个程序猿必知之S ...