void main(void) { PCA0MD &= ~0x40; OSCILLATOR_Init (); Port_Init(); Ext_Interrupt_Init( ); WR_CONTROL_PIN=1; Tft_Init( ); TftClear(BLACK); TftWR_Str(60,70,"C8051F330 Camera",RED,BLACK); TftWR_Str(60,100,"QI FEI DIAN ZI VER1.0",RED,BLACK); TftWR_Str(60,130,"OV7670 Initializing......",RED,BLACK); delay_ms(3000); while(1!=Cmos7670_init()); delay_ms(3000); TftClear(BLACK); TftWR_Str(60,110,"OV7670 Init SUCCESS! ",RED,BLACK); delay_ms(5000); TftClear(BLACK); EA = 1; while(1); }
/** @fn main() @brief just to test PWM module including drive, speed. @return none */ void main() { //PCA0MD = 0x00; UART0_PORT_Init(); PWM_PORT_Init(); OSCILLATOR_Init(); PCA0_Init(); EA = 1; set_pwm_duty_cycle(50); }
/** @fn main() @brief just to test UART0 module @return none */ void main() { UART0_Init(); UART0_PORT_Init(); OSCILLATOR_Init(); set_UART0_baudrate(10); // set UART0 baudrate is 9600 EA = 1; k = 0; SBUF0 = UART0_data[k]; // start to transmit data while (1) { if(k >= UART0_data_length) { TR1 = 0; // disable timer1 and stop transmitting data } } }
/*! * \fn main() * \brief just to test PWM module * \return none */ int main() { PCA0MD = 0x00; PORT_Init(); OSCILLATOR_Init(); PCA0_Init(); timer_0_1_init(); timer2_init(); IN1 = 0; IN2 = 1; IN3 = 0; IN4 = 1; EA = 1; //set_pwm_0_duty_cycle(20); //set_pwm_1_duty_cycle(16); while (1) { //set_pwm_0_duty_cycle(700); //set_pwm_1_duty_cycle(660); set_wheel_1_speed(50); set_wheel_0_speed(50); } }