串口中断函数进不去?求大神帮助?

[复制链接]
638|1
手机看帖
扫描二维码
随时随地手机跟帖
SHILINCHUAN|  楼主 | 2017-4-13 10:10 | 显示全部楼层 |阅读模式
#include <m8c.h>        // part specific constants and macros  
#include "PSoCAPI.h"    // PSoC API definitions for all User Modules

#pragma interrupta_handler UART_1_RX_ISR;

        char *strPtr,count;
        char iResult_up8=0,iResult_down8=0;

void yanshi(int x)
{          
        for(x;x>0;x--)                 
                ;//  LCD_1_Delay50u();
}

void switch_INT2byte(int data)
{
        iResult_down8 = data;
        data = data>>8;
        iResult_up8 = data;       
}

void main(void)
{
    int iResult1, iResult2,j,z;
    double  prssure1,prssure2,dianya,dianya2;
    unsigned long int sum1=0;
    unsigned long int sum2=0;
       
    M8C_EnableGInt;                       // Enable global interrupts
    DUALADC_Start(DUALADC_HIGHPOWER);     // Turn on Analog section
    DUALADC_SetResolution(12);            // Set resolution to 12 Bits
    DUALADC_GetSamples(0);                // Start ADC to read continuously
    PGA_1_Start(PGA_1_MEDPOWER);                         /* Turn on PGA power */
    PGA_2_Start(PGA_2_MEDPOWER);                         /* Turn on PGA power */
    LED_Start();       
        UART_1_Start(UART_PARITY_NONE);                       /* Enable UART */
        UART_1_EnableInt();  
        LCD_Start();                    // Initialize LCD hardware       
    UART_1_CmdReset();       
        //CyGlobalIntEnable;
       
   while (1) {                                               
      if(DUALADC_fIsDataAvailable() == 0);  // Wait for data to be ready
     {
                iResult1 = DUALADC_iGetData1ClearFlag();          // Get Data from ADC Input1
        iResult2 = DUALADC_iGetData2ClearFlag();                 
            strPtr = UART_1_szGetRestOfParams();               
                                                                                                } // Get Data from ADC Input2       
                //while(*strPtr==97)  
            while(count==1)  
                        {                        
                     LCD_Position(0,0);             // Position cursor @ row 0, col 4
                        LCD_PrHexInt(iResult1);
                        LCD_Position(1,0);             // Position cursor @ row 0, col 4
                        LCD_PrHexInt(iResult2);
                // prssure1=sum1/5.0;                 
            //  dianya=prssure1/4096*5+0.03;                
                // //prssure1=(dianya/5.1-0.04)/0.00369;                       
           //  sum1=0;       
           //  prssure2=sum2/5.0;               
          //   dianya2=prssure2/4096*5;   
           //  prssure2=(dianya2*20.83-2)/0.4;       
         //         sum2=0;               
                                                                 
                    switch_INT2byte(iResult1 );
                    UART_1_Write(&iResult_up8,1);  //send up8
                    UART_1_Write(&iResult_down8,1);  //send down8                                               
                       
                        switch_INT2byte(iResult2);
                    UART_1_Write(&iResult_up8,1);  //send up8
                    UART_1_Write(&iResult_down8,1);  //send down8       
                    *strPtr=0;
                     count=0;
                        UART_1_CmdReset();                                               
                   }
                    UART_1_CmdReset();               
   }
}

#pragma interrupta_handler UART_1_RX_ISR;
void _UART_1_RX_ISR()
{       
        if ( UART_1_szGetRestOfParams())
           count=1;
}

接收中断放在这个模块的   对应程序也已经改了

  
    org   28h                      ;PSoC Block DCB02 Interrupt Vector
  ljmp _UART_1_RX_ISR
    reti
  波特率这些配置是没有问题的!能发送   求大神支招    谢谢你们了!
SHILINCHUAN|  楼主 | 2017-4-14 10:03 | 显示全部楼层
大神些  能不能给点建议啊   卡死在这了   用扫描做串口通信  要丢数据哇   中断程序进不去?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2

主题

4

帖子

0

粉丝