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

📄 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 "SM1.h"
#include "AS1.h"
#include "KBI1.h"
#include "Bit1.h"
#include "Bit2.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  BUSY   1
#define  SETX   (byte)0xD8        //D8    8bitADC  VDD ref /PENIRQ enable
#define  SETY   (byte)0X98
#define  FULL   1



/*=======================================================
*         interrupt function here
*        
*        
=======================================================*/
  bool  flag_pen;       

interrupt 18  void PENIRQ(void)
{
   KBISC_KBIE = FALSE;
   Cpu_Delay100US(200);
   if (PTAD_PTAD2 == 0)  
       flag_pen = 1;         
   KBISC_KBACK = 1;   
     
   KBISC_KBIE = TRUE;
}

interrupt  13  void SPI_int(void) 
{           }

interrupt  14  void SCI_ERR_int(void) 
{

   
}

interrupt  15  void  RX_int(void)

{
 

}

interrupt  16 void  TX_int(void)

{
    
  
}

/*==========================================================*/
  byte  x_position=0,y_position=0;
 
 
void main(void)
{

       int i ;
  
  /* Write your local variable definition here */

  /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  PE_low_level_init();
  /*** End of Processor Expert internal initialization.                    ***/

  /* Write your code here */
   
  while(SPIS_SPTEF != 1) ;
    while(SM1_SendChar(SETX));
    
//     SPID = SETX;
        for (i = 0; i<1000;i++);
   while (1){
               
               while(SM1_SendChar(SETX));

                        
               if( flag_pen ) {
                   flag_pen = 0;
               
               while(SM1_SendChar(SETX));
                while(SPIS_SPTEF != 1);
                   SPID = SETX;
                while(PTAD_PTAD3 == BUSY);
       //         while(SPIS_SPRF != FULL);
       
                 for (i = 0; i<1000;i++);
          //      while( SM1_RecvChar(&y_position));
                   y_position = SPID;

               }
  
  
   }
  /* For example: for(;;) { } */

  /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** 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!!! ***/

/* END touchpanal */
/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 3.00 [03.89]
**     for the Freescale HCS08 series of microcontrollers.
**
** ###################################################################
*/
   }

⌨️ 快捷键说明

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