⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 touchpanal.c

📁 用freescale 8bitMCU做的触摸屏软件
💻 C
字号:
/** ###################################################################
**     Filename  : touchpanal.C
**     Project   : touchpanal
**     Processor : MC9S08QG8CDT
**     Version   : Driver 01.11
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 2007-9-14, 12:46
**     Abstract  :
**         Main module.
**         Here is to be placed user's code.
**     Settings  :
**     Contents  :
**         No public methods
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2006
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
** ###################################################################*/
/* MODULE touchpanal */



/* Including used modules for compiling procedure */
#include "Cpu.h"
#include "Events.h"
#include "AS1.h"
#include "KBI1.h"
#include "SM1.h"
#include "TI1.h"
/* Include shared modules, which are used for whole project */
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"


#define  PenDetect   PTAD_PTAD2
#define  SPI_CS   	PTBD_PTBD5

#define  BUSY   1
#define  SETX   (byte)0xDF        //D8    8bitADC  VDD ref /PENIRQ enable
#define  SETY   (byte)0X9F
#define  FULL   1
#define  BUSCLK   16000000		//16M



/*=======================================================
*         interrupt function here
*        
*        
=======================================================*/




__interrupt void SPI_int(void);
__interrupt void TIMER_int(void);
__interrupt void UART_RECEIVE_int(void);
__interrupt void UART_TRANSMIT_int(void);


interrupt  12  void TIMER_int(void) 
{
	SPID=SETX;
//	SPID=SETY;
}

interrupt  14  void SCI_ERR_int(void) 
{
   
}

interrupt  15  void  UART_RECEIVE_int(void)
{
 
}

interrupt 18  void PENIRQ(void)
{
   KBISC_KBIE = FALSE; 
//		if(!PenDetect){
		//	if(Flag_SPI_reading==0){
//				Flag_SPI_reading=1;
	//			SPI_CS=0;
		//		SM1_SendChar(SETX);

//					}
//			}
//   Cpu_Delay100US(200);
//   if (PTAD_PTAD2 == 0)  
//       Flag_SPI_reading = 1;         
   KBISC_KBACK = 1;   
     
   KBISC_KBIE = TRUE;
}


/*==========================================================*/
//  TWREG x_position,y_position;

void UART_init()
{
//	SCIBDL = (byte)(BUSCLK/256/115200);
//	SCIBDH  = (byte)(((word)(BUSCLK/256/115200))>>8);
	SCIBDL=0;
	SCIBDH=0;
	SCIC1 = 0;
	SCIC2 = 0X0C;
	SCIC3 = 0x20;  
	SCIS2 = 0x00;  
} 

void main(void)
{
  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
//	UART_init();
//	SM1_Init();
  /*** End of Processor Expert internal initialization.                    ***/
   
 PTBDD_PTBDD5=1;	//OUTPUT MODE
 PTADD_PTADD0=1;	//OUTPUT MODE
PTAPE_PTAPE2 =1;		//pen pull up
SPIC1_LSBFE=0;
SPIC1_SSOE=1;
SPIC2_MODFEN=0;
PTBSE=0;
	
//SPIC1_CPOL=0;
//SPIC1_CPHA=0;
  asm CLI;                             /* Enable interrupts */
   while (1){
               ;
		if(!PenDetect){
			sendtomst718counter=0;
			}
               }
  
  

/* END touchpanal */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 3.00 [03.89]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;){}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -