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

CCS CDC ehco problem

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



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

CCS CDC ehco problem
PostPosted: Fri Sep 01, 2006 10:26 pm     Reply with quote

Hello, all. I have got one of my devices working with the CDC driver. The problem in that when i type somthing onto hyperterminal, the pic will ehco each keystoke back. This is not the local echo option because if i enable that option in hyperterminal, i will get two sets of echo eg 220000 when i type 200.

Can anyone help me here??

Thanks, Mark

Code:

include <18F4550.h>

#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN,NOBROWNOUT
#use delay(clock=48000000)

#define USB_CON_SENSE_PIN PIN_A3

#include <usb_cdc.h>

int USB_req;


void main(void)
   {
      usb_init();

      while (TRUE)
         {
            if (usb_cdc_kbhit())                           
               {
                  USB_req = get_int_usb();
                  if (USB_req == 201)                  
                     {
                        printf(usb_cdc_putc,"ok\n");
                     }
                  else
                     {
                        printf(usb_cdc_putc,"200\n");
                     }   
               }   
         }
   }

PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 01, 2006 11:24 pm     Reply with quote

Find the function get_int_usb() shown in bold below, inside the
usb_cdc.h file. Look at its code. It calls the get_string_usb() function.
What lines of code in get_string_usb() could cause your problem ?

Quote:

if (usb_cdc_kbhit())
{
USB_req = get_int_usb();
if (USB_req == 201)
{
printf(usb_cdc_putc,"ok\n");
}
else
{
printf(usb_cdc_putc,"200\n");
}
}
}
Markdem



Joined: 24 Jun 2005
Posts: 206

View user's profile Send private message Send e-mail

PostPosted: Sat Sep 02, 2006 12:56 am     Reply with quote

Thank you PCM, i dont know how i missed that.

Thanks, Mark
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