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 CCS Technical Support

Help me source analysis.

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



Joined: 21 Nov 2013
Posts: 25

View user's profile Send private message

Help me source analysis.
PostPosted: Sat Apr 19, 2014 11:21 am     Reply with quote

What are 1 and 2 and USB_DTS_TOGGLE in usb_put_packet(1,out,2,USB_DTS_TOGGLE);
What are 1 and 2 in usb_get_packet(1,in,2);



Code:

#include "CCSUSB.h"

#include <pic18_usb.h>
#include <usb_desc_hid.h>
#include <usb.c>

void main(void){
   unsigned int8 delay = 0;
   unsigned int8 out[2];
   unsigned int8 in[2];
   
   LED_OFF(GREEN_LED);
   LED_OFF(YELLOW_LED);
   LED_OFF(RED_LED);
   
   setup_adc(ADC_CLOCK_INTERNAL | ADC_TAD_MUL_2);
   setup_adc_ports(MY_ANALOG_PORTS);
   set_adc_channel(AN_POT);
   
   usb_init_cs();
   
   while(TRUE) {
      usb_task();
      if(usb_enumerated()) {
         LED_ON(GREEN_LED);
         
         delay++;
         if(delay>=250) {
            delay = 0;
            out[0] = read_adc();
            out[1] = BUTTON_PRESSED();
            usb_put_packet(1,out,2,USB_DTS_TOGGLE);
         }
         
         if(usb_kbhit(1)) {
            usb_get_packet(1,in,2);
            if(in[0]){LED_ON(YELLOW_LED);} else {LED_OFF(YELLOW_LED);}
            if(in[1]){LED_ON(RED_LED);} else {LED_OFF(RED_LED);}
         }
         
         delay_ms(1);
      }
      else {
         LED_OFF(GREEN_LED);
      }
   }
}
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Sat Apr 19, 2014 11:54 am     Reply with quote

where can the source for
"CCSUSB.h"

be located ??

doc:
for the usb_put
usb_get
is in the manual
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 19, 2014 5:17 pm     Reply with quote

Quote:
What are 1 and 2 and USB_DTS_TOGGLE in usb_put_packet(1,out,2,USB_DTS_TOGGLE);
What are 1 and 2 in usb_get_packet(1,in,2);

The description of the parameters for the usb_put_packet() function
is given in the usb_hw_layer.h file. It comes with the CCS compiler
and it's in the following directory on your computer:
Quote:
c:\program files\picc\drivers\usb_hw_layer.h

The function description will tell you exactly what you need.
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