usb to serial and back on the fly with ucase$


Closed Thread
Results 1 to 18 of 18

Hybrid View

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

    Default

    It looks like the External USB Transceiver pins are active. (VPO VMO etc.)

    Have you changed the UCFG register?
    You should not.

    DT

  2. #2

    Default

    Quote Originally Posted by Darrel Taylor View Post
    It looks like the External USB Transceiver pins are active. (VPO VMO etc.)

    Have you changed the UCFG register?
    You should not.
    it has a ucfg register? i just downloaded the usbcdc demo and compiled it, when i said i fixed the incs i meant the inc issue with the 18f2550 fuses and the invalid path in one of the incs i found.



    by flashing the leds on portb etc i know i am running internally at the right speed so my clock divs are ok.

    all i have is pic on a board with leds on the ports and a usb connector, nothing fancy, was hoping to achive success with the KISS principle..

    precompiled stuff seems to work, i used this board about two years ago with the simple usb demo, but i need to make it do serial...

    I did just find another path {c:\pbp\pic¬1.47\} that i need to edit but the phone just went and i have to go drive someone shopping!

    thanks for the reply, i'll update when they stop dragging me back to the real world

  3. #3

    Default

    ok now i want to scream at it..........

    Code:
    buffer	Var	Byte[16]
    cnt	Var	Byte
    flash var byte   
    
    LED0	Var	PORTB.0
    LED1	Var	PORTB.1
    LED2	Var	PORTB.2
    LED3	Var	PORTB.3
    LED4	Var	PORTB.4
     
    CMCON = 7            ; turn off comparators 
    ADCON1 = 15            ; turn off analog inputs
    
    define OSC 48
    
    trisa=0
    trisb=0
    
        high led0
        high led1
        high led2
        high led3
        high led4
    
    pause (1000)
        low led4
    pause (1000)
        low led3
    pause (1000)
        low led2
    pause (1000)
        low led1
    pause (1000)
        low led0
    pause (1000)  ; end of the pretty countdown
    
    
        portb=9
        pause 1000
       ; usbinit
        portb=8 
        pause 1000   ; never gets to here if i un-rem usbinit
        portb=16
    
    ; Wait for USB input
    idleloop:
    ;   USBService	' Must service USB regularly
    ;	cnt = 16	' Specify input buffer size
        
        if flash=0 then
    	portb=1
    	flash=1
    	else
    	portb=0
    	flash=0
    	endif
    ;	
    ;   USBIn 3, buffer, cnt, idleloop
    
    pause 1250
        goto idleloop
    with the usb bits rem'd out, the led's flash as expected, as soon as i un=rem usbinit, it hangs at usbinit

  4. #4

    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

  5. #5
    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

  6. #6

    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.

  7. #7
    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

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