Compile error “A heap is required, but has not been specified”
Set printf function
#if 0
//for UART1
int fputc(int ch, FILE *f)
{
IFS1bits.U2TXIF = 0;
// if (runConfig.printOn == 1)
{
// usart_data_transmit(USART0, (uint8_t)ch);
U2TXREG = ch;
// while (RESET == usart_flag_get(USART0, USART_FLAG_TBE));
while(0 == U2STAbits.TRMT); //等待发送完毕
}
return ch;
}
#endif
extern int __C30_UART;
//通过这个变量就可以灵活的将printf、scanf等标准函数的输入输出定义到需要的串口上。
//使用串口1:__C30_UART = 1;
//使用串口2:__C30_UART = 2;
__C30_UART = 2;