Guest
|
USB to RS232 with USB_DEMO |
Posted: Sun Jul 01, 2007 10:01 am |
|
|
Hi everyone,
I tried to configure the USB demo board as a simple COM port for Windows ( with the usb_cdc ) but some characters are missing :
Does anyone have any idea why I do have this problem and also how to correct it ?
Compiler : CCS PCH C Compiler, Version 4.042, 39388 01-juil.-07 17:25
Here is my test code :
Code: |
#include <18f4550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN
#use delay ( clock=48000000)
#define LED1 PIN_A5
#define LED2 PIN_B4
#define LED3 PIN_B5
#define BUTTON PIN_A4
#define LED_ON output_low
#define LED_OFF output_high
#use RS232 (baud=38400, UART1 ,PARITY=N, BITS=8 )
#include <usb_cdc.h>
void main ( void ) {
char c;
unsigned char k;
LED_ON ( LED1 );
LED_OFF ( LED2 );
LED_OFF ( LED3 );
usb_init();
printf ( "Program loaded !\n" );
while ( TRUE ) {
if ( usb_enumerated() ) {
LED_ON ( LED3 );
while (!usb_cdc_putready()) {
}
printf ( usb_cdc_putc, "\n%u", k);
k++;
delay_ms ( 50 );
output_toggle ( LED1 );
}
else
LED_OFF ( LED3 );
}
}
|
Dimmu. |
|