Skip to content

Instantly share code, notes, and snippets.

@tawashi5454
Created May 4, 2011 10:12
Show Gist options
  • Save tawashi5454/955031 to your computer and use it in GitHub Desktop.
Save tawashi5454/955031 to your computer and use it in GitHub Desktop.
Simple LED blink on PIC18F2420
#include <p18cxxx.h>
#include <delays.h>
#pragma config OSC=HS, WDT=OFF, LVP=OFF
void main(void){
// ポートAを出力に設定する
TRISA = 0;
// 永久に繰り返す
while(1){
// ポートAをオンにする
PORTA = 0xFF;
// 1秒待つ
Delay10KTCYx(250);
Delay10KTCYx(250);
// ポートAをオフにする
PORTA = 0x00;
// 1秒待つ
Delay10KTCYx(250);
Delay10KTCYx(250);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment