?? t1
字號:
#include <p18f4520.h>
#include <delays.h>
#include <timers.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config BOREN = OFF
#pragma code high_vector=0x08
void interrupt_at_high_vector(void)
{
_asm goto high_isr _endasm
}
#pragma code
#pragma interrupt high_isr
void high_isr(void)
{
if (PIR1bits.TMR1IF)
{
PIR1bits.TMR1IF=0;
TMR1L=0x9B; //250us
TMR1H=0xFF;
motor_isr();
}
}
//*************program code *************//
void motor_isr(void)
{
if (PORTDbits.RD3==1)
PORTDbits.RD3=0;
else
PORTDbits.RD3=1;
/* if (motor_count < motor_period)
motor_count++;
else
motor_count = 0;
if (motor_count < motor_speed)
{
if (motor_mode == FORWARD)
motor_forward();
if (motor_mode == BACKWARD)
motor_backward();
}
else
motor_stop();*/
}
//*************** main program ***************//
void main(void)
{
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -