ESM7000是基于NXP i.MX7D的高性能低功耗工控主板,支持以太網(wǎng)、CAN、串口、USB等豐富的通訊接口。ESM7000提供了RGB和LVDS兩種顯示接口可選,支持從320x240到1920x1080的顯示分辨率,支持電容/電阻觸摸屏。
ESM7000還集成了兩個(gè)ADC單元,每個(gè)ADC單元支持4通道的模擬量采集, ADC的基準(zhǔn)電壓為1.8V,分辨率為14位,輸入模擬量信號(hào)范圍為0~1.8V。通過標(biāo)定,ESM7000的ADC可實(shí)現(xiàn)14位精度的模擬信號(hào)采集。基于ESM7000可快速構(gòu)建通訊接口豐富、人機(jī)交互良好、高性價(jià)比的數(shù)據(jù)采集方案。支持AD功能的ESM7000售價(jià)保持不變,用戶可在英創(chuàng)ESM7000主頁查看對(duì)應(yīng)的定貨型號(hào)和價(jià)格。
ESM7000的AD輸入引腳與主板的ISA總線引腳是復(fù)用的,復(fù)用關(guān)系如下表所示:
ESM7000引腳E列 | ||
8-bit精簡ISA | 8通道ADC接口 | |
E1 | GND電源地 | GND電源地 |
E2 | ISA_D0 | ADC1_CH0 |
E3 | ISA_D1 | ADC1_CH1 |
E4 | ISA_D2 | ADC1_CH2 |
E5 | ISA_D3 | ADC1_CH3 |
E6 | ISA_D4 | ADC2_CH0 |
E7 | ISA_D5 | ADC2_CH1 |
E8 | ISA_D6 | ADC2_CH2 |
E9 | ISA_D7 | ADC2_CH3 |
E10 | ISA_RDn | NC |
E11 | ISA_WEn | NC |
E12 | ISA_ADVn | NC |
E13 | ISA_CSn | NC |
軟件操作上,ESM7000的兩個(gè)ADC對(duì)應(yīng)設(shè)備名稱為L"ADC1:"和L"ADC2:",通過標(biāo)準(zhǔn)的文件讀函數(shù)ReadFile就可讀取指定通道的ADC轉(zhuǎn)換結(jié)果。下面是連續(xù)讀取ESM7000指定AD通道,并記錄最大值、最小值和計(jì)算直方圖的示例代碼。
#define VBASE 1800 // 1800mV #define resolution 0x4000 // 14-bit UINT32 histogram[resolution]; int _tmain(int argc, _TCHAR* argv[]) { HANDLE hADC; DWORD adc_val, inst; DWORD dwMinVal, dwMaxVal, i, times, dwBytesofRead; ADC_INFO adcInfo; TCHAR adcInst[][10]={TEXT("ADC1:"), TEXT("ADC2:")}; // ADC設(shè)備名 inst = 0; hADC = CreateFile(adcInst[inst], GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); if (hADC == INVALID_HANDLE_VALUE) { ERRORMSG(1, (_T("Could not retrieve an handle on \r\n"))); return -1; } memset( histogram,0, sizeof(histogram)); dwMinVal = 0xffffffff; dwMaxVal = 0; adcInfo.dwChannels = 1; // ADC通道0~3 adcInfo.pData = &adc_val; // 14位的ADC數(shù)據(jù) for(i=0; i<1000; i++) { ReadFile(hADC, &adcInfo, 1, &dwBytesofRead, NULL); dwMinVal = adc_val < dwMinVal ? adc_val : dwMinVal; dwMaxVal = adc_val > dwMaxVal ? adc_val : dwMaxVal; histogram[adc_val]++; } RETAILMSG( 1, (TEXT("----------- Data Analysis-%s-CH%d -----------\r\n"), adcInst[inst], adcInfo.dwChannels)); for( i=0, times=0; i<resolution;i++ ) { if( histogram[i] ) times += histogram[i]; } #ifdef VBASE TCHAR szBuf[100]; for( i=0; i<resolution;i++ ) { if( histogram[i] ) { wsprintf(szBuf, TEXT(" value :%5.2fmv times:%5d %d%%\r\n"), i * (float)VBASE / resolution, histogram[i], histogram[i]*100/times); RETAILMSG( 1, (TEXT(" %s"), szBuf)); } } wsprintf(szBuf, TEXT(" MinVal:%5.2fmv MaxVal:%5.2fmv MaxVal-MinVal:%5.2fmv\r\n"), dwMinVal* (float)VBASE / resolution, dwMaxVal* (float)VBASE / resolution, (dwMaxVal-dwMinVal)* (float)VBASE / resolution); RETAILMSG( 1, (TEXT(" %s"), szBuf)); #else for( i=0; i<resolution;i++ ) { if( histogram[i] ) RETAILMSG( 1, (TEXT(" datas :%5d times:%5d %d%%\r\n"), i, histogram[i], histogram[i]*100/times)); } RETAILMSG( 1, (TEXT(" MinVal:%5d MaxVal:%5d MaxVal-MinVal:%d\r\n"), dwMinVal, dwMaxVal, dwMaxVal-dwMinVal)); #endif RETAILMSG( 1, (TEXT("--------------------- END ---------------------\r\n\r\n"))); CloseHandle(hADC); return 0; }
成都英創(chuàng)信息技術(shù)有限公司 028-8618 0660