Other Parts Discussed in Thread: HALCOGEN
i want to start conversion of ADC(ambient_lightsensor[AD1IN_6]) with external input by setting the voltage of one of GIO pins to high from almost zero (3.3v or 5v) . i configure the halcogen as below :
drivers : GIO / SCI2LIN (for serial transmission of sampled voltage) / ADC1
GIO : port b bit 0 : set to rising edge and enable connection to VIM.
PINMUX : enable GIOB and AD1EVT (may be not needed at all )
ADC1 Group Event : ADC1 Group trigger source GIOB0 on default and Trigger edge to rising edge. / enable pin 6 for voltage sampling of ambient light sensor(on this very board) .
and this is my code in sys_main.c
int main(void) { //initializing SCI module sciInit() ; //initializing ADC module adcInit() ; //initializing GIO module gioInit() ; uint32 grp = 1 ; adcData_t adc_dat ; adcData_t * pr_adc_dat = &adc_dat ; uint32 num_digit = 0 ; char ch[10] ; char* pr_ch = &ch[0] ; //fist comment // sciSend(scilinREG , 24 , "Ambient Light Viewer :\r\n") ; while(1){ while(adcIsConversionComplete(adcREG1 , 1) == 0) ; adcGetData(adcREG1 , 1 , pr_adc_dat ) ; num_digit = ltoa(pr_adc_dat->value, pr_ch) ; sciSend(scilinREG , 2 , "v:" ) ; sciSend(scilinREG , num_digit , pr_ch ) ; sciSend(scilinREG , 2 , "\r\n") ; //after each iteration set the isconversioncomplete to false ... //wait until again GIOB0 voltage set to HIGH (3.3 or 5) ... adcREG1->GxINTFLG[grp] = (uint32) 0U ; } return 0; }
im not examining the SCI module because it works for the first comment ( refer to code) ...
i have no idea why when i set GIOB_0 to HIGH logical value externally the conversion is not begin( note that i leave the GIOB_0 pin with it's default input direction).