温度检测系统

[复制链接]
811|7
 楼主| pangb 发表于 2019-11-8 23:00 | 显示全部楼层 |阅读模式
用PSoC designer做的温度检测系统,无法得到数据
chenjunt 发表于 2019-11-8 23:03 | 显示全部楼层
说这么笼统,谁知道你啥问题
 楼主| pangb 发表于 2019-11-8 23:15 | 显示全部楼层

下面是我编的程序,不知道哪边出了问题
//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------
#include <m8c.h>        // part specific constants and macros
#include "PSoCAPI.h"    // PSoC API definitions for all User Modules
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int wendu;
int i=0;
int j=0;
int shuzi;
int k;
int m;
int i;
int c;
char str[10];
void main(void)
{
M8C_EnableGInt ;
    LCD_1_Start(); // Initialize LCD
PGA_1_SetGain(PGA_1_G1_00);
     PGA_1_Start(PGA_1_HIGHPOWER);
     ADCINC_1_Start(ADCINC_1_HIGHPOWER);      
     ADCINC_1_GetSamples(0);
  for(;;){
    delay();
     wendu=0;
     while(ADCINC_1_fIsDataAvailable()==0);     //等待数据
        wendu=ADCINC_1_wClearFlagGetData();     //数据赋值
            for(m=50;j>0;j--)
      for(k=50;i>0;i--)
      display(wendu);
        }
   
}
      

void delay(){
   for(j=250;j>0;j--)
   for(i=250;i>0;i--);
}
void display(shuzi)
{
   c=shuzi;
   j=0;
for(i=0;i<50;i++)
{
if(c==0)break;
else
{
   c=c/10;
   j++;
}
}
c=shuzi;
for(i=0;i<10;i++)
{
if(i>=j)
{
str='';
}
else
{
str=c%10+'0';
   c=c/10;
}
}
   LCD_1_Position(0,5); // Place LCD cursor at row 0, col 5.
   LCD_1_PrString(str); // Print "PSoC LCD" on the LCD
}
supernan 发表于 2019-11-8 23:17 | 显示全部楼层
ad端口,时钟初始化过了?
houcs 发表于 2019-11-8 23:20 | 显示全部楼层
得不到数据是指采样结果没有,还是显示结果没有?
 楼主| pangb 发表于 2019-11-8 23:23 | 显示全部楼层
我初学,不太清楚
chenjunt 发表于 2019-11-8 23:26 | 显示全部楼层
个人觉得是显示的问题
 楼主| pangb 发表于 2019-11-8 23:29 | 显示全部楼层
嗯,那我按大家的说法挨个排查一下,先结贴啦,谢谢哈
您需要登录后才可以回帖 登录 | 注册

本版积分规则

701

主题

7643

帖子

6

粉丝
快速回复 在线客服 返回列表 返回顶部