PIC USB to VB.NET - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 54 of 54
  1. #41
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240

    Default Re: PIC USB to VB.NET

    Quote Originally Posted by jmgelba View Post
    Thanks guys. I think I've found my issues.

    One more question for now though, is the data within the byte transmitted msb first or lsb first from VB?

    The answer to your question is in the code in post #1 and #2.
    Thanks and Regards;
    Gadelhas

  2. #42
    Join Date
    Feb 2007
    Posts
    37

    Default Re: PIC USB to VB.NET

    Hi.

    I have tried to compile the source code that is present on the first page of this thread and I obtain the following error message:

    Code:
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 301 : Overwriting previous address contents (0000)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 301 : Overwriting previous address contents (0001)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 302 : Overwriting previous address contents (0000)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 302 : Overwriting previous address contents (0001)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 303 : Overwriting previous address contents (0002)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 303 : Overwriting previous address contents (0003)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 304 : Overwriting previous address contents (0002)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 304 : Overwriting previous address contents (0003)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 305 : Overwriting previous address contents (0004)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 305 : Overwriting previous address contents (0005)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 306 : Overwriting previous address contents (0006)
    Error[118]   C:\PIC\MEL\PBP3061\18F4550\USB\PICUSB\PICUSB.ASM 306 : Overwriting previous address contents (0007)
    the content of the file into the working directory is:

    Code:
    24/01/2011  02:45            22.213 DT_HID260.pbp
    04/11/2009  11:41            28.721 DT_INTS-18.bas
    04/04/2013  10:03             7.665 firmware.zip
    04/04/2013  11:52            84.061 PICUSB.ASM
    04/04/2013  11:52             1.368 PiCUSB.ERR
    04/04/2013  11:52         1.112.440 PiCUSB.LST
    04/04/2013  11:52            10.855 PICUSB.MAC
    04/04/2013  11:52             4.917 PiCUSB.pbp
    21/06/2012  03:06            96.199 usb_dev.asm
    21/06/2012  03:06             6.290 usb_dev.inc
    21/06/2012  03:06            26.203 usb_hid.asm
    21/06/2012  03:06             6.378 usb_hid.inc
    21/06/2012  03:06             6.403 usb_mem.asm
    I'm using:
    Win 7 Ultimate
    A 18F4550 that will be run on the PICDEM FSUSB
    PBP 3.0.6.1
    MCS 5.0.0.3

    I have the trial version (15 gg left - I'm waiting to solve some administrative trouble before buy the upgrade)

    Attached please find the Directory contents.

    Any suggestion will be more appreciate.

    Ciao

    Leo
    Attached Files Attached Files

  3. #43
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,585

    Default Re: PIC USB to VB.NET

    Search for OVERWRITING, you get a ton of threads. Start with this one:

    http://www.picbasic.co.uk/forum/show...ht=overwriting

    Robert

  4. #44
    Join Date
    Feb 2007
    Posts
    37

    Default Re: PIC USB to VB.NET

    Hi,

    I have commented all of that:
    Code:
    ;--- if you un-comment these, you must comment the ones in the .inc file ---
    'ASM  ; 18F2550/4550, 8mhz crystal
    ' commented all to run , otherwize some error arise
    '   __CONFIG    _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    '   __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
    '   __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
    '   __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
    '   __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
    '   __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    'ENDASM
    and all begin to work.

    But there are some conceptual doubt that I have explained on a different thread:

    http://www.picbasic.co.uk/forum/showthread.php?t=17877
    Last edited by Wirecut; - 7th April 2013 at 01:50. Reason: typo error
    Leo

  5. #45
    Join Date
    Feb 2007
    Posts
    37

    Default Re: PIC USB to VB.NET

    Hi,

    thanks to the suggestion of Henrik Ollson on the thread:

    http://www.picbasic.co.uk/forum/show...740#post119740

    I have substitute the ASM/ENDASM to #CONFIG/#ENDCONFIG as:
    Code:
    #CONFIG  ; 18F4550, 20mhz crystal 
       __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
       __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
       __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L
       __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
       __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
       __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
    #ENDCONFIG
    and now "automagically" all works! GREATH!!!!
    Leo

  6. #46
    Join Date
    Aug 2006
    Posts
    20

    Default Re: PIC USB to VB.NET

    Hi all,

    I'm trying to use TMR0 however USB does not seem to communicate. I saw in past threads that TMR0 was used for USB polling, I've been examining all files related DT-INTS, DT-HID and soforth, TMR0 does not appear, so I don't know why using this timer would stop things. I'm not using DT-INTS on overflow just monitoring the int flag. By itsself i.e. no USB this little routine works fine. I'm outputing a 50msec (mark) pulse on portB then a second delay of around 300 msec (space). Goal is to adjust the space to vary stepper motor speed.

    advice appreciated

    Cheers

    John

  7. #47
    Join Date
    Aug 2006
    Posts
    20

    Default Re: PIC USB to VB.NET

    Heres some of the code, this all works fine using simple delay or other timer

    Main:
    ; Check for incomming USB data while waiting
    @ ON_USBRX_GOSUB _HandleRX
    lcdout $FE, 1, dec Size
    pause 2000
    if portB.0=1 OR Run=1 then
    high porta.3
    T0CON.7=1 'start TMR0
    mark:
    if not match01 then goto mark 'match01 var INTCON.2 '50msec delay
    T0CON.7=0 'stop timer
    match01=0 'clear interupt flag
    INTCON.5=0 'set interupt enable to 0
    low porta.3
    if plugged then ARRAYWRITE USBTXBuffer, [Size,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ;send position
    GOSUB WaitToSend
    time=time+1
    lcdout $FE, 1, dec time 'use to check whats happening here
    TMR0H=$C9 '300msec
    TMR0L=$10
    T0CON.7=1 'start TMR0
    space:
    if not match01 then goto space
    T0CON.7=0 'stop timer
    match01=0 'clear interupt flag
    INTCON.5=0 'set interupt enable to 0
    TMR0H=$F6 '50msec pulse
    TMR0L=$D8
    endif
    goto Main

  8. #48
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default Re: PIC USB to VB.NET

    Getting back to USB basics after a 3 year absence. I cant seem to get the code in the first post to run on a 18F2550. I get: ERROR Line 25: Bad BANK number. (DT_HID260.pbp) Apparently this issue didn't exist the first time I ran the code all that time ago.

    Any pointers?

  9. #49

    Default Re: VB.NET Program

    Thanks for posting Gadelhas,

    Been wanting to try USB for a long time. But it seems everything changes rapidly. Windows, Visual Studio, .net etc. This was a popular subject a few years back. So most of the examples seem to be VB6 or in this example VS 2008

    Can anyone tell me if the code in posts 1 and 2 can be used with Visual Studio Community 2015? I was able to download VS 2008 sp1 ISO, which may be good enough?

    Also can't seem to find where to download EasyHID, maybe its out of date. HIDmaker FS looks great, but $399 is hard to justify for casual use.

    Thanks
    Mark

  10. #50
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240

    Default Re: VB.NET Program

    Quote Originally Posted by mark_s View Post
    Thanks for posting Gadelhas,

    Been wanting to try USB for a long time. But it seems everything changes rapidly. Windows, Visual Studio, .net etc. This was a popular subject a few years back. So most of the examples seem to be VB6 or in this example VS 2008

    Can anyone tell me if the code in posts 1 and 2 can be used with Visual Studio Community 2015? I was able to download VS 2008 sp1 ISO, which may be good enough?

    Also can't seem to find where to download EasyHID, maybe its out of date. HIDmaker FS looks great, but $399 is hard to justify for casual use.

    Thanks
    Mark
    It's been a long time since i don't use this project. It was made in VB.net 2008, so it should be easy to use with VS 2015.

    At his moment i really don't have the time to port the code to VS2015, lost of projects at the same time, but i'll put it on my list.

    I not even know if EasyHID still exists, but i never used it, its to expensive.

    Also let me know what are you trying to do with USB.
    Thanks and Regards;
    Gadelhas

  11. #51

    Default Re: VB.NET Program

    Thanks for answering. I don't have a specific project in mind, just looking for a templet to build on. Your example is perfect, a small app written in VB to read and write to a pic's ports and modules.

    I worry a little, starting projects based on VB6, mister-e and DT's great work. Some of this material is 10 years old now and they are no longer here to answer or modify these routines.

    Found this site which sells a DLL for Visual Studio that looks very interesting. It can be used with VS 2015 and examples in MikroC. I have Mikrobasic so this may be the best path. The only reason I have not purchased it, the examples and videos are not in English, so I need a little more time to study.

    http://www.usbhidnetclass.com/

    Regards
    Mark

  12. #52
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240

    Default Re: VB.NET Program

    Quote Originally Posted by mark_s View Post
    Thanks for answering. I don't have a specific project in mind, just looking for a templet to build on. Your example is perfect, a small app written in VB to read and write to a pic's ports and modules.

    I worry a little, starting projects based on VB6, mister-e and DT's great work. Some of this material is 10 years old now and they are no longer here to answer or modify these routines.

    Found this site which sells a DLL for Visual Studio that looks very interesting. It can be used with VS 2015 and examples in MikroC. I have Mikrobasic so this may be the best path. The only reason I have not purchased it, the examples and videos are not in English, so I need a little more time to study.

    http://www.usbhidnetclass.com/

    Regards
    Mark
    Hi mark_s;

    I'm aware of that dll, but i didn't use it.
    You can probably use this to try out, but only in C and C#
    http://libstock.mikroe.com/projects/...on-ad-and-leds
    http://libstock.mikroe.com/projects/...oe-development

    Nowadays i only program in C ( embedded) or C#/python/Java (desktop app).
    I few months ago i did an application with MicroC and PIC18F4550 to emulate a HID Keyboard. In this way you don't even need the desktop app.
    The worst part is the descriptor, but after that it works great.

    What language you usually work? PicBasic, MikroBasic, Visual Basica, C#?
    Thanks and Regards;
    Gadelhas

  13. #53

    Default Re: VB.NET Program

    Hi,

    I program in PBP also Mikrobasic for pic, dspic, and pic32. I'm going to learn visual basic. I have not programmed in C or C#, but have learned how to read and understand code. These days most code examples are in C so it's hard to avoid.

    Thanks for the links, some of these projects are by the guy who sells the DLL.

    Regards

  14. #54
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    637

    Default Re: VB.NET Program

    Hi,

    Does anybody have a new version of this code for PBP3 and VB.NET 13, 15, or 17? I tried the VB NET code in the first post and it gave me all kind of errors. Does anybody knows where I can get this code?

    Thanks,

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

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