// Copyright 2005 Doi Shigeki // list402.cpp LEDの点滅 // 〜PCIボードを使った外部制御の基礎 // fbippi.libをリンクすること #include #include #include #include"FbiPpi.h" main() { HANDLE h; int r; int i; BYTE x; printf("PCIのテスト2\n"); h = PpiOpen( "FBIPPI1", // デバイス名 0 ); // オープンフラグ if( h == INVALID_HANDLE_VALUE ){ printf("PCIデバイスがオープンできません\n"); return 0; } r = PpiControl( h, // デバイスハンドル FBIPPI_8255_CONTROLLER1 , // コントローラの指定 0x90 ); // 制御データ,モード0,PAのみ入力 printf("PPI制御結果 = %d( %d:ok) \n", r, FBIPPI_ERROR_SUCCESS ); printf("点滅動作,xボタンで強制終了\n"); x = 0; while( 1 ){ // ポートB へ x を出力 PpiOutputPort( h, // デバイスハンドル FBIPPI_8255_CONTROLLER1 , // コントローラ指定 FBIPPI_PORT_B, // ポート指定:B x ); // 出力データ x++; } PpiClose( h ); // デバイスのクローズ }