鋰電池反接/接反保護方案


用一個N-MOSFET,D接電池負極,兩個電阻分壓後(具體阻值由電池電壓決定)接G極。如圖所示。N-MOSFET的內部體二極管,S極是正極,D極是負極。在電池反接時電池的正極接的是D極。
MOSFET內部的二極管的壓降沒有影響,MOSFET導通時二極管是被旁路掉的,並不起作用。

Ti LM4F120 LaunchPad Evaluation Board

恩.....這是玩意訂價真恐怖
video platformvideo managementvideo solutionsvideo player

Program file does not exist

討厭的訊息,根本不知道要做什麼。
使用標準IDE如果不去做修正就會出現這種不知所云的錯誤,CCS一樣也會。


在C語言程式中使用二進位控制暫存器

網路上一堆奇淫技巧,但在前處理器的都是八位元為主,16~32位元就要寫程式,這不好單晶片可沒空間和資源算這玩意。
VC的巨集辦的到但太噁心了,還好沒有單晶片是用VC的。怎樣,阿是不能用位元操作寫單晶片呦,控制週邊用高階語言太麻煩了。
不過 KEIL C沒有這個擴展可以用,但 GCC有(歡呼)

6.60 Binary constants using the `0b' prefix

Integer constants can be written as binary constants, consisting of a sequence of `0' and `1' digits, prefixed by `0b' or `0B'. This is particularly useful in environments that operate a lot on the bit-level (like microcontrollers).
The following statements are identical:
     i =       42;
     i =     0x2a;
     i =      052;
     i = 0b101010;
The type of these constants follows the same rules as for octal or hexadecimal integer constants, so suffixes like `L' or `UL' can be applied.

http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html
簡單好用!

Firefox 15之後左上角那玩意的顏色調整

Firefox 15之後左上角那玩意的顏色調整

userChrome.css

auto-apt

sudo apt-get install auto-apt
#  安裝 auto-apt 套件

sudo auto-apt update
# 更新套件庫清單

auto-apt run ./configure
make
sudo make install

sudo apt-get install checkinstall
# 安裝 checkinstall 套件

gunzip source.tgz
./configure
make
checkinstall
sudo dpkg -i source.deb

終わりの惑星のLove Song 09 - 雪の降らない星

HYCON11P ICE ENOB Driver

嚴格說起來有些部分實在不符合Microsoft標準,不過原來就不符合了,改的比較通用一點。

筆記安裝CoreAVC

以前的教程都使用svn來獲取
但我多次都無法patch,最後發現mplayer1.0rc4就可以
http://www.mplayerhq.hu/MPlayer/release ... rc4.tar.gz
還有那兩個二進制文件可直接下載


現在不用自己編譯了,但要記得加上-vc coreserve,

  1. PPA源,安裝dshowserver 和 mplayer
    sudo add-apt-repository ppa:ripps818/coreavc
    sudo apt-get update
    sudo apt-get install dshowserver mplayer
  2. 複製CoreAVC解碼器到dshowserver目錄
    usr/share/dshowserver/
  3. 安裝smplayer,然後就可以在解碼器裡面選擇CoreAVCDecoder.ax進行解碼

MSP430 LaunchPad PushButton

//******************************************************************************
//  hit the Push-Button P1.3 and trigger red LED toggle P1.0 example
//  support msp430g2553
//  Description; Toggle P1.0 by xor'ing P1.0
//  ACLK = n/a, MCLK = SMCLK = default DCO
//
//                MSP430G2231
//             -----------------
//         /|\|              XIN|-
//          | |                 |
//          --|RST          XOUT|-
//            |                 |
//            |             P1.0|-->LED          
//
// Build by CCS v5
// source code provided by Wei Yan <kikiqqp@gmail.com>
//******************************************************************************
// #define BSF(var, bit)  ((var) |=  (1 << (bit))) //把某1bit設為1 仿PIC ASM用
// #define BCF(var, bit)  ((var) &= ~(1 << (bit)))  //把某1bit設為0

#include <msp430g2553.h>

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;            //關閉看門狗
  P1OUT = BIT3;                        //設定PT1.3為高電位
  P1DIR = BIT0;                        //設定PT1.0為輸出
  P1REN = P1OUT;                       //設定PT1.3上拉電阻
  char flash;
  unsigned int count;
  for( ; ; )                          //Polling Loop
  {
      while((P1IN & BIT3) == 0)   //使用if比較直覺
          for(flash = 0 ; flash < 20; flash++)
          {
              P1OUT ^= BIT0;          //NOT BIT0高電位
              for (count=0; count<60000; count++);
          }
  }
}