The example shows sampling by an AD converter and sends it as a text via UART1. The realization is carried out by using the mikroPascal compiler for dsPIC30F microcontrollers. Fig. 13-4 shows the connection of a dsPIC30F6014A microcontroller for sampling the voltages of the sliding contact of a potentiometer connected to the pin AN10 and sending it as a text via UART1.
Fig. 13-4 Connection of a dsPIC30F6014A device in order to sample on pin AN10
var adcRes : word;
txt : string;
TRISB.10 := 1; // set pin as input - needed for ADC to work
while TRUE do
adcRes := Adc_Read(10);