====== getAdc ====== ''int getAdc (u8 adcId, u8 adcCh)'' |adcId : The ID of the AD Input Module (0 ~ 9) | |adcCh: The channel on the AD Input Module (1 ~ 4) | |returns the digitally converted value read from the ADC | Gets the digitally converted value from analog-to-digital converter (ADC) on AD Input Module adcId, channel adcCh. getAdc is for the RS-ADIN4 module. The module ID, adcId, is set using the rotary switch on the module's face. ^Dipswitch #2 ^Return Value ^Exceptions^ |ON (0 ~ 10V) |Value between 0 and 10,00|Open Circuit: 310 ~ 320| |OFF (1 ~ 5V) |Value between 0 and 10,000| Below 0.8V: 11,111 \\ Above 5.2V: 55,555 \\ Open Circuit: 11,111| #include "moacon500.h" void cmain(void) { int voltage; while(1) //Run forever { voltage = getAdc(0, 1); //Read from the ADC (Module 0, Channel 1) printf("%d\r\n", voltage); //Print value to the debug console delay(100); //Wait for 100ms } } [[MOACON:index#System_Library:|go MOACON home]]