usb to serial and back on the fly with ucase$


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1

    Default

    actually, after displaying '9' on portb, it goes immeditaly to showing '1', and i mean immediate, no one second pause displaying '8'

    to get to '1' it must pass '8', but then if it got to '1', it should flash between '1' and '0'.........and it does not - ant that last pause is 125 not 1250........

    now i am confused

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

    Default

    I see that you changed the label Loop to IdleLoop.

    Was that because you have PBP 2.60?

    If so, you'll need to make some changes.
    USB is different now.

    ADDED: If it is 2.60 ... Check out this ...
    http://www.picbasic.co.uk/forum/show...0301#post80301

    Last edited by Darrel Taylor; - 31st October 2009 at 02:56. Reason: CDC with PBP 2.60
    DT

  3. #3

    Default

    Quote Originally Posted by Darrel Taylor View Post
    I see that you changed the label Loop to IdleLoop.

    Was that because you have PBP 2.60?

    If so, you'll need to make some changes.
    USB is different now.

    ADDED: If it is 2.60 ... Check out this ...
    http://www.picbasic.co.uk/forum/show...0301#post80301

    no it was idleloop as down loaded from here
    http://www.melabs.com/resources/samp...pbp/usbcdc.bas

    Code:
    ' USB sample program for PIC18F4550 CDC serial port emulation
    
    '  Compilation of this program requires that specific support files be
    '  available in the source directory.  You may also need to modify the
    '  file USBDESC.ASM so that the proper descriptor files are included. For
    '  detailed information, see the file PBP\USB18\USB.TXT.
    
    buffer	Var	Byte[16]
    cnt	Var	Byte
    
    LED	Var	PORTB.0
    
    Define  OSC     48
    
    
    	USBInit
    	Low LED		' LED off
    
    ' Wait for USB input
    idleloop:
    	USBService	' Must service USB regularly
    	cnt = 16	' Specify input buffer size
    	USBIn 3, buffer, cnt, idleloop
    
    ' Message received
    	Toggle LED
    
    	buffer[0] = "H"
    	buffer[1] = "e"
    	buffer[2] = "l"
    	buffer[3] = "l"
    	buffer[4] = "o"
    	buffer[5] = " "
    	buffer[6] = "W"
    	buffer[7] = "o"
    	buffer[8] = "r"
    	buffer[9] = "l"
    	buffer[10] = "d"
    	buffer[11] = 13
    	buffer[12] = 10
    	buffer[13] = 0
    
    outloop:
    	USBService	' Must service USB regularly
    	USBOut 3, buffer, 14, outloop
    
    	Goto idleloop	' Wait for next buffer


    using 2.47

    I changed the chip type to 2550 in MCS, copied the usb support files into my pbp directory, and compiled..


    hey prestnot......

    so added a few led statements and lost more hair, and i'm still here, its not going to win the war, battles its winning on but i'm not keeping count....

    is there any fuses that may stop usb working ?

    maybe i have something wrong in that area because the basic programs so short theres not a lot of possibility of error, so thinking its something thats not to be seen going on, or not going on.

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

    Default

    Quote Originally Posted by f_lez
    I changed the chip type to 2550 in MCS, copied the usb support files into my pbp directory, and compiled..
    Did you read the USB.TXT file?
    They don't go in the PBP folder. They go in your project's folder.
    Now you've messed up the .bas files for all the USB chips, and will have to restore them from the CD or a backup.

    Did you modify the USBDESC.ASM file to point to the CDC descriptors?

    Do you have a .22uF or higher capacitor on VUSB?

    Are your configs set for a 4Mhz crystal, with USB regulator enabled?
    Code:
    ASM
            __CONFIG    _CONFIG1L, _PLLDIV_1_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
    ENDASM
    And restore the program back to what it was originally (download it again).
    It won't work the way you've modified it.

    DT

  5. #5

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Did you read the USB.TXT file?
    They don't go in the PBP folder. They go in your project's folder.
    Now you've messed up the .bas files for all the USB chips, and will have to restore them from the CD or a backup.

    Did you modify the USBDESC.ASM file to point to the CDC descriptors?

    Do you have a .22uF or higher capacitor on VUSB?

    Are your configs set for a 4Mhz crystal, with USB regulator enabled?
    Code:
    ASM
            __CONFIG    _CONFIG1L, _PLLDIV_1_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
    ENDASM
    And restore the program back to what it was originally (download it again).
    It won't work the way you've modified it.

    going to do a full wipe and start afresh.

    I take it i can use latest mpasm with me old 2.46, or should i get old mpasm? i'll go with the latest one for now.

    hell i even spent most of yesterday trying 'other products' but by last night i gave up, too many buttons and options and built in this and that i could not see what it was doing!

  6. #6

    Default

    Ok, I'm going slowly and step by step now and leaving my educated guesses where they belong.....


    pbp2.46 from cd to c:\pbp

    pbp2.46a patch from melabs website link

    mpasm 5.20 from melabs website link, to c:\mpasm

    MCS installed and pointed to pbp and mpasm

    New project director c:\pic2009\usbtest091101\

    All files from c:\pbp\USB18\ to project directory

    edit usbdsc to:

    Code:
    ; This file contains an include for the application specific
    ; USB descriptors.  Include only ONE of the following or add
    ; your own for your own project.
    
    ;	include "MOUSDESC.ASM"		; USB descriptors for mouse demo
    ;	include "JADESC.ASM"		; USB descriptors for Jan Axelson's demo
    	include "CDCDESC.ASM"		; USB descriptors for CDC demo
    @this point i get the config has been depreciated but with the recession what hasnt.....

    I'l go burn this and see what happens

  7. #7
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530

    Default

    I take it i can use latest mpasm with me old 2.46, or should i get old mpasm? i'll go with the latest one for now.
    You can only use the newest MPASM with PBP v 2.60. For any earlier version, MPASM 8.15a (or earlier) is the way to go. http://melabs.com/downloads/mplab_v815a.zip
    Last edited by ScaleRobotics; - 1st November 2009 at 12:15.
    http://www.scalerobotics.com

  8. #8

    Default

    Thanks, but i'm on 246, but it seems ok with mpasm5.2


    Fuses, mine are a little different , i'm on 20mhz so i have these in the inc

    Code:
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
            __CONFIG    _CONFIG2L, _PWRT_ON_2L & _BOR_OFF_2L & _VREGEN_ON_2L

    At the top of the program, right after define OSC etc i put a high led pause 1000 low led and led lights for 1 second so looks ok

    On the dev board/programmer it lights 4 seconds, but that does have a 4mhz, i should change devboard/prototype to same crystal really

    not detected by windows, back on dev board if i switch portC led's on i get a good light on RC3 and a dimmer one on RC5, if i poke a shaky finger at rc4, rc5 flickers, so looks like its running.


    ...oh hang on BRB, theres a compiler error about overwriting previous contents, could have been there a while as its down bottom of screen and you have to scroll past the depreciated warnings

    Back, set config1 more than once...
    fixed, no improvement
    Last edited by f_lez; - 1st November 2009 at 12:13.

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 13:43
  2. Raw serial data sniffer? By USB??
    By kevj in forum General
    Replies: 1
    Last Post: - 5th July 2008, 14:34
  3. Advice please - Warning message
    By malc-c in forum mel PIC BASIC Pro
    Replies: 50
    Last Post: - 23rd January 2007, 13:20

Members who have read this thread : 1

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