The use of USB with the 18F2550 - Page 3


Go to last post By: towlerg
Today 01:31
Forum: Master Synchronous Serial Port (MSSP) module / 3-wire SPI / I2C / Master and Slave modes
Starter: CharlieBrown
Views: 1780
Replies: 13
Go to last post By: John Drew
Yesterday 23:56
Forum: Proton Plus Compiler v3
Starter: towlerg
Views: 0
Replies: 3
Yesterday 23:32
Forum: The Lounge
Starter: Tim
Views: 0
Replies: 1
Yesterday 23:22
Forum: Projects discussion
Starter: creatv
Views: 0
Replies: 5
Go to last post By: charliecoultas
Yesterday 20:43
Forum: The Lounge
Starter: pic-ignorant
Views: 0
Replies: 4
Yesterday 20:26
Forum: Proton Plus Compiler v3
Starter: Frizie
Views: 0
Replies: 7
Yesterday 18:31
Forum: LCD module
Starter: charliecoultas
Views: 0
Replies: 40
+ Reply to Thread
Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25

Thread: The use of USB with the 18F255023 days old

  1. #21
    Member yvesmazzon's Avatar
    Join Date
    Jul 2006
    Posts
    207
    Thumbs Up
    Received: 11
    Given: 32
    Total Downloaded
    10.40 GB

    0 Not allowed!

    Default Re: The use of USB with the 18F2550

    Thanks George'
    I do write simple code to test new things like flashing a led and check the oscilator timing is right or send data serially. two more thing:
    1) The "USB_BUS_SENSE_PIN = PORTB.0". is connected to what?
    2) You mention the 18F25K50 can run with its own internal oscillator is the 18F2550 (which I have) can also do so?

    Regards,

    Yves

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #22
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,105
    Thumbs Up
    Received: 191
    Given: 171
    Total Downloaded
    4.82 GB

    0 Not allowed!

    Default Re: The use of USB with the 18F2550

    1. now I come to think off it I'm not sure. I've never used it. I guess either D+ or D-. Anyone?

    2. no 18f2550 does not have that facility but the two are pretty much interchangable. Amoung it's many advantages, Async serial RX does not share a pin with SDO.
    George.

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #23
    Member yvesmazzon's Avatar
    Join Date
    Jul 2006
    Posts
    207
    Thumbs Up
    Received: 11
    Given: 32
    Total Downloaded
    10.40 GB

    0 Not allowed!

    Default Re: The use of USB with the 18F2550

    Any one knows where the USB_BUS_SENSE_PIN should be connected? thank you

    Yves

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #24
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    466
    Thumbs Up
    Received: 84
    Given: 0
    Total Downloaded
    330.54 MB

    0 Not allowed!

    Default Re: The use of USB with the 18F2550

    USB_BUS_SENSE should be connected to the USB VBUS 5V power.

    It's used to sense if you're connected to a USB host when you're powered externally (self-powered).
    If you're self-powered you really shouldn't enable the USB until you see that it's connected to a host.
    It doesn't really have any use when powered via USB, although I don't know how the library reacts if it's not defined/connected.

    I would think you could ignore it.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #25
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,431
    Thumbs Up
    Received: 104
    Given: 25
    Total Downloaded
    5.47 GB

    0 Not allowed!

    Default Re: The use of USB with the 18F2550

    I cannot find the two USB PIC's I had, so for now cannot do any test.

    One thing I remember is that in my code I made a loop to test if the PIC can send data to USB.

    Why? Because if the COM port is not selected for the COM port the PIC is using it will crash the PC if the PIC tries to send data to PC.

    Nothing special. From the PC I send a number, in this case 10, so the PIC knows that it can begin transmission.

    Code:
    USBIn 3, RX_Buffer, 16, IdleLoop    ' Wait for USB input
    
    STR_to_Byt = 0                      ' Clear STR_to_Byt variable 
    
    RX_Buffer = RX_Buffer + 0           ' Add a null terminator to string
    
    '----------------------------------------------------------------------------------------
    ' If there is communication set Send_EN to 1 to allow sending to PC
    
    If RX_Buffer[0] = "#" And RX_Buffer[1] = "0" Then   ' If left 2 string equivalent #0 then
        
        Length = Len RX_Buffer                          ' Find the length of RX_Buffer
        RX_Buffer = Right$ (RX_Buffer , Length - 2)     ' Remove left two strings of RX_Buffer
        STR_to_Byt = Val(RX_Buffer,Dec)                 ' Convert the String into an integer 
        
        If STR_to_Byt = 10 Then                         ' If STR_to_Byt data equal 10 then
            Send_EN = 1                                 ' Send_EN = 1, so enable USB sending
            GoTo TX_End                                 ' Goto transmitt data
            ElseIf STR_to_Byt = 20 Then                 ' Else if STR_to_Byt data equal 20 then
            Send_EN = 0                                 ' Send_EN = 0, so disable USB sending
        EndIf                                           ' End If...Then instruction
    
    EndIf                                               ' End If...Then instruction
    
    TX_End:
    
    If Send_EN = 1 Then                     ' If send is enabled then
        
        ' Convert the value into a string before sending through USB
        
        TX_Buffer = TX_Address + Str$(Dec3 , bValue) + "\r" ' Convert bValue byte to string 
                                                            ' and add carriage return for VB
        
        Repeat                          ' Repeat
            USBOut 3, TX_Buffer, Auto   ' Poll the USB and transmit the string from endpoint 3
        Until Carry_Flag = 0            ' Keep trying if the microcontroller does not have 
                                        ' control over the TX_Buffer
       
    EndIf                               ' End If...Then instruction
    Regards

    Joseph

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Is possible in one only chip, for exemple, 18F2550, write music midi code and usb?
    By marcosabcarvalho in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 18th August 2017, 00:40
  2. Replies: 8
    Last Post: 7th May 2014, 00:45
  3. 18F2550 to PC via USB
    By seconika in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 27th November 2008, 13:39
  4. 18F2550 USB BOOTLOADER and PDS Code Sample
    By ohararp in forum Proton Plus Compiler v3
    Replies: 9
    Last Post: 20th August 2007, 13:44
  5. Why not an 18F2550 as a USB host?
    By Charles Coultas in forum The Lounge
    Replies: 2
    Last Post: 29th January 2007, 14:05

Members who have read this thread since 16th September 2019, 00:28 : 0

Actions :  (Set Date)  (Clear Date)

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