常驻嘉宾
 
- 积分
- 4494
   
- 威望
- 2681
- 贡献
- 921
- 兑换币
- 241
- 注册时间
- 2012-2-4
- 在线时间
- 446 小时
|
K60;
#include "common.h"
#include "HAL_UART.h"
#include "HAL_GPIO.h"
#include "isr.h"
#include "HAL_FTM.h"
#define hang_end 100
#define lie_end 260
#define lie 32
uint8 imag[lie][hang_end]={0};
uint8 get_n[]={ 16,29,41,52,62,71,79,86,92,98,
103,108,112,116,120,124,128,132,135,138,
141,144,147,150,153,156,159,162,165,168,
170,172,174,176,178,180,182,184,186,188,
190,192,194,196,198,200,202,204,206,208,
210,211,212,242,243,245,246,247,248,249,250
};
uint8 c_lie=0,lie_count=0,hang_c=0;
/********************************************************************/
void hang_isr(void);
void chuang_isr();
/********************************************************************/
void main (void)
{
/***********串口初始化********************************************/
LPLD_UART_Init(UART2_BASE_PTR,9600);//Txd=D3,Rxd=D2;
/***********中断设置**********************************************/
LPLD_GPIO_Init(PORTD_BASE_PTR,0,0,1,0);
LPLD_GPIO_Init(PORTB_BASE_PTR,0,0,1,0xA);//下降沿
LPLD_GPIO_SetIsr(PORTB_BASE_PTR,chuang_isr);//场中断
LPLD_GPIO_Init(PORTC_BASE_PTR,0,0,1,0xA);//
LPLD_GPIO_SetIsr(PORTC_BASE_PTR,hang_isr);//行中断
//--------------PWM_INIT-----------------------------------------//
while(1)
{
}
}
/********************************************************************/
void hang_isr()//行中断
{
if(PORTC_ISFR==0x00000001)
{
if(lie_count==get_n[c_lie])
{
//delay
for(hang_c=0;hang_c<=hang_end;hang_c++)
{
imag[c_lie][hang_c]=LPLD_GPIO_Get_b(PTD_BASE_PTR,0);
LPLD_UART_PutChar(UART2_BASE_PTR,imag[c_lie][hang_c]);
}
c_lie++;
}
lie_count++;
}
}
void chuang_isr()
{
if(PORTB_ISFR==0x00000001)
{
hang_c=0;
lie_count=0;
c_lie=0;
}
}
采集不了图像。是不是没开中断?
|
|