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

Hmm getting usb catching commands

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



Joined: 18 Jul 2007
Posts: 427
Location: Montreal,Quebec

View user's profile Send private message

Hmm getting usb catching commands
PostPosted: Wed Sep 19, 2007 9:40 pm     Reply with quote

Hi,

I know that this subject has been discuted alot of times but seriously i tryed doing something more simpler to simply catch a caracter to execute a (in this case) test command.

Code:

#include <18F2550.h>
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL3,CPUDIV1,VREGEN
#use delay(clock=48000000)
#include <usb_cdc.h>
#use  standard_io(A)

BYTE commandstr[5];
BYTE i;

void main(void) {


   usb_cdc_init();
   usb_init();


   while (TRUE) {
      usb_task();


      if (usb_cdc_kbhit()) {
           for(i=0;i<5;++i){
           commandstr[i]=usb_cdc_getc();
           }
         if (commandstr[0]== '1'){
         output_high(PIN_A1);
         }
         if (commandstr[0]== '0'){
         output_low(PIN_A1);
         }
      }
   }
}


PuTTY freeze on login (COM4)
Tryed the echo loopback code, worked #1

i'm using the pic18f2550 via USB with a 12MHZ quartz.

PS: commandstr is a 6 caracters array so i can use longer command in the next time


Thank you,

have a nice day Smile
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