PBP and 18F2550


Closed Thread
Results 1 to 17 of 17

Thread: PBP and 18F2550

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Thank you very much Tony.

    That helped alot, now SERIN and SEROUT are working.

    Now i trying to figure out how to make RA5 to digital input/output.

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


    Did you find this post helpful? Yes | No

    Default

    Look in the Analog to digital section... maybe in the comparator section (if there's any)
    Steve

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

  3. #3
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Yepp i find it
    Code:
    ADCON1 = %000001111
    sets all AN pins to Digital I/O.

    See "REGISTER 21-2: ADCON1: A/D CONTROL REGISTER 1" in the datasheet for 18F2550

    Thank you...

  4. #4
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PBP and 18F2550

    Sorry to drag up an old thread but i am struggling to get my head around these registers. I am moving over from using a 16F876A chip and at the moment i cant get the LCD to operate correctly. The characters are displaying but every few cycles they seem to get confused with some noise and random characters appear. Could this be anything to do with having not set the oscillator in the code for my external 4Mhz (I looked for this code but couldn't see any need for it)?

    Thanks for any help!


    Code:
    'BO = LCD INTERFACE'B1 = LCD INTERFACE
    'B2 = LCD INTERFACE
    'B3 = LCD INTERFACE
    'B4 = LCD INTERFACE
    'B5 = LCD INTERFACE
    'B6 = LCD INTERFACE
    'B7 = LCD INTERFACE
    '
    'C0 = SERVO 1
    'C1 = SERVO 2
    'C2 = 
    'C3 = 
    'C4 = 
    'C5 =
    'C6 =
    'C7 =
    
    
    
    
    '***********************************************************************
    '****************** DEFINE ADCIN PARAMETERS*****************************
    '***********************************************************************
    pause 1000
    
    
    
    
       asm
            __CONFIG    _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
            __CONFIG    _CONFIG1H, _FOSC_HSPLL_HS_1H
            __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L & 0DFh
    endasm
    
    
    
    
    DEFINE LCD_DREG PORTB 			'Define PIC port used for LCD Data lines
    DEFINE LCD_DBIT 4 			'Define first pin of portb connected to LCD DB4
    DEFINE LCD_RSREG PORTB 			'Define PIC port used for RS line of LCD
    DEFINE LCD_RSBIT 3 			'Define Portb pin used for RS connection
    DEFINE LCD_EREG PORTB 			'Define PIC prot used for E line of LCD
    DEFINE LCD_EBIT 0 			'Define PortB pin used for E connection
    DEFINE LCD_BITS 4 			'Define the 4 bit communication mode to LCD
    DEFINE LCD_LINES 2 			'Define using a 2 line LCD
    DEFINE LCD_COMMANDUS 2000 		'Define delay between sending LCD commands
    DEFINE LCD_DATAUS 50 			'Define delay time between data sent.
    
    
    
    
    main:
    LCDOUT $FE, 1
    pause 10
    LCDOUT $FE, 2
    pause 10
    LCDOUT "3 axis track V1"
    pause 5000
    
    
    
    
     goto main
    
    
    
    
    END

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: PBP and 18F2550

    I'd try this:

    DEFINE OSC 4

    Robert

    EDIT: This chip (like probably most PICs), has built-in oscillator. Any reason why you don't want to use that?

    And double-check the configuration fuses for the oscillator.
    Last edited by Demon; - 8th January 2012 at 02:18.

  6. #6
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PBP and 18F2550

    Thanks, I shall try that when I am at home tomorrow evening!
    Only the fact that I was always shown circuits with external ones! Are there many benifits to using the internal ones?
    With the fuses what kind of thing am I looking for or do you know of a beginners guide, as I haven't really dealt with those bits yet!

    Thanks!

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: PBP and 18F2550

    Quote Originally Posted by chrisshortys View Post
    ...Are there many benifits to using the internal ones?...
    Fewer parts, lower cost, less chance of solder problems, less space required on PCB, saving the planet, the list goes on. I've been using external oscillatorsmainly 'cause I bought a bag and enough capacitors, but that might change with USB.


    Quote Originally Posted by chrisshortys View Post
    ..
    With the fuses what kind of thing am I looking for or do you know of a beginners guide, as I haven't really dealt with those bits yet!

    Thanks!

    The datasheet is your friend:
    http://ww1.microchip.com/downloads/e...Doc/39632e.pdf

    Page 32, section 2-3:
    When these devices are used for USB connectivity,
    they must have either a 6 MHz or 48 MHz clock for
    USB operation, depending on whether Low-Speed or
    Full-Speed mode is being used. This may require some
    forethought in selecting an oscillator frequency and
    programming the device.
    The full range of possible oscillator configurations
    compatible with USB operation is shown in Table 2-3.

    I just pulled out a 18F4550 about 10 minutes ago to get back into USB programming. We share the same datasheet, but I can't comment on config yet, I have to search the forum for examples first. (Here's an interesting thread to start with)
    http://www.picbasic.co.uk/forum/show...18f4550+config

    Robert



    EDIT: But then it says this under the table:

    Legend: All clock frequencies, except 24 MHz, are exclusively associated with full-speed USB operation (USB clock of 48 MHz).
    Bold is used to highlight clock selections that are compatible with low-speed USB operation (system clock of 24 MHz,
    USB clock of 6 MHz).
    Since several of my PCs don't have USB 2.0, I'll be targetting low speed.

    Oh yes, don't forget that new PCs have USB 3.0, you'll have to look at an expert here to know how to handle that.
    Last edited by Demon; - 10th January 2012 at 03:59.

  8. #8
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PBP and 18F2550

    Quote Originally Posted by Demon View Post
    I'd try this:

    DEFINE OSC 4

    Robert

    EDIT: This chip (like probably most PICs), has built-in oscillator. Any reason why you don't want to use that?

    And double-check the configuration fuses for the oscillator.

    Hi demon, I haven't had a chance to gt on the pc to try this yet but what would be the difference between using:

    DEFINE OSC 4

    And



    Code:
    @ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H



    Is the define a pbp level code and the config I'm guessing in asm level?


    I'm not looking at USB yet but I may well try it in future projects!

    I had a look at the data sheet before posting but got very confused and gave in to google which didn't help much either

    I think I may well look to moving to onboard especially if USB will drive off this too!

    Thanks again!
    Last edited by chrisshortys; - 13th January 2012 at 17:45.

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: PBP and 18F2550

    I'm on cellphone, so sorry for short reply...

    Datasheet says USB requires external oscillator.

Similar Threads

  1. 18F2550 timing
    By sstt1976 in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 22nd August 2008, 00:30
  2. Error compiling 18f2550
    By sirvo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th May 2008, 23:22
  3. 18f2550 oscillator problems
    By rjones2102 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 28th September 2007, 03:57
  4. 18F2550 - config settings
    By malc-c in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 13th January 2007, 14:28
  5. ICD2 18F2550 MPASM7.50 - Aargh!
    By Giulio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th November 2006, 17:01

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