2025年04月25日 10:49:53 来源:金湖长通测控仪表厂 >> 进入该公司展台 阅读量:7
压力校验仪开发工程师依照demo编写了如下代码,却打不开AD转换(显示的转换结果乱七八糟,没有任何规律),其中displaystring()是用LCD显示字符串的函数,已经调试成功。编写程序如下:
#Include
#Include
extern signed long bipolar(void);
#define LSB 298e-9
#Ifndef XTAL // if no XTAL compiler variable defined use:
#define XTAL // XTAL frequency 11.0592 MHz
#Endif
Main(void)
j=ADRESL;
}
j=1;
while(1) // Waiting for conversion
result=bipolar(); // Save Results
sprintf (szBuffer, "%10.8f", result*LSB);
DisplayString(0x80, szBuffer); // Display ADResult on the first line of LCD
}
}