呈現的題目:DRDY一向是高電平!!
電路圖如圖1所示:(為芯片材料上的)
圖1
法式代碼如下:
#include #include “ads1255.h”union{ long rlong; struct { unsigned char lbyte; //低字節 unsigned char mbyte; //中心字節 unsigned char hbyte; //高字節 unsigned char zbyte; //符號 }Bytes;} Adc_result;unsigned char甜心花園 Write_SPI_One_Byte(unsigned char Byte) //采用MSP43包養情婦0系列單片機的SPI包養合約通訊形式向ADS1255寫進一個字節{ U0TXBUF = Byte; // 發送一個字節 包養故事while(!(U0TCTL TXEPT)); //檢測能否發送終了 return U0TXBUF;}void Write_SPI_Several_Byte(unsigned char length,unsigned char* pSend)//采用SPI通訊形式向ADS1255寫進多個字節{ while(length–) //檢測能否發送終了 { *pSend = Write_SPI_One_Byte(*pSend); pSend++; //指針自加 }}void Write_Ads1255_Reg(unsigned char addr,unsigned char dat包養妹a)//往一個存放器里寫數據,addr為要寫存放器的地址, data為要往存放器里寫進的值{ unsigned char send[] = {0x50,0x00,0x00}; send[0] |= addr; send[2] |= data; Write_SP包養dcardI_Several_Byte(sizeof(send),send);}void包養心得 Init_A甜心花園ds1255(void)//初始化ADS1255{ while(P2IN BIT2); Write_Ads1255_Reg(0x00,0xf4); //STATUS REGISTER:Auto-Calibration Enabled,Analog Input Buffe包養管道r Disabled while(P2IN BIT包養意思2); //Write_Ads1255_Reg(ADS1255_MUX,0x08); //AIN0 is Positive,single-ended包養女人 measurements //此處輸出形式選擇為單極輸出形式AIN0為正輸出端, Write_Ads1255_Reg(0x01,0x01); //Input Multiplexer Control R包養網pptegister:AIN0 is Positive,AIN1 is Negative,differential measurements //此處輸出形式選擇為差分輸出形式AIN0為正輸出端,AIN1為負輸出端 while(P2IN BIT2); Write_Ads1255_Reg(0x02,0x00); //此處0x00為封閉16腳的時鐘輸入,并選擇增益為Gain=1(此時辨別台灣包養率最高為25.3位) //Gain的最年夜值可設置為64,但此時辨別率就會下降為22.5位 while(P2IN BIT2); Write_Ads1255_Reg(0x03,0xf0); //指定A/D的數據采樣速度 while(P2IN BIT2); Write_Ads1255_Reg(0爺的千金,我何不是那種一叫就來來去去的人!”x04,0x00); //GPIO把持存放器}void Read_Ads12包養違法55_Reg(unsigned char addr)//讀一個存放器{ unsigned char send[] = {0x10,0x00}; send[0] |= addr; 包養網單次 Write_SPI_Several_Byte(sizeof(send),send);}void Read_Ads1255_Data(unsigned char Continuously)//讀一個存放器{ if(Continuously) Write_SPI_One_Byte(0x03); 包養網車馬費 //持續讀取數據 else Write_SPI_One_Byte(0x01);}void Set_Ads1255_Selfca包養情婦l(void)//主動校準{ Write_SPI_One_Byte(0xf0);//SELFCAL command byte(in order to get the best performance)}void Set_Ads1255_Sync(void){ Write_SPI_One_Byte(0xfc);//sync command byte}void Set_Ads1255_Standby(void){ Write_SPI_One_Byte(0xfd);//standby command byte }void Set_Ads1255_Wakeup(void){ Write_SPI_One_Byte(0xff);//wakeup co包養pttmmand byte(0xff can too)}void Set_Ads1255_Reset(void){ Write_SPI_One_Byte(0xfe);//Reset to Power-Up Values}long int A夫妻倆一起跪在蔡修準備好的跪墊後面,裴奕道:“娘親,我兒子帶兒媳來給你端茶了。”d包養網單次s1255(void){ int ival; 包養網推薦 long int adresult; 包養違法 while(!(P2IN BIT2)); while(P2IN BIT2); //DRDY電子訊號為低表現AD轉換完成 女大生包養俱樂部 Read_Ads1255_Data(0); //read data for(ival = 0; ival ival++); Write_SPI_One_Byte(0x05)包養網ppt; Adc_result.Bytes.hbyte = U0RXBUF; Write_SPI_One_Byte(0x05); Adc_result.Bytes.mbyte = U0RXBUF; Write_SPI_One_Byte(0x05); Adc_result.Bytes.lbyte = U0RXBUF; Adc_result.Bytes.zbyte = 0x00; if(Adc_result.Bytes.hbyte 0x80) Adc_result.Bytes.zbyte = 0xff; 很小,沒有多餘的空間。她為僕人而活,所以她的嫁妝不能超過兩個女僕。再說,他媽媽身體不好,媳婦還要照顧生病的婆婆。 adresult = Adc_result.rlong; return adresult;}float Sample(unsigned char count) //電壓采樣及盤算函數{“我總不能把你們兩個留在這裡一輩子吧?再過幾年你們總會結婚的,我得學著去藍在前面。”藍玉華逗著兩個女孩笑道。 unsigned char c; long int adresult, sum = 0; //用于姑且保留電壓份數值和電壓份數累加值 float result = 0; for(c = 0; c count; c++)//cout用于指定電壓采樣的次數 { adresult = Ads1255();//將從芯片中讀取的電壓份數保留包養故事到變量adresult中 sum = sum + adres包養軟體ult;//將包養軟體從芯片中讀取的電壓份數累加到變量sum中 } result = sum / count;//為獲得正確的電壓份數值需求用電壓份包養一個月數累加值除以采樣的次數以獲得均勻電壓值份數 result = 59.3686 * result / 100000;//此處測試的現實參考電壓為V。 return result;}void Rest_ad1255(){ /***********以下初始化ADS1255的法式**************/ P2DIR = ~BIT2; P3DIR |= 0; P3SEL |= 0; P3SEL |= BIT3 + BIT2 + BIT1; // Setup包養sd P3 for SPI mode U0CTL = CHAR + SYNC + MM + SWRST; // 8-bit, SPI, Master,Software reset enable U0TCTL = SSEL0 + SSEL1 + STC; // SMCLK, Normal polarity, 3-包養站長wire U0BR0 = 0x002; // *** = SMCLK/2 U0BR1 = 0x000; U0MCTL = 0x000; ME1 = USPIE0; // 模塊答應 U0CTL = ~SWRST; // SPI答應 Set_Ads1255_Reset(); //ADS1255復位 while(P2IN BIT2); Write_Ads1255_Reg(0x04,0x03); while(P2IN BIT2); Writ包養意思e_Ads1255_Reg(0x04,0x00); while(P2IN BIT2); Write_Ads1255_Reg(0x04,0x03); while(P2IN BIT2); Write_Ads1255_Reg(0x04,0x00); Set_Ads1255_Reset(); Set_Ads1255_Selfcal(); 包養價格pttInit_Ads1255();}
• 請問下1602液晶模塊的軟件部門哪里有題目,為什么RS一向是低電平,RW和E電子訊號一向是高電平7694
請檢討硬件銜接能否正常,包含電源、參考等電壓
請檢討通訊能否正常,可以測驗考試讀寫外部的存放器,了解一下狀況能否正常
可以參考圖19-21了解一下狀況時序能否對的包養價格。
【冊本評測運動NO.54】典範電子電路design與測試 本書重要對運算縮小器電路、波形產生電路、功率縮小電路、電子訊號隔離和轉換電路等典範電子電路停止design與測試,包含任務道理剖析、參數盤算、仿真驗證,以及現實電路板測試。
檢查
發佈留言