CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

USB to RS232 with USB_DEMO

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Guest








USB to RS232 with USB_DEMO
PostPosted: Sun Jul 01, 2007 10:01 am     Reply with quote

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 :
    129
    130
    131
    132

    33
    134



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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group