ボーレートの変更
以下のコードでUART_Init(9600);→UART_Init(115200);に変更します。
MAIN_RETURN main(void)
{
ADCON1 = 0b00001111;
TRISA = 0b00000000;
TRISB = 0b00000000;
TRISC = 0b00110000; //D-,D+
TRISD = 0b00000000;
TRISE = 0b11000011; //SW1,2=INPUT LED=OUTPUT
LATA = 0b00000000;
LATB = 0b00000000;
LATC = 0b00000000;
LATD = 0b00000000;
LATE = 0b00000000;
SYSTEM_Initialize(SYSTEM_STATE_USB_START);
USBDeviceInit();
USBDeviceAttach();
UART_Init(9600);
RCIF = 0; //reset RX pin flag
RCIP = 1; //high priority
RCIE = 1; //Enable RX interrupt
PEIE = 1; //Enable pheripheral interrupt (serial port is a pheripheral)
INTCONbits.GIE = 1;
int i;
uint8_t Buffer[256];
while(1)
{
LED=0;
if(gN>=1)
{
if( USBUSARTIsTxTrfReady() == true)
{
uint8_t iN=gN;
gN=0;
LED=1;
for(i=0;i<iN;i++)
{
Buffer[i]=UARTreadBuffer[i];
}
putUSBUSART(Buffer,iN);//USB送信
}
}
SYSTEM_Tasks();
#if defined(USB_POLLING)
USBDeviceTasks();
#endif
if( USBGetDeviceState() < CONFIGURED_STATE ){continue;}
if( USBIsDeviceSuspended()== true ) {continue;}
MyCDCBasicTasks();
}
}