Hi,
I am looking to connect a PIC18F4550 to the USB port of a Windows based PC. Is there a step by step guide to doing this. The hardware is sorted, and the software in the PIC is done. I'm using the USB serial component to send bytes to the computer to be read in and used in the PC to make some decisions and then data must be sent out from the PC back to the PIC. Anyone done something like this or is there a tutorial out there? I need to know how to get the PC to reliably connect to the PIC and driver installation etc.
Thanks in advance...
USB with PIC18F4550
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: USB with PIC18F4550
Hello,
It largely depends on what you want to write the windows software in. VB6, VB.net C# and Java would all be viable options. Pick a language and then try to find some COM port tutorials simple enough to help get you started.
We have some examples written for VB which should be available on the website. Let me know if you can't find them and I will have a dig around.
Lavbiew is a language I have used a few times as it's easy to use, creates standalone exe's and comes with COM port functionality but it is very expensive and the graphical "wires" can be a pain to align and not be a mess. There is a free trial available.
Java is something I am using a lot in my spare time at the moment thanks to Android. I like it but it also has it's quirks. One massive upside is that one code base should run on almost any platform which you won't get with VB.
It largely depends on what you want to write the windows software in. VB6, VB.net C# and Java would all be viable options. Pick a language and then try to find some COM port tutorials simple enough to help get you started.
We have some examples written for VB which should be available on the website. Let me know if you can't find them and I will have a dig around.
Lavbiew is a language I have used a few times as it's easy to use, creates standalone exe's and comes with COM port functionality but it is very expensive and the graphical "wires" can be a pain to align and not be a mess. There is a free trial available.
Java is something I am using a lot in my spare time at the moment thanks to Android. I like it but it also has it's quirks. One massive upside is that one code base should run on almost any platform which you won't get with VB.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: USB with PIC18F4550
Serial port access in Java tends to be less portable and can be a pain...
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 444
- Joined: Tue Apr 15, 2014 4:19 pm
- Location: Kajaani, Finland
- Has thanked: 345 times
- Been thanked: 227 times
- Contact:
Re: USB with PIC18F4550
I personally love using python for serial port access to interface to my MCU-projects and to configure systems like one motorcycle no-need-for-clutch system i have created a serial GUI-program that talks directly to the PIC 16F88 using usb-to-serial bridge.
Python has it benefits and disbenefits, like timing on serial communication can be a pain, but the code is easy to learn and understand so there is no need to be most greatest programmer with it. And by using flowcode to local serial port to bind, i could run flowcode software "simulation" on my computer, and i have looped my PCI Serial cards COM2 Tx to COM3 Rx and COM3 tx to COM2 rx so i can test my code and program without any real hardware
Python has it benefits and disbenefits, like timing on serial communication can be a pain, but the code is easy to learn and understand so there is no need to be most greatest programmer with it. And by using flowcode to local serial port to bind, i could run flowcode software "simulation" on my computer, and i have looped my PCI Serial cards COM2 Tx to COM3 Rx and COM3 tx to COM2 rx so i can test my code and program without any real hardware
Ill just keep the good work up!
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: USB with PIC18F4550
I have recently been playing with this as well. I created a sample desktop app with Visual Studio Community 2015 starting from a C++ "Dynamic CDC Demo" When I get back to it, I still need to work out the most efficient method on each end to stream 2 or 3 data variables to the PC without slowing down my program loop too much.
This was just a little playing to see what kind of things I could do.
edit: The lower pic is how the CDC example looks out of the box. The values displayed in my app involve some math on the PC side as I am not using floats or division in my FC code due to limited program memory.
Windows 10 connected without asking for a driver.
This was just a little playing to see what kind of things I could do.
edit: The lower pic is how the CDC example looks out of the box. The values displayed in my app involve some math on the PC side as I am not using floats or division in my FC code due to limited program memory.
Windows 10 connected without asking for a driver.
- Attachments
-
- App.jpg (44.67 KiB) Viewed 5958 times
-
- CDC Demo.jpg (19.69 KiB) Viewed 5958 times
-
- Posts: 170
- Joined: Sat Dec 10, 2011 7:21 pm
- Location: Canada
- Has thanked: 20 times
- Been thanked: 52 times
- Contact:
Re: USB with PIC18F4550
Ensure that your VID and PID match on both ends and that the baud rates are comparable. As stated, although I had created one via FC, Win 10 did not request a driver. I will be using this with a 18F45K50.