Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


modifying functions and interupts

Inno T MushongaInno T Mushonga Member Posts: 2

I have so far come up with the code below but I am stuck due to my limited c experience, anyone please help me change this code below so that the COMBUF_Handler(void) interrupt reads data from user & runs an adc handler function to obtain adc values then puts these values back so that the user can read them. (It would be great if the code can run continuously so that the user can just send 0x20 every 100ms and get the updated adc value each time.

interrupt void COMBUF_Handler(void)
Rx_Buf[0] = DIF_TO_MCU; /* Read 0x20 DIF_TO_MCU data sent by user */

while (Rx_Buf[0] == 0x20){
Rx_Buf[0] = ADC_PchannelValue; /* put the adc value in the rx_buf */

VS2 ADC_PchannelValue; /* PADC Value */

interrupt void PADC_Handler(void)
/* Accumulate the value of P channel /
AccadcValue[0] = PADC_DATA;
Read P channel ADC value and store it into global variable */
ADC_PchannelValue = (S2)PADC_DATA;
> >

Sign In or Register to comment.