dsPIC - How to receive a UART string only when calling a function?

0

I need to receive a string via UART on dsPIC30F4013 only when calling a function. The device connected to the RX sends information without stopping, but I need this information only a few times, so I need this information to be received only when calling a function.

My current code receives UART data every time the device sends something.

int k;


void __attribute__((__interrupt__, auto_psv)) _U1RXInterrupt(void) {
        IFS0bits.U1RXIF = 0;

        array[k++] = U1RXREG;


        if (k == 10) {
            k = 0;
        }

    }

How do I get this string of 10 positions, without losing data, only when calling a function?

    
asked by anonymous 10.07.2018 / 16:13

0 answers