www.pudn.com > JPEG300.rar > jpeg300.c
/*
;************************************************************************************************************
;* JPEG300图象采集系统
;*
;*
;*
;*
;*-------------------------------------------- -------------------------------------------------
;* 修改作者 :
;* 修改日期 : 2006/4/6
;* 版本声明 :
;*-----------------------------------------------------------------------------------------------------------
;*
;*-----------------------------------------------------------------------------------------------------------
;************************************************************************************************************
;*/
#include "44b.h"
#include "44blib.h"
#include "option.h"
#include "stdio.h"
#include "string.h"
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
/**********************************************************
JPEG300引脚定义
***********************************************************/
#define CAPMODE (1) //PC0,PC1做模式和使能控制
#define CAPEN (1<<1)
#define CAPINT (1<<2) //PG2做input检测dr信号(可以做外部中断2)
uchar new_data ,old_data;
float i =0;
void __irq JPEG_Interrupt (void);
void System_init(void) ;
void Eint2_init(void);
/*************************************************************
*名称:
*功能: 将dr方式设为中断方式
**************************************************************/
void System_init()
{
rINTMSK = rINTMSK | BIT_GLOBAL; //关总中断
rI_ISPC = BIT_EINT2 ;
rPCOND = 0x5555; //D口初始化
rPUPD = 0xff;
rPDATD = 0x0;
rPCONC = 0x0; //C口初始化
rPUPC = 0xffff;
rPDATC = 0x0;
rPCONG = 0x30; //G口为中断输入
}
void Eint2_init(void)
{
rINTCON = 0x5 ; //向量中断模式
rINTMOD = 0x0 ; //All=IRQ mode
pISR_EINT2 = (unsigned)JPEG_Interrupt ; //修改中断入口地址
rEXTINT = 0x44444444; //上升沿中断
rINTMSK=~(BIT_GLOBAL|BIT_EINT2);
}
/*****************************************************************
*名称: void __irq JPEG_Interrupt (void)
*功能: 接收中断并存数据
*****************************************************************/
void __irq JPEG_Interrupt (void)
{
rI_ISPC = BIT_EINT2 ;
new_data = rPDATD;
//rPDATD = 0x0;
old_data = new_data;
Uart_Printf("\nadr=%4d,temp = %4x OK!",i,new_data);
i++;
if(new_data==0xd8 && old_data==0xff)
{
Uart_Printf("\n*JPEG start*");
}
if(new_data==0xd9 && old_data==0xff)
{
Uart_Printf("\n*JPEG end*");
i = 0;
}
}
void Main()
{
Delay(1800);
System_init();
Eint2_init();
Uart_Init(0,115200);
Led_Display(0xf);
Delay(0);
Beep(0x1);
Uart_Select(0); //Select UART0//
Uart_Printf("\n*************************************************************************");
Beep(0x0);
Uart_Printf("\n* JPEG300测试 *");
Uart_Printf("\n* *");
Uart_Printf("\n* *");
Uart_Printf("\n* Email:Support@hzlitai.com.cn *");
Uart_Printf("\n* UART Config--COM:115.2kbps,8Bit,NP,UART0 *");
Uart_Printf("\n*-----------------Begin to Start JPEG test -------------------*");
Led_Display(0x0);
rPDATC = rPDATC | CAPEN;
Delay(5);
rPDATC = rPDATC | CAPEN;
while(1);
}