Page 1 of 1

MX015 - Basic USB Communications for PIC

Posted: Wed Feb 25, 2009 1:23 pm
by Benj
Article: http://www.matrixmultimedia.com/resourc ... php?id=379

If you have any questions for the author or comments on the article, please post them below.

Re: USB Comms using EB006 / HP488 Programmer Boards

Posted: Fri Mar 11, 2011 11:46 pm
by randomrichard
Hello
Thanks for the tips on configuring the 18F4550. I now have no problem with sending or receiving bytes using its USB serial port. However, I can't get past a difficulty with your 'USB serial string demo.fcf' example. In the Flowcode4 example I downloaded the "Read String from USB" macro properties has '100,test, 64' in the Parameters box and 'x' in the Return value: (STRING) box. Now that's three parameters and a byte value so if I press OK F4 says there is an error, not surprisingly. I tried replacing those entries with '100, 64', and 'test', but that didn't work either although it compiled OK. Help , please.

Re: USB Comms using EB006 / HP488 Programmer Boards

Posted: Mon Mar 14, 2011 1:52 pm
by Benj
Hello,

I have looked at the example and fixed it so it will work correctly with the current version of the component.

Re: USB Comms using EB006 / HP488 Programmer Boards

Posted: Mon Mar 14, 2011 3:44 pm
by randomrichard
Ben
Thanks for your help. It works fine now and I should be able to work out why. Now for the two-way comms...

Richard

Re: MX015 - Basic USB Communications for PIC

Posted: Thu Aug 25, 2011 1:21 am
by jose
Hello Ben,
Do you have any example for a PC USB keybord?
Or can you give some tips how to..?
Thanks

Re: MX015 - Basic USB Communications for PIC

Posted: Thu Aug 25, 2011 10:09 am
by Benj

Re: MX015 - Basic USB Communications for PIC

Posted: Fri Aug 26, 2011 12:24 am
by jose
Hello Ben,
I see now, thanks.
I'm having trouble communicating with the pc: detects but does not recognize the USB device (?)
I could not find the article "communicating with the PC" referred to in MX015.pdf, to have some help about hyper terminal and USB

Re: MX015 - Basic USB Communications for PIC

Posted: Fri Aug 26, 2011 9:41 am
by jose
Ben,
Will it be possible for you to give a small exemple of reading a key from a PC USB keyboard into a variable?
It will be a great help
Thanks

Re: MX015 - Basic USB Communications for PIC

Posted: Fri Aug 26, 2011 9:58 am
by Benj
Hello Jose,

Does the device appear in the device manager as an unknown device or does it go into the HID section as a HID device?

If your getting the unknown device problem then its likely that either your configuration or clock speed is off. Could you post up your program and I will have a look for you.

Regarding reading a key from the keyboard into a variable, would this be on the PC? You mention hyperterminal, do you instead want a serial keyboard rather then a HID keyboard?

Communicating with a PC article is available here.
http://www.matrixmultimedia.com/mmforum ... =26&t=4793

Re: MX015 - Basic USB Communications for PIC

Posted: Wed Aug 31, 2011 1:19 pm
by jose
Hello Ben,
I was using a 4 MHz crystal, then i change it to 24MHz and it is working (some times not)
the file i'm using is your Ex2.keyboard. i will try others configuration speeds.

The example I need is to connect a real USB keyboard to the chip and read hex or decimal key value to a variable and then display it on a LCD or something else

Thanks
jose

Re: MX015 - Basic USB Communications for PIC

Posted: Thu Sep 01, 2011 3:04 pm
by Benj
Hello Jose,

Im afraid connecting a USB device such as a keyboard to a chip is not possible as USB host hardware is required. Devices supporting the USBotg peripheral should allow this but the Flowcode components do not currently support USBotg so you may have to refer to one of the Microchip examples. I have a Flowcode example program for reading a PS2 style keyboard if this is any good to you.

Re: MX015 - Basic USB Communications for PIC

Posted: Thu Sep 01, 2011 4:25 pm
by jose
Hi Ben,
Ok i will try with Microchip examples.
I guess you mean PS2_key and PS2_key2 files, i have those but they gives this error:
" Error: Unresolved external function:'sendByte(unsigned char)". The strange thing is that i remove all references to "sendByte and error remains.
If you solved this or have any other file, yes please..
Thank you

Re: MX015 - Basic USB Communications for PIC

Posted: Thu Sep 01, 2011 4:35 pm
by Benj
Hello,

Here are the most recent source files I have for the PS2 keyboard. The C file has to be in the same directory as the Flowcode project file to work correctly.

Re: MX015 - Basic USB Communications for PIC

Posted: Thu Sep 01, 2011 4:39 pm
by Benj
Just had a quick compile and gotten the same sendByte error message. I will have a look through and see if I can dig out this function.

Re: MX015 - Basic USB Communications for PIC

Posted: Mon Sep 05, 2011 7:43 pm
by jose
Hi Ben,
I finished this litlle ps2 keyboard program
http://www.matrixmultimedia.com/mmforum ... =26&t=8870

Regards
jose

Re: MX015 - Basic USB Communications for PIC

Posted: Tue Sep 06, 2011 9:59 am
by Benj
Hi Jose,

Looks great many thanks for sharing :D