熱門: 51單片機(jī) | 24小時(shí)必答區(qū) | 單片機(jī)教程 | 單片機(jī)DIY制作 | STM32 | Cortex M3 | 模數(shù)電子 | 電子DIY制作 | 音響/功放 | 拆機(jī)樂園 | Arduino | 嵌入式OS | 程序設(shè)計(jì)
![]() |
這幾天根據(jù)網(wǎng)上資料仿照了一個(gè)簡單的;但現(xiàn)在就是很有問題: ①只能顯示你要求的第一個(gè)像素點(diǎn)的值,再多就是統(tǒng)一為0了; ②顯示的數(shù)值不是在34與127兩個(gè)間不斷跳動,而且跳一會就不動了,怎么動tsl1401都沒用! 這是主要程序: #include "reg52.h" #include <intrins.h> #include "ad.h" //用的是串行的ad0832 #include "oled.h" #define uchar unsigned char #define uint unsigned int sbit CCD_CLK=P2^6; sbit SI=P2^7; uchar n; uchar adc[]; void Delayus(uchar x) { while(x--) {_nop_();} } void main() { OLED_Init(); while(1) { SI=1; Delayus(10); CCD_CLK=1; Delayus(10); SI=0; Delayus(10); CCD_CLK=0; Delayus(10); for(n=0; n<128;n++) { CCD_CLK=1; adc[n]=A_D(); //將采集到的每個(gè)像素點(diǎn)ad值保存起來 CCD_CLK=0; Delayus(1); } OLED_ShowNum(0,0,adc[81],3,16);//輸出81號像素點(diǎn)的值 OLED_ShowNum(0,2,adc[30],3,16);//輸出30號****** } } 有沒有大佬幫我看看什么問題。。。。十分感謝 |
Powered by 單片機(jī)教程網(wǎng)