USBDemo, something to learn USB a little bit - Page 2


+ Reply to Thread
Page 2 of 7 FirstFirst 123456 ... LastLast
Results 41 to 80 of 279
  1. #41
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    <table><tr><td></td><td>Newbie mistake from me... At least heaven's voice saved the day </td></tr></table>
    Last edited by mister_e; - 22nd February 2007 at 01:41.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #42
    Join Date
    Sep 2006
    Location
    Australia
    Posts
    5

    Default

    Quote Originally Posted by Squibcakes View Post
    Bravo, Bravo, Bravo!!!

    Steve that EasyPic 4 board looks fantastic! I see that it has an add on PLCC programming kit but in your experience can it program the PIC18F4550??

    Has anyone made a test PCB for this yet and willing to post on site?

    Cheers
    Squib.
    Hi Squibcakes,
    I have an older model 'EasyPic3' and i have no problem to program PIC18F4550. It is a great board and I ma glad owning one.
    Cheers
    Ozion

  3. #43
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    <img src="http://www.pbpgroup.com/files/zombie2.gif" align=middle> &nbsp; &nbsp;Heaven you think?
    Goood..., then you won't notice when I come to collect your PBP soul.

    <div style="background-color:#000000"; layer-background-color:#000000;></div>
    DT

  4. #44
    Join Date
    Feb 2007
    Posts
    9

    Default

    Many thanks!!! Got it working, now I'll proceed to port it for my purposes.

    I've change the 2 lines and one thing more

    __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC3_PLL4_1L & _USBDIV_2_1L
    __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEM_OFF_1H & _IESO_OFF_1H

  5. #45
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Curious,

    That means the CPU is running at 24mhz.
    Why not run at 48mhz, since it's available.
    _CPUDIV_OSC1_PLL2_1L
    <br>
    DT

  6. #46
    Join Date
    Feb 2007
    Posts
    9

    Default

    because windows don"t detect the hardware at 48MHz

  7. #47
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Sure it will!

    Did you have...

    DEFINE OSC 48

    I use 48mhz CPU with USB without any problems.
    <br>
    DT

  8. #48
    Join Date
    Feb 2007
    Posts
    9

  9. #49
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    I can't make it NOT recognize the device when the OSC is 48 with 20mhz crystal.

    Did you increase the size of the VUSB cap like mister_e suggested?

    The way you have it now, the CPU is running at 24mhz. But, PBP thinks it 48mhz because of the DEFINE OSC 48. Any Time related statements will take twice as long.

    If you are going to leave it at 24mhz? You should change to
    DEFINE OSC 24

    But I'd suggest trying 48 again.
    <br>
    DT

  10. #50
    Join Date
    Feb 2007
    Posts
    9

    Default

    Yup I've changed the cap to 220nF
    I've tried many configurations

    20MHz Crystal
    __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L ;with OSC 48 ; NON-WORKING
    __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC3_PLL4_1L & _USBDIV_2_1L ;with OSC 24 ; WORKING

    4MHz Crystal
    __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L ; with OSC 48 ; NON-WORKING ;Original post
    __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC3_PLL4_1L & _USBDIV_2_1L ; with OSC 24 ; WORKING

  11. #51
    Join Date
    Feb 2007
    Posts
    9

    Default

    I've seeking all the day to find the solution, I thus don't find it now I would continue to use it under 24MHz
    But now I am occupied to migrate the code from VB6 towards VB.NET 2005 but I have a problem. I suppose that the post here is not welcome ?

  12. #52
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    unless you have a faulty PIC, a faulty OSC , or your Vusb cap it too low (or bad), it have to work AS IS.

    Windows XP or Vista?

    Connected on a USB HUB or not?

    For the code conversion i can't help, i still use VB6. Start a new thread, maybe some could give you some tips.
    Last edited by mister_e; - 24th February 2007 at 15:45.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  13. #53
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Exclamation EasyHid Output Files

    Hi mr_e,

    I'm learning how to use Easy HID, and have a question about the PBP output files.

    If I copy the files into the same folder as as your demo files (using same names etc) and then run, the push buttons don't have an effect and the 2 var POTS don't work, LEDS and PWM are ok.

    After doing a compare with your original files and the easy HID output the difference is in the DESCUSBDemo.asm file.

    There are two lines that perhaps you have manually modified?? They are in the **** INPUT OUTPUT REPORT ***** sections, specifically:

    Code:
        ; report count (number of fields)
        retlw	0x95
        retlw	0x08
    Why have you have changed the value from EasyHIDs default of 40 to 8?

    Once changing the value from 40 to 8 my EasyHID files work with your VB program.



    Cheers
    Squib

  14. #54
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130

    Thumbs up Outstanding!

    Great job Steve! I have your program running great on a MELABS LABXUSB board, I just took out your asm section for the config fuses (I'm running a 20 MHz crystal,) since my .inc file was already set up for 20 MHz, and changed portb to portd. The LABXUSB board has some leds on portd already. Works great! Thanks for getting us started with USB.

    Jerry.

  15. #55
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Quote Originally Posted by Squibcakes View Post
    Hi mr_e,

    I'm learning how to use Easy HID, and have a question about the PBP output files.

    If I copy the files into the same folder as as your demo files (using same names etc) and then run, the push buttons don't have an effect and the 2 var POTS don't work, LEDS and PWM are ok.

    After doing a compare with your original files and the easy HID output the difference is in the DESCUSBDemo.asm file.

    There are two lines that perhaps you have manually modified?? They are in the **** INPUT OUTPUT REPORT ***** sections, specifically:

    Code:
        ; report count (number of fields)
        retlw	0x95
        retlw	0x08
    Why have you have changed the value from EasyHIDs default of 40 to 8?

    Once changing the value from 40 to 8 my EasyHID files work with your VB program.



    Cheers
    Squib
    sorry... but as far as i remind, i'd never ever do any change to it Weird, other have tested it, and proved to be working... can't say what is wrong.

    EDIT.. are you using a 4550?
    Last edited by mister_e; - 1st March 2007 at 18:22.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #56
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Quote Originally Posted by b1arrk5 View Post
    Great job Steve! I have your program running great on a MELABS LABXUSB board, I just took out your asm section for the config fuses (I'm running a 20 MHz crystal,) since my .inc file was already set up for 20 MHz, and changed portb to portd. The LABXUSB board has some leds on portd already. Works great! Thanks for getting us started with USB.

    Jerry.
    You're welcome!

    Enjoy!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  17. #57
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Default

    HI Mr_e

    Yep using the 18F4550.

    Thats a strange one, because without changing those two lines, It just doesnt work.... which kind of makes me think that easyHID isn't really that "easy" (If you have to make modifications)

    I'll have to play with it some more, but to be honest I'm not into VB programming so HID isn't on of my top list of projects....would be nice to know a bit about it to help others one day.

    Squib

  18. #58
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Quote Originally Posted by Squibcakes View Post
    There are two lines that perhaps you have manually modified?? They are in the **** INPUT OUTPUT REPORT ***** sections, specifically:

    Code:
        ; report count (number of fields)
        retlw	0x95
        retlw	0x08
    That number is changed by easyHID according to the number in the Buffer (Input) field on the "Configuration Details" screen.

    If you enter 64 for the input (or output), you get
    retlw 0x95
    retlw 0x40

    But, Steve's program is only set up for 8.
    <br>
    DT

  19. #59
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Cool

    This message will now be rendered useless. I wanted to delete it, but since I can't, I've put this stupid line here.
    Last edited by SterlingY; - 14th March 2007 at 01:20.

  20. #60
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Angry

    Hi,

    Having a problem with the MCHID.DLL.

    My HID device works well on my development PC - but when I plug it into another PC (both running XP), windows automatically assigns it's own HID.DLL, and thus the device doesnt work. (It appears in devicemanager correctly)

    How do I force XP to use the MCHID.DLL when there are no .inf files to use?

    Cheers
    Squib.

  21. #61
    Join Date
    Feb 2007
    Posts
    9

    Default

    I've always MCHID.DLL in the same dir as the executable :-) that helps

  22. #62
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Unhappy Driver Woes

    Yeah but... let me clarify,

    I've made a USB HID device (rudder pedals for my flight sim to replace my old gameport rudder pedals) and used Easy HID to make the necessary files.

    When I plug it into the my Development PC with PBP etc installed, windows detects and it installs them perfectly! The pedals shows up in the game controllers list automatically and I can use them properly, ie calibrate them.

    But when I plug the pedals into my Gaming PC, windows detects them and intalls a driver for it (show up in the system device list), but it doesn't show up in the game controllers list, thus I can't use the peddals.

    I've tried other pc and the same happens.

    I'm not creating any application to go with these pedals, I just want to plug them into any pc and have it work.

    I'm not sure if it is a driver issue, or just a blonde moment. LOL.

    Cheers

  23. #63
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Default

    mister e,

    Great stuff. A lot of good things to learn in your example.

    So I've decided to make my own version, but I have run into a hurdle with EasyHID. Has anyone had trouble installing it? I need to mcHID.dll, but I can't install the software on my XP64 machine. The setup.exe program just seems to hang, without ever bringing up the install screen. And on my win2K machine, I get an error that it can't create the mcHID in the winnt/system32 folder.

    Any thoughts?

    -Sterling
    Last edited by SterlingY; - 15th March 2007 at 03:09.

  24. #64
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Unhappy

    I was able to just put the mcHID.dll in the Visual Basic project folder where my project files are located. That solved working with VB, but I still don't have the easyHID program at my disposal. Maybe I will just have to slug it out by hand.

    -Sterling

  25. #65
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257

    Talking

    OK, got it sussed!

    The problem was in my report descriptor section..... originally, I had setup up a "joystick" descriptor, which worked, but then later I changed the descriptor to a "simulator control".

    The confusing thing was that windows was happy to use this new descriptor, and I figure the HID PID/VID sections in the registery never got updated (ie windows still recognised the pedals as a joystick).

    When I plugged them into another PC for the first time, windows installed the pedals as a simulator control and that is why they didn't show up into the game devices list.

    After changing the report descriptor scetion back to a joystick - all is working!

    I guess the moral of the story here is that if you use the same VID/PID for different USB applications your USB device may not install properly.

    I found that just removing the usb device from the device manager isn't enough, as you may need to delete all keys in the registry that ref. the paticular PID/VID device.

    Clear as #*$#@!! mud?

    As for installing EasyHID - I haven't had any problems installing (XP Pro 32). I don't suppose you can set compatabillity to XP(32) for the setup file?

    Cheers Squib

  26. #66
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Default

    Of course I took your excellent example and tore it all apart to modify it into something completely useless to me.

    I'm not getting data from USBbufferin on the device. I am kind of curious about a line in the VB side:

    "hidWriteEx VendorID, ProductID, BufferOut(0) ' send it"

    Doesn't that just send the first element of the array? On the device I am trying to read USBbufferin[2] but get nothing. I should point out that my version has this as a normal BYTE, not the LSB of another number or whatever you had.


    -Sterling
    Last edited by SterlingY; - 16th March 2007 at 01:33.

  27. #67
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Default

    More info:

    In the VB code, if I put the following line "BufferOut(2) = 145" in the WriteSomeData() function, I get "0" when reading on the device, however, If I put that same line in the Form_Load() function, it sends the data, so I think the Form is constantly reloading. How can this be?

    -Sterling

  28. #68
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Default

    I seem to be talking to myself here, but that's okay.

    I just wanted to say that I got it working. I don't know how. But, I ran the original USBDEMO.exe, and then everything started working with my modified version.

    Crazy, I know!

    -Sterling

  29. #69
    Join Date
    Mar 2007
    Location
    West Hollywood, CA
    Posts
    38

    Smile

    Here I go again:

    The problem was that VB buffer(1) comes into the device as buffer[2]

  30. #70
    Join Date
    Dec 2003
    Location
    Storrs, Ct.
    Posts
    91

    Default Thanks mister e

    Thanks for the inspiration Steve. My upgrade is complete, PBP2.47,EasyPic 4, PicFlash 7.03, a new laptop to stuff it all in and some 18f4550 samples.
    Thanks to Uncle Sam for a quick tax return also.


    Had some trouble with the USB stuff at first but this post solved my problems.
    http://www.picbasic.co.uk/forum/show...4&postcount=32

    Not sure what to do with the $20 I got left. Dinner at Denny's with my wife maybe?
    Then again I could use another USB cable...

    Thanks again Steve.

  31. #71
    Join Date
    Mar 2007
    Posts
    13

    Default Files location issue?

    Dear all

    I am a newbie who's tying to do his first steps with UBS programming under PIC. My environment is PBP 2.47, Microcode Studio 3.0.0.0 and MPASM 5.03.

    I am using microsontroller PIC 18F2450.

    The issue is: when trying to compile and assemble the source file USBDemo.PBP from Steeve I get the following error messages:

    ERROR: Macro USBINIT? not found in macro file.
    ERROR: Macro USBSERVICE? not found in macro file.
    ERROR: Macro USBIN?CBBL not found in macro file.
    ERROR: Macro USBOUT?CBBL not found in macro file.

    I did make any change to the original files as posted on this forum.

    Could any one be of help to me?

    My file locations are as follows:
    MPASM D:\Program Files\PBP\MPASM
    PBP D:\Program Files\PBP

    When loading the USBDemo.HEX file in my microcontroller (18F4450 and 18F2450) it works fine with the PC application from Steeve.

    In advance many thanks for your help.

  32. #72
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by Momboz View Post
    I am using microsontroller PIC 18F2450.

    The issue is: when trying to compile and assemble the source file USBDemo.PBP from Steeve I get the following error messages:

    ERROR: Macro USBINIT? not found in macro file.
    ERROR: Macro USBSERVICE? not found in macro file.
    ERROR: Macro USBIN?CBBL not found in macro file.
    ERROR: Macro USBOUT?CBBL not found in macro file.

    I did make any change to the original files as posted on this forum.

    Could any one be of help to me?

    My file locations are as follows:
    MPASM D:\Program Files\PBP\MPASM
    PBP D:\Program Files\PBP

    When loading the USBDemo.HEX file in my microcontroller (18F4450 and 18F2450) it works fine with the PC application from Steeve.

    In advance many thanks for your help.
    As far as I know, PBP doesn't support USB on the 2450/4450. Yes, those chips are USB chips. Yes, PBP does support those chips, just not using the USB, at the website doesn't specifically say it supports them that way. The only chips I see that PBP directly supports with USB are the PIC18F2455, 2550, 4455, and 4550, and the 16C745, 765.

  33. #73

    Thumbs up I am Still Hoping Something Can be Done

    Hi, This really is a nice post, I am going to work with it, i will have to use 18f2550 since it is the available part around here.

    1. Any problem with it being the 2550? someone said "Thank god you didnīt choose the 2550" before.

    2. I guess i`ve read the answer to this but...: Usb Communications require somehow a "master"(host) and a "slave"? if this is so, i would never be able to communicate two pics through USB would I?, where i am going is that i intend to control USB devices but this could never be done if this is true, has anyone figured something without buyign those ugly USB HOST controllers? they really are a pain in the a.. you canīt find them at all(not here).

    I have a uC develpment to control by serial (rS232) port some GSM phones, but the newer models dont support serial but USB, what should be done to transfer data between a uc and them?

    It seems to me like an step backwards the fact that usb had lost the simplicity of RS232 communications in this matter.

    thanks for the hobby time again
    Last edited by Josuetas; - 5th April 2007 at 14:01.

  34. #74
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    1. There's no real problem with the 2550. It was just an inside between me and Malc about a previous thread on some behaviour to program this specific PIC with his PIC programmer. not much. Don't worry.

    2. You can't use a PIC to PIC USB comm unless you really want to waste your time to develop a host controller... not something i would do. Hence why there's a few available on the market.

    USB is not as simple as RS232 of course, it's another and really different animal.

    Good luck!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  35. #75
    Join Date
    Feb 2007
    Posts
    9

    Default

    I lately bought the book of Jan Axelson and this realy helped me. Here the link of Amazon
    USB Complete: Everything You Need to Develop Custom USB Peripherals

    Good Luck ;-)

  36. #76
    Join Date
    Mar 2007
    Posts
    13

    Default RE: Files location issue?

    Quote Originally Posted by skimask View Post
    As far as I know, PBP doesn't support USB on the 2450/4450. Yes, those chips are USB chips. Yes, PBP does support those chips, just not using the USB, at the website doesn't specifically say it supports them that way. The only chips I see that PBP directly supports with USB are the PIC18F2455, 2550, 4455, and 4550, and the 16C745, 765.
    Hi skimask.

    First, many thanks for your help.

    Second, I know from Melabs, that they support 2450/4450 in the USB modes.

    My issue again is: I was not trying to use any other PIC, but 4550. I am not that far in the process. What I was trying to do is just to compile the USBDemo.PBP for the 4550 in my environment.

    And this doesn't compile because of some missing macros.

    Any suggestion?

    Thx
    Last edited by Momboz; - 5th April 2007 at 16:03.

  37. #77
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    shouldn't be a problem IF ALL files i've provided are located in the same folder unless i miss something obvious.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  38. #78

    Default USB Host Controller

    Ok, so there are plenty USB host controllers, any to recommend? it would be great if it is NOT surface mountable,

    Thanks

  39. #79
    Join Date
    Mar 2007
    Posts
    13

    Default RE: Files location issue?

    Quote Originally Posted by mister_e View Post
    shouldn't be a problem IF ALL files i've provided are located in the same folder unless i miss something obvious.
    Many thanks Steeve

    I have copied all the files in the folder where I have PBP 2.47 installed and I tried to compile again. The errors are the same.

    I have been surprised by the way you did programm your application (the PIC configuration is written in assembler and is in your source code. Why not) and it's the only example that does recognize the USB interface when plugged in. The other examples from Melabs (UBMouse, UBSJadem and USBCDC) do not recognize when plugged in but they compile without errors.

    I am not asking what is the best :-)

    I will still investigate the issue and try to find out what's wrong with my configuration. I am very very patient and I have plenty of time to spend on the subject. This is just as a hobby. No boss is expecting any results from me in this case.

    Thanks again for your help.

  40. #80
    Join Date
    Mar 2007
    Posts
    13

    Default Feedback on USBDemo

    Quote Originally Posted by mister_e View Post
    shouldn't be a problem IF ALL files i've provided are located in the same folder unless i miss something obvious.
    Dear Steve

    I would like to give you feedback on 3 points:

    1st, there is a typing error in your example USBDemo.pbp source file. Line 39 in your file should say "_FCMEM_OFF_1H" and not "_FCMEN_OFF_1H", i.e. the letter N should read M.

    2nd, your example compile perfectly if it located in the USB18 folder (or if you copy the UBS18 folder files in yours).

    3nd, you are redefining the PIC CONFIG register and this is also done in the so called INC file from Melabs for that PIC. This generates errors and the user has to choose where to configure these registers to avoid duplication of definition.

    I take this opportunity to thank you very much for the example first and then for your kind help.

    Bye

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. How to receive stream of bytes using PIC USART
    By unifoxz in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 20th June 2009, 10:38
  3. Replies: 9
    Last Post: - 31st July 2008, 08:56
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts