Skip to content

Instantly share code, notes, and snippets.

@totoroAKI
Created August 8, 2018 20:16
Show Gist options
  • Save totoroAKI/4e02a5ad074727ef1deb4e03f4249152 to your computer and use it in GitHub Desktop.
Save totoroAKI/4e02a5ad074727ef1deb4e03f4249152 to your computer and use it in GitHub Desktop.
#include <msp430.h> //MSP430F2619TPM
// 端子設定 //////////////
#define test_LED 0b00000001 // P1.0 test_LED
void setup() {
WDTCTL = WDTPW + WDTHOLD; // Stop WathcDog Timer,
SVSCTL &= ~SVSFG; // 低電圧フラグを消去 Supply Voltage Supervisor
SVSCTL = 0x60 + PORON; // SVS POR enabled @ 2.5V 電圧低下検出.この電圧以下ではマイコンリセット.
while(!(SVSCTL & SVSON)); // 電圧監視機能がONになるまで待機
if (CALBC1_1MHZ == 0xFF || CALDCO_1MHZ == 0xFF) { while(1); } //----- クロックキャリブレーション -----//
BCSCTL1 = CALBC1_1MHZ; // Set RSELx
DCOCTL = CALDCO_1MHZ; // Set DCOx and MODx
P1DIR = test_LED; // P1.0;OUT, the others;IN
P1REN = 0x00; // P1 set to Pullup/Pulldown Disable
}
void main(void)
{
setup(); // システム初期設定
P1OUT ^= test_LED;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment