Hey, It's mister_e's thread.
I gotta use the dancing WooHoo.
EDIT: And if it weren't for the 40 posts per page, you'd know why we were dancing ...
Pevious post
<br>
Hey, It's mister_e's thread.
I gotta use the dancing WooHoo.
EDIT: And if it weren't for the 40 posts per page, you'd know why we were dancing ...
Pevious post
<br>
Last edited by Darrel Taylor; - 25th August 2007 at 08:53. Reason: 40 Posts/page
DT
Hi,
Im in trouble again..not detecting my usb device..18F4550(compiled successfully).
Iam using 20 mhz 22pf so i modified steve's code like this:
__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
__CONFIG _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H (updated my mplab to 7.60)
tried :
__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC3_PLL4_1L & _USBDIV_2_1L
post # 44(no luck).
and your "http://www.darreltaylor.com/files/USBDemo2_DT.txt" also but
INCLUDE "DT_INTS-18.bas" not found error..
waiting for your reply..
Thank you...
For a 20Mhz crystal ...
>> and your "http://www.darreltaylor.com/files/USBDemo2_DT.txt" also butCode:__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
>> INCLUDE "DT_INTS-18.bas" not found error..
You can download the files from here ...
http://darreltaylor.com/DT_INTS-18/home.html
<br>
DT
[QUOTE=Darrel Taylor;42974]For a 20Mhz crystal ...
Dear Darrel,Code:__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
just tried above code and demo2_dt.txt but no luck..showing "USB DEVICE NOT RECOGNISED"
i'll send you the schematic 2morrow..plz go through it..
using PICKIT2 V2.10 PROGRAMMER (NEED TO CHANGE ANY SETTINGS?)
REGARDS..
Dear Darrel,
Iam happy that succeed in 18f2550 4mhz- 22pf..
Iam still struggling for 18f4550 tried 4mhz-22pf with steves original hex (no luck)... can i have Steve's 4550 code's Schematic.i think its different from my development board..
Thanks & Regards,
I think Steve's original circuit was the same as the schematic at the bottom of the EasyHID page.
http://www.mecanique.co.uk/products/usb/easyhid.html
At least I don't remember him posting a different one.
<br>
DT
Hi,
schematic helped...now its working ..
Thanks to Mister_E for making such a fantastic code..and
Thanks to Darrel Taylor for great support..
Best Regards..
Naga
@Darrel,
Hi,
circuit becomes very slow when i enable all PORTA<5:2> inputs; i mean it responds after some delay, only when i switch on all push buttons..
slowing down including AN<1:0> ADC results in the progress bars..otherwise perfect :-)
Thanks&Regards.
Sir:
I'm also new to USB i was thinking if USB can't handle peer to peer does it mean we can't use newer PICS to interface to one another using USB? I 've learned that USB PICS are only capable of PERIPEHRAL mode but not HOST without any external aid like FTDI? is it possible to daisy-chain 2 or more PICS using onboard USB? I'm starting a project base on easyHID but i need some sort of external controler like hand held control with LCD's, Keypads,-etc. Are other onboard peripherals in the PIC like USART the only way to do it?,with USB already dedicated to PC interface?
Hoping for anyone's enlightenment!!!
Yours Trully,
Ryan
Hi Steve,
I'm revisting USB again and using parts of the demo as a bit of a refresher
Im writing a program where I want to send half a dozen NMEA strings (of varrying string length) which are stored in their own array, to the pc running hyperterminal.
I can send them successfully via USB using 6 separate DoUSBOut subroutines (without the SendUSB macro array code) but I want to trim my code down and use one (1) DoUSBOut routine to do the lot.
->>> I kinda have it working but the received data into hyperterminal appear as though some strings aren't received or are being over written or something.
I've modified the SendUSB macro array so that the USBBufferOut should just keep filling up according to my USBBufferCount (array size) and suspect this is the problem but I'm rusty on ASM. Perhaps the USBBufferOut needs to be "erased" after each visit to DoUSBOut? How would I do that?
I'm going blind looking at this code and wonder if you could see any traps I may have fallen into...
Code:USBBufferCount Var Byte ' USBBufferOut Var Byte[50] ' store outgoing USB data ...... this value originally [8] GPZDA VAR BYTE[28] GPGLL VAR BYTE[41] GPGGA VAR BYTE[49] GPVTG VAR BYTE[27] '...... arrays get filled up here......... '...... other code........ asm SendUSB macro array ; Use to Copy an specific array to USBBufferOut AND send it ; to USB bus variable i=0 ;while i<8 ' ...............original line here........ while i<_USBBufferCount MOVE?BB (array+i),(_USBBufferOut+i) i+=1 endw L?CALL _DoUSBOut endm endasm USBBufferCount = 28 @ SendUSB _GPZDA USBBufferCount = 41 @ SendUSB _GPGLL USBBufferCount = 49 @ SendUSB _GPGGA USBBufferCount = 27 @ SendUSB _GPVTG DoUSBOut: ' ' Send data to the USB bus & Wait for USB interface to attach ' =========================================================== T1CON.0 = 0 ' TURN OFF TIMER WaitPC: ' USBService ' keep connection alive USBOut 3, USBBufferOut, USBBufferCount, Waitpc ' if bus available, transmit data T1CON.0 = 1 ' Re-Enable TMR0 interrupt return
Last edited by Squibcakes; - 17th October 2007 at 07:30. Reason: Other thoughts....
Hi.. i canīt find EasyHid at mecanique webpage, is it gone? how do you get it now? did it became part of some package?
Thanks
Is it possible to use microchipīs bootloader since the driver is different than the one from easyHID?
Havenīt tried but, is it possible to use MCS bootloader (Serial)? i have a version of 4 MHZ for 18f4550 that comes with MCS but i am not sure if this pic program made by Mister_e is runing 4Mhz or more with some PLL (i am newbie with this concept).
Thanks AGAIN.
Last edited by Josuetas; - 25th October 2007 at 14:10.
Hello, i have done great things with this demo from Mister_E Thanks always. Its a great playground
Now i made some changes and created my own device, its working already BUT how do i manage two of the same devices with my software? Where are we choosing one from another? if they both have the same ID, etc?
Thanks for your replies,
DJC
Thanks to Mister_E's USB demo and DT's ints18 and this forum I have my USB board PICF4550@ 48 Mhz running a single DS1820 displaying on VB6 and it took less than 1/2 a day and its stable and fast!
This is my first post and I would like to congratulate this forum for the information that is available and the generosity of people like mister_e and darren taylor and others for sharing their experience;it is invaluable for me
This demo should be pinned!
First of all, I would like to thank everybody here.,especially, Mister_E, Darrel Taylor and Squibcakes. I have downloaded the usbdemo and it works great.
I have programmed the pic while including the line INCLUDE "CDCDESC.ASM" in USBDESC.asm.
But I could not use this with VB6 with MSCOMM1. Namely, I want to use as CDC the given VB6 code. Please could you help me?
Thanks,
Selim
@selimkara
is there any specific reason why you really want to use CDC ?
@Josuetas
There's probably few way to do what you want, using something like a header. Such HSERIN WAIT(YourHeader) so when you receive/send data, you may want to check/set few or only one Byte. Then the Slave/Master do what he has to do if the header match.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks for your rapid response and interest. We are working in Physics dept. at Trakya University. Our aim is to control some experimental structures (for example temperature, light intensity...). To do so, we need a less complex and short VB6 procedure. I think using virtual comm port is very useful to do this. Am I wrong? We had succeeded similar connection, using CDC via MSCOMM in VB6 with a short code. But in pic side, we could not set interrupts. Your code(pic) is very useful and simple. So we want to use your pic code and change your VB code to adapt MSCOMM (virtual comport). You may ask why we don't use serial comm.because there's no comm port on new laptops, so we must learn to use USB.
If I'm not misunderstand, in the following conversation (#36) between you and Squibcakes, Squib reported that he succeeded this. I would like to know how? I think some changes must be made at pic code. If you or squib have tips about this or have complete codes, I'd be grateful. Thanks for your previous suggestions. We'll also utilize them.
sincerely
Selim
#36---------------------------------------------------
Mr_E
Yeah ok well thanks for your input anyway - always welcome I'm happy to edit the the .inc file and leave it at that.
Great news! I finally got the CDC virtual comport working!!!!!!
Now I can send data via USB (virtual comport) and out of the Pic 18F4550 USART! and vice versa!
-------------------------------------------------------
I'm stoked that this actually works!
Squib
The post was regarding setting the config fuses by way of changing the 18f4550.inc file.
I never actually used CDC with the USB demo, totally separate and apart
As Steve said, you don't need to use CDC to send you data back to the PC. This code uses HID interface and the VB program displays the data coming from the PIC.
As far as VB is concerned I have no clue - One day I should learn it!
Squib
Selim,
Maybe I missed something in the conversation,
But this might be what you're looking for ...
USB CDC Communications for Dummies! (Squibcakes)
http://www.picbasic.co.uk/forum/showthread.php?t=5806
<br>
DT
Ok. Thanks everybody. I think that was a stupid idea. I'll use and develop UsbDemo. Thanks Steve, Darrell and Squib.
Bye
Hi.
To Mister_E or anyone that really understand this (i clearly donīt). I made this post already but none seemed to understand it, so i am posting again in other words.
I made this software that controls an USB device, it all began with Mister_E`s demo, it is working really fine now, no problems with it. NOW i want to use two devices, same software!. Lets say this is a temperature sensor, now i want to measure two diferent points so i wanīt to connect two diferent sensors. HOW can i differentiate both devices? when i connect the second one the first connected gets useless (I am sure the handler is replaced).
Iīve been reading the whole code for Visual Basic and PBP, i donīt intend to change my device ID and Product ID.. this would be useless. Does the Driver easyHID only works with one device?
Please give me a little advice on this matter.. How can i use two different handlers?
Thanks
DJC
2 different ways
1) assign, then read the device serial number -> this has to work
2) use a specific data byte in DataToSend as identifier -> not 100% sure of it
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi.. thanks for your reply Mister_E.
I have this problem with both solutions!... i dont have two working devices when i connect them... i just have one! When i connect the second one the first connected doesnīt work!
My guess is that this happens because the handler of the first connected device is lost and replaced for the second one.. hence my sent data (from pc to device) is just received in one of the ports (this is for sure!) so it wouldnīt work to use the serial number because i canīt even get it :s.
The same reason for the second choice.
I also think that both devices could have exactly the same software, my guess is that this is a matter of software (in VB), there should be a way to create two different connections (what i call handlers) but i donīt get where this is done in the code Sub ConnectHID().
Again maybe i am thinking this wrong but this is what you would do with two diferent serial devices in different serial ports, you would have two different interrupt routines in the VB software to control each one.
I really hope someone could guide me here, has none connected two devices?
Thanks again for your time and concern,
DJC
i already done that... i just need to find out where... i had to do some unwanted Hard-Disk clean-up recently... i hope i still have it somewhere, unless i may try to redo it once again.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi!
I was hoping somenone could give any ideas on my subject, its been more than a week and no post here, You donīt have to know the solutions... lets just talk about your oppinions or ideas
Thanks for any help
i already gave mine, maybe yu could check on wich hub/port a specific device is connected... i just don't have any spare time... but i could deal with few K-CAN$
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I can't speak for Visual Basic, but in Delphi, you request a list of HID devices, and each one has it's own "Handle".
If two devices have the same Vendor/Product ID's then you look for the serial number to tell the difference. But access to the device is by specifying the Handle.
Here's a small program that can identify the serial number and handle. Note: the handle changes on every connection or power-up/re-boot.
www.pbpgroup.com/files/HIDmonitor.exe
Put it anywhere, there is no installation to do.
<br>
DT
same rules apply with any language, look at the mcHID API reference. But seems NOBODY want to use the serial number... no matter why they suffer
Nice utility Darrel!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Well, if there was an easy way to do it, it might look more attractive.
Running EasyHID or manually editing the descriptor file each time doesn't seem like an option.
Maybe there's a way to have the descriptor file read the Hardware Serial number, then have the programmer auto-increment the serial number, ... but it doesn't currently have that feature.
Other than that, since you can find the handle of each device with the same Vendor/Product ID, within your software you can create a Challenge/Response type arrangement that will let the computer assign a unique number to any new devices on the BUS.
Thanks Steve,Nice utility Darrel!
It's come in handy a few times troubleshooting USB connections.
Thought I'd spruce it up and pass it on.
<br>
DT
On another forum someone already Suggest USBDeview. I use it a lot, it's a real nice utility ...
http://www.nirsoft.net/utils/usb_devices_view.html
They also have bunch of other nice freebies over there...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
well... when you did that utility... wasn't it to learn something ?
And i'm sorry... i thought i posted that link before.. oops!
It's still a nice utility you've made so far!
Last edited by mister_e; - 1st December 2007 at 01:01.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Excellent point! That's exactly what it was.
That program started from my attempt at modifying the USBDemo program from VB to Delphi.
It's based on the Delphi routines supplied by David Barker in the EasyHID results.
It's only right that I posted it here,... along with the reason I even know about USB. (USBDemo)
<br>
DT
if i find time, i may elaborate USBDemo a little bit more, but you know how busy i am right now with some current project + that ASM one
For some spare time... my new toys... Delphi, EasyDsPIC 4, PoScope and PIC32s
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Ok i will use Darrelīs exe program.
I know it will not be exactly the same for VB but if there is any chance that you could post the source code i would finally see how itīs done!
I am sure i can do with just the handler, i could also identify wich device was connected first and have a record of devices....
This would be a great place to begin
Thanks for your replies
DJC
Thank You!<hr>Originally Posted by Josuetas
Looking at the VB side of USBDemo
Using the line shown in red, anytime a device is plugged in with the same Vendor/Product ID, it will forget about the last device and start using the new one.Code:Public Sub OnPlugged(ByVal pHandle As Long) ' ' A HID device has been plugged in, ' check if it's the right one, and enable the form LED (top left) ' Dim DeviceHandle As Long Dim VendorName As String * 15 Dim ProductName As String * 15 If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then ' Good one? ' ' get the device handle ' ===================== DeviceHandle = hidGetHandle(VendorID, ProductID) ' ' Get the vendor and product name from the handle ' =============================================== hidGetVendorName DeviceHandle, VendorName, 255 hidGetProductName DeviceHandle, ProductName, 255 ' ' Enable the LED and display device information ' VendorName and ProductName ' ============================================= imgON.Visible = True lVendorName.Caption = VendorName lProductName.Caption = ProductName End If End Sub
To get around that, you need to check further to make sure it's the device you want to talk to. And, for that, you need to search through the HID Device list.
Again, I don't do VB, so the syntax is most probably wrong. But ...<hr>
The function hidGetItemCount returns the number of HID devices in the List.
Then hidGetItem(Index) returns the handle of the item in the list that's specified by Index (0 to count-1).
You can get the info about that device by requesting each field.
Vendor = hidGetVendorID(handle)
Product = hidGetProductID(handle)
Serial = hidGetSerialNumber(handle)
Now if everything matches, you know you have the right one. If not, keep searching through the list.
If you're not using the Serial Number, you'll need to send/receive something to the device to figure out if it's the correct one.
Is that any help?
I'll keep trying if not.
<br>
Last edited by Darrel Taylor; - 1st December 2007 at 23:18. Reason: added "hid" to function names
DT
Steve, do I need the 18f4550 or any other USB pic for your USB project? or can I do it with a standard pic, like the 18f452?
Atwoz, only USB PIC will work!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks