Custom USB HID functions

General discussion on mikroC.
Post Reply
Author
Message
nikhiljain
Posts: 2
Joined: 24 Feb 2011 16:45

Custom USB HID functions

#1 Post by nikhiljain » 25 Feb 2011 15:52

I want to create my own USB HID functions for PIC18F4550 in MikroC. I do not wish to use the HID Library routines (Hid_Enable,
Hid_Read etc) which are already available with the compiler. Can anyone help me with this or where can I find some documentation for making custom HID functions in MikroC?

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: Custom USB HID functions

#2 Post by tihomir.losic » 01 Mar 2011 16:12

Hello,

you can create your own library for your requirements.

Making new library:

- follow the steps explained in the Help file, and read in detail the explanation provided there. I have also very clearly described what you should do with the library:
1. Copy the original __Lib_Example.mcl in your Uses folder (P18 for PIC18F4550)
2. Open P18F4550.mlk file and add the following code in the appropriate section:

Code: Select all

<LIB>
  <ALIAS>Example_Library</ALIAS>
  <FILE>__Lib_Example</FILE>
  <TYPE>REGULAR</TYPE>
</LIB>
3. In LibraryExample.mcppi project, select (if already isn't) PIC18F4550 MCU, and in the Library Manager click on the button
Rebuild libraries and your Example_Library will appear, with it's three functions
4. Click on this library to include it in the project.
5. Remove __Lib_Example.c from Project settings window, because it is not needed anymore (it is loaded via it's .MCL file)
6. You can also remove the following section in the code:

Code: Select all

//************************************
extern void BlinkLED_1(int Delay);  // These lines won't be necessary when
extern void BlinkLED_2(int Delay);  // you create library entry in .MLK file
extern void Example_Init();         // as described in Help file
//************************************
7. Rebuild the project
pat.afix78 wrote:Or could you please tell me if any development is planned in your next versions of MikroBasic ?
I will pass that suggestion to our developers,
they will take this into consideration in our future development.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

nikhiljain
Posts: 2
Joined: 24 Feb 2011 16:45

Re: Custom USB HID functions

#3 Post by nikhiljain » 02 Mar 2011 11:00

thanks a lot.. i'll try it.

Post Reply

Return to “mikroC General”