I have a MP program that works well sending/receiving USART / RS232 data to a PC.
Any suggestion on how to convert it to USB, I mean, there is a simple way to simulate a serial rs232 port thu USB?
USB x RS232
USB x RS232
Last edited by joseLB on 11 Oct 2006 23:02, edited 2 times in total.
Hi joseLB,
what exactly would you like to do , if you use a PIC with USB interface you can convert serial to USB and the other way around , mPascal however does not deal with the PC-side software , for that you will have to build your own. You can however test it with the provided HID terminal. If you need a virtual comport implemented on USB this has nothing to do with programming the PIC.
what exactly would you like to do , if you use a PIC with USB interface you can convert serial to USB and the other way around , mPascal however does not deal with the PC-side software , for that you will have to build your own. You can however test it with the provided HID terminal. If you need a virtual comport implemented on USB this has nothing to do with programming the PIC.
thanks jpc
Being more specific:
1- if I use HID routines provided with MP, I imagine that at the PC side things will be more complex, as I will have probably to develop some very specific interface USB /HID. I have no idea on how to deal with that. So, my question 1: Do you ave any tip or where I can find something about USB/HID/drivers, etc. at PC side? No matter the language.
2- on other hand, if I simulate on PIC serial rsr232 via USB, on PC side I guess I will have only to create a virtual com port, so, I will not need to develop anything else? So, my question 2: do you know how to do RSR232 thru USB simulation on PIC/MP?
3- today I have working a PIC/MP with real RS232 conected to a PC where I did a program to comunicate via RS232 and would like to do it thru USB. My question 3: is better to use HID (simpler PIC changes? / big PC changes?) ou RSR232 simulation (big PIC changes? / low PC changes?). That's the real question. As I have no idea of the dificultie to do rs232 simulation at PIC/MP neither the dificultie of doing HID at PC, I need all your help
Of course, i could use a USB x serial converter board, but that's the last solution, only if things start to become complex.
Thanks Jose
jose
Being more specific:
1- if I use HID routines provided with MP, I imagine that at the PC side things will be more complex, as I will have probably to develop some very specific interface USB /HID. I have no idea on how to deal with that. So, my question 1: Do you ave any tip or where I can find something about USB/HID/drivers, etc. at PC side? No matter the language.
2- on other hand, if I simulate on PIC serial rsr232 via USB, on PC side I guess I will have only to create a virtual com port, so, I will not need to develop anything else? So, my question 2: do you know how to do RSR232 thru USB simulation on PIC/MP?
3- today I have working a PIC/MP with real RS232 conected to a PC where I did a program to comunicate via RS232 and would like to do it thru USB. My question 3: is better to use HID (simpler PIC changes? / big PC changes?) ou RSR232 simulation (big PIC changes? / low PC changes?). That's the real question. As I have no idea of the dificultie to do rs232 simulation at PIC/MP neither the dificultie of doing HID at PC, I need all your help
Of course, i could use a USB x serial converter board, but that's the last solution, only if things start to become complex.
Thanks Jose
jose
There is a software from "mecanique" called "EasyHID" which you can use to generate Delphi / VB / VC++ code for handling HIDs.
h**p://www.mecanique.co.uk/software/EasyHID.zip
Good luck.
h**p://www.mecanique.co.uk/software/EasyHID.zip
Good luck.
There are 10 types of people in the world. Those who can read binary and those who can't.
Thanks dave, I would apreciate very much your help, if you can send it. While Delphy is not my target (I'm using AutoIt at PC side), I think it can help. It can be sent at " joselb AT globo.com "davekill wrote:Hi Jose,
I can send you my test application that I use to send messages to the PIC and retreive my software debug information. The code is not very tidy, but I will help if you have any questions. You will need the HID components that are part of the JEDI Delphi library.
Dave.
Jose
I'm seeing that to write USB code is a kind of very complex thing, even to get information. Good times the RS232 ones....
I can't believe that there is not a thing like command line programs, or even the code of part of the code From MikroE's HID TERMINAL...
Thanks drdelphi, I downloaded the code, but as it's a instalable program and as i'm somewhat paranoic int install programs in my PC, do you have any documentation on this program?drdelphi wrote:There is a software from "mecanique" called "EasyHID" which you can use to generate Delphi / VB / VC++ code for handling HIDs. h**p://www.mecanique.co.uk/software/EasyHID.zip
Good luck.
I took my chances and I installed it. With slight modifications I made it work with the demo of HID for 18f4550 that comes with mP. If you want I can mail you the source code in Delphi or give you the compiled version.
There are 10 types of people in the world. Those who can read binary and those who can't.
I would apreciate very much if you could email me the source in delphi. joselb AT globo.comdrdelphi wrote:I took my chances and I installed it. With slight modifications I made it work with the demo of HID for 18f4550 that comes with mP. If you want I can mail you the source code in Delphi or give you the compiled version.
Thanks, drdelphi, I received your zip. Now, of course, the doubs;drdelphi wrote:sent. everything you type in Edit1 will be forwarded back by the pic to Memo1.
1- mcHID.dll : this dll is a standard windows dll, or where I can get it?
2- the main form is atctivated when an USB event ocurrs?
3- the efective reading or writing is very simple, once your get the DevHandle of the device. An to get it seems to be very simple also
Sorry, I've just noticed that mcHID.dll was missing. I found it in c:\program files\mecanique\easyhid\mchid.dll , but since you don't want to install easyhid yourself, then I'll send you the dll by mail.
As for the 2nd point, not the main form is activated when an usb event occur, but :
- first you hook the function USBEvent, which will receive all the system messages
- the USBEvent function will be called each time a system message occurs, and it will filter the messages, looking for USB HID messages
- then it will look if it's a "plug" message or "unplug"
- in the end, it will check if the device generating the event is the one it's looking for. To do that, it compares the VendorID and ProductID
You can change the values of the constants VENDOR_ID and PRODUCT_ID in the "const" section of FormMain.pas, but don't forget to also change these values for the pic side.
good luck
As for the 2nd point, not the main form is activated when an usb event occur, but :
- first you hook the function USBEvent, which will receive all the system messages
- the USBEvent function will be called each time a system message occurs, and it will filter the messages, looking for USB HID messages
- then it will look if it's a "plug" message or "unplug"
- in the end, it will check if the device generating the event is the one it's looking for. To do that, it compares the VendorID and ProductID
You can change the values of the constants VENDOR_ID and PRODUCT_ID in the "const" section of FormMain.pas, but don't forget to also change these values for the pic side.
good luck
There are 10 types of people in the world. Those who can read binary and those who can't.