1: 2007-01-22 (月) 08:15:09 |
2: 2007-01-22 (月) 10:40:45 |
| | | |
| こういうことね?。 | | こういうことね?。 |
| + | |
| + | えーと。で、読み出せるポートがひとつか二つしかないので、そこにST0だのST1だのがくるわけか。(順番などで判断する) |
| + | コマンドの成功失敗の判断は [ST0] & 0xc0 が 0x00 : コマンドの正常終了 とあるから |
| + | ・・・ |
| + | |
| + | キタ━━━━(゚∀゚)━━━━ッ |
| + | |
| + | あっきぃさんとこのWikiにヒントが! |
| + | そうか! 割り込みのマスクをはずしてなかった!。これをはずしたら割り込みもやってきたぞ!。 |
| + | |
| + | ・・・っということは、オイラの「あの読み方」は正しいということか! わかったぞ! |
| + | |
| + | *モーターの回転と停止の実験 [#r256ebc9] |
| + | |
| + | こんどはこんなコードで実験! |
| + | |
| + | /*FDの実験*/ |
| + | void cmd_fdtest(struct CONSOLE *cons) |
| + | { |
| + | char s[30]; |
| + | char counter = 3; |
| + | int p; |
| + | |
| + | struct FIFO32 timerfifox; |
| + | struct TIMER *timerx; |
| + | int timerbuf[128]; |
| + | |
| + | fifo32_init(&timerfifox,128,timerbuf,0); |
| + | |
| + | timerx = timer_alloc(); |
| + | timer_init(timerx,&timerfifox,128); |
| + | timer_settime(timerx,100); |
| + | |
| + | |
| + | |
| + | |
| + | //3秒待ち |
| + | for(;;){ |
| + | io_cli(); |
| + | p = fifo32_get(&timerfifox); |
| + | if (counter == 0){break;} |
| + | |
| + | if( p == 128 ){ |
| + | sprintf(s, "Wait %dSec...\n",counter); |
| + | cons_putstr0(cons, s); |
| + | counter--; |
| + | timer_settime(timerx,100); |
| + | } |
| + | io_sti(); |
| + | } |
| + | |
| + | io_sti(); |
| + | |
| + | |
| + | |
| + | |
| + | //0x03f4のチェック |
| + | sprintf(s, "Check 0x03f4"); |
| + | cons_putstr0(cons, s); |
| + | cons_newline(cons); |
| + | |
| + | char a; |
| + | a = io_in8(0x03f4);a = a & 0x11; |
| + | if ( a == 0 ) { |
| + | sprintf(s, "OK! 0x03f4 & 0x11 is 0!"); |
| + | cons_putstr0(cons, s); |
| + | cons_newline(cons); |
| + | } |
| + | |
| + | //コマンドの送信 |
| + | sprintf(s, "Start command send..."); |
| + | cons_putstr0(cons, s); |
| + | cons_newline(cons); |
| + | |
| + | |
| + | while(io_in8(0x03f4) & 0xC0 != 0x80 ){} |
| + | io_out8(0x03f5, 0x07); |
| + | sprintf(s, "Send 0x03f5 [0x07]\n"); |
| + | cons_putstr0(cons, s); |
| + | |
| + | while(io_in8(0x03f4) & 0xC0 != 0x80 ){} |
| + | |
| + | io_out8(0x03f5, 0x00); |
| + | sprintf(s, "Send 0x03f5 [0x00]\n"); |
| + | cons_putstr0(cons, s); |
| + | |
| + | //モーターの回転&実験 |
| + | |
| + | io_out8(0x03f2, 0x1c); |
| + | sprintf(s, "Morter Spin!\n"); |
| + | cons_putstr0(cons, s); |
| + | //3秒待ち・・・ |
| + | |
| + | //3秒待ち |
| + | counter = 3; |
| + | for(;;){ |
| + | io_cli(); |
| + | p = fifo32_get(&timerfifox); |
| + | if (counter == 0){break;} |
| + | |
| + | if( p == 128 ){ |
| + | sprintf(s, "Wait %dSec...\n",counter); |
| + | cons_putstr0(cons, s); |
| + | counter--; |
| + | timer_settime(timerx,100); |
| + | } |
| + | io_sti(); |
| + | } |
| + | |
| + | io_sti(); |
| + | |
| + | |
| + | //モーターストップ |
| + | io_out8(0x03f2, 0x0c); |
| + | sprintf(s, "Morter STOP!!!!!\n"); |
| + | cons_putstr0(cons, s); |
| + | |
| + | |
| + | timer_free(&timerx); |
| + | |
| + | return; |
| + | } |
| + | /*---------------------*/ |
| + | |
| + | うーむ。どうもうまくいなかいなぁ。エミュレータではモーターの回転のみとかはできない?それともプログラムに問題が??? |