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是兼容的.读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现 ...
随机推荐
- Java 下实现Cache
最近在做Spring的项目,想做一个缓存,访问数据库,定期来做数据更新 要实现两个功能 可以通过http请求来立刻刷新缓存 缓存可以通过自己配置的时间间隔来定期刷新 通过Controller来做 因为 ...
- js调用ro的webservice
Enabling JavaScript Access on the Server Drop the JavaScriptHttpDispatcher component onto the server ...
- 协程,greenlet原生协程库, gevent库
协程简介 协程(coroutine),又称为微线程,纤程,是一种用户级的轻量级线程.协程拥有自己的寄存器上下文和栈. 协程调度切换时,将寄存器上下文和栈保存到其他地方,在切回来时,恢复之前保存的上下文 ...
- [bzoj3702/2212][Poi2011]二叉树/Tree Rotations_线段树
二叉树 Tree Rotations bzoj-3702 bzoj-2212 Poi-2011 题目大意:现在有一棵二叉树,所有非叶子节点都有两个孩子.在每个叶子节点上有一个权值(有n个叶子节点,满足 ...
- 洛谷 P1796 汤姆斯的天堂梦_NOI导刊2010提高(05)
P1796 汤姆斯的天堂梦_NOI导刊2010提高(05) 题目描述 汤姆斯生活在一个等级为0的星球上.那里的环境极其恶劣,每天12小时的工作和成堆的垃圾让人忍无可忍.他向往着等级为N的星球上天堂般的 ...
- [Node.js] Add Logging to a Node.js Application using Winston
Winston is a popular logging library for NodeJS which allows you to customise the output, as well as ...
- java读取中文分词工具(一)
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.I ...
- jsp模板配置
<%-- Created by IntelliJ IDEA. User: ${USER} Date: ${DATE} Time: ${TIME} To change this template ...
- pat1013:数素数
https://www.patest.cn/contests/pat-b-practise/1013 #include "stdio.h" #include "math. ...
- OTA升级中关于update.zip包的一些总结【转】
本文转载自:http://429564140.iteye.com/blog/2337165 update.zip包整理 一. update.zip包的目录结构 |----boot. ...