Hello everyone
I am going to design a project using C# application. and I want to use USB_HID PIC18F4550 as a dongle license for my C# application.
For more details, I need to send string word from USB_HID to my PC and then read it by C# application. This string word I will use it as Key a license for my application.
Please, can someone help me?
Thanks in advance
Have you set the VID and PID properly ? Zip and post your complete VC#.Net and mikroC PRO PIC project files with Proteus file if any. What USB HID component are you using to communicate with VC#.Net application ?
unsignedchar readbuff[64] absolute 0x500;// Buffers should be in USB RAM, please consult datasheetunsignedchar writebuff[64] absolute 0x540;//---------------------------------------------------------------------------------------------------void interrupt(){
USB_Interrupt_Proc();// USB servicing is done inside the interrupt}int i =0;char key[]="abcd";void main(void){//-----------------------------------------------variable area--------------------------------------
trisb=0;// port as output
portb=0xff;
trisc=0;
ADCON1 |=0x0F;// Configure all ports with analog function as digital
CMCON |=7;
HID_Enable(readbuff,writebuff);// Enable HID communicationwhile(1){strcpy(writebuff, key);while(!(HID_Write(writebuff,64));}}
If you just send key as say string abcd or defg then anybody can capture USB data and find out the key. So, you have to encrypt your key say adcd to say ntpq and send it to VC# app and in VC# app you have to decrypt the ntpq key back to abcd and then check if key is adcd and if it is then you have to unlock features in your VC# app. This is for simple dongle. Try to use minimum 64 characters for the key.
I asked you which USB HID component (.dll file) are you using to communicate with VC#.net application. I also asked you to post your VC#.Net project if any.
Also dongle needs to be small and compact. If the only purpose of the dongle is for licensing of the software then why do you want to use the bigger PIC18F4550 ? Why can't you use PIC18F2550 ?
- - - Updated - - -
The code of the C# depends upon which USB HID component (.dll) you are using for USB HID communication. We need to know this to provide you C# code or guide you.
Some of the USB HID components are
mcHID.dll
USBHIDNetCalss.dll
I think mcHID.dll only works with VB.Net.
USBHIDNetClass.dll works with VB.Net and VC#.Net and you need a license to use it. There is a demo version of it for downloading but it pops up a demo message once every few minutes.