18f4550


Closed Thread
Results 1 to 16 of 16

Thread: 18f4550

  1. #1
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120

    Question 18f4550

    Hi to every picbasic crazy brain,

    I have an experiance in pic16f628.
    I decide to do the next step to pic's.So i choose the 18f4550.

    Please I need a sample code to begin with a blink led.

    PicBsic pro 2.47
    PICKIT2
    MPLAB IDE v7.60

    Thanks in advance
    Nikos

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ngeronikolos View Post
    Hi to every picbasic crazy brain,

    I have an experiance in pic16f628.
    I decide to do the next step to pic's.So i choose the 18f4550.

    Please I need a sample code to begin with a blink led.

    PicBsic pro 2.47
    PICKIT2
    MPLAB IDE v7.60

    Thanks in advance
    Nikos
    Since you have PBP 2.47, there is an example in the book.

  3. #3
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Default

    Hello,

    Please help I need sample code for my first program on PIC18F4550.

    Thanks in advanve
    Nikos

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ngeronikolos View Post
    Hello,

    Please help I need sample code for my first program on PIC18F4550.

    Thanks in advanve
    Nikos
    Refer to post #2!!! Section 2.2

  5. #5
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ngeronikolos View Post
    I have an experiance in pic16f628.
    I decide to do the next step to pic's.So i choose the 18f4550.

    Please I need a sample code to begin with a blink led.
    Why not just put one of your existing programs on the 18F4550 ?

    Or are you asking for a sample program to test some of the additional features on the device (which probably wouldnt be needed for "Blink LED")
    Keith

    www.diyha.co.uk
    www.kat5.tv

  6. #6
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Default

    ok

    Let's say that I am going to use the code from 16f628 to blink a led in Porta.1

    loop:
    High PORTA.1 'Turn on LED
    Pause 500 ' Delay for .5 seconds
    Low PORTA.1 'Turn off LED
    Pause 500 ' Delay for .5 seconds
    Goto loop ' Go back to loop and blink LED forever
    End

    How I will use the internal osc?

    In 16f628 i did this:
    @ DEVICE pic16f628, INTRC_OSC_NOCLKOUT

    Now it did not work.
    What else it needs to work?

    Nikos

  7. #7
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ngeronikolos View Post
    ok
    How I will use the internal osc?

    In 16f628 i did this:
    @ DEVICE pic16f628, INTRC_OSC_NOCLKOUT

    Now it did not work.
    What else it needs to work?

    Nikos
    How did you find out how to set the Internal Oscilator for the 16F628 ?

    Presumably by looking in the datasheet for the device to see what needed to be configured.

    By looking in the datasheet for any PIC you will be able to find what needs to be set. It may take a few tries before you get the correct results but that is how you learn....from your mistakes.

    Also read the sections about Analogue Ports and Comparators.
    Last edited by keithdoxey; - 16th June 2007 at 19:31.
    Keith

    www.diyha.co.uk
    www.kat5.tv

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


    Did you find this post helpful? Yes | No

    Default

    What the heck happen on this forum since few weeks/months?

    Guys, if you can't help, don't answer, don't waste your/our time and bandwith.

    Even if this is a simple question, 18F4550 have tons of Configuration fuse to set. Can be enough to stop someone to use it.

    There's really a lot of a s s kicking to do here

    --------------------------------------------------------------------------

    ngeronikolos,

    have a look at the following, OK, it's more than a LED blink, but this should give you some hints at least about the config fuses settings.

    http://www.picbasic.co.uk/forum/show...ght=pic18f4550

    HTH
    Steve

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

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    What the heck happen on this forum since few weeks/months? Guys, if you can't help, don't answer, don't waste your/our time and bandwidth. Even if this is a simple question, 18F4550 have tons of Configuration fuse to set. Can be enough to stop someone to use it. There's really a lot of a s s kicking to do here
    Because...even without setting config registers (I suppose depending on the programmer and any previous settings that might be 'locked in'), the '4550 will start up (as most newer PICs will) with a 1Mhz internal clock (depending on the PIC model), not perfect, but enough to get things up and running... especially the ol' "blinky led" type program.
    And...You and I both know that the '628 blinky led program wasn't going to work as expected in the earlier post since there is no mention of the ADCON CMCON registers. This is all mentioned in the PBP manual under section 2.5, which is labeled I've Got Troubles, where it specifically mentions the comparator and the analog ports, not to mention the issues with RA4, all of which seem to plague SOOOO many people. But that assumes that the person has a copy of the book.
    And as far as the pins being configured as inputs on reset, the HIGH and LOW statement for the 'blinky led' program should take care of that.
    Last edited by skimask; - 16th June 2007 at 23:01.

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


    Did you find this post helpful? Yes | No

    Default

    i know you wanted to say CMCON for the 16F628
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask
    Because...even without setting config registers (I suppose depending on the programmer and any previous settings that might be 'locked in'), the '4550 will start up (as most newer PICs will) with a 1Mhz internal clock
    Except that the default config settings in the .INC files for these chips are for a 20Mhz crystal, using the PLL to get 48Mhz to both USB and CPU.

    Maybe if you tell the programmer not to write the config settings it might .. stress might, come up with the internal oscillator, but NOT defining the required conditions, and hoping it does what you want, is obviously NOT the right way to do things.

    And, while we're on the subject of the "right way to do things" ...

    When someone asks a question on the Forum, the "right way" is to attempt to provide an answer.
    Pointing them to Section 2.2 of the Manual (Your First Program), is just plain Rude!<hr>
    Now, for that "Answering the question" part...
    Oh, and let me add here that it's preferable to have actually tested the answers you give.
    Pull out the 4550, plug it in a breadboard and make sure you're giving an answer, not more problems for the person to deal with.

    In my case it's easy... Just pull out the mister_e 18F4550 USB Demo prototype (minus a few LED's) from
    http://www.picbasic.co.uk/forum/showthread.php?p=31405
    (Yup, I keep them.)

    Which then allows me to present the following post, with great confidence that it'll work. Because I've actually done it.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Nikos,

    If you haven't already, it's best to comment out the default oscillator settings in the 18F4550.inc file in the PBP folder, I'm sure you've done that before with other PIC's ...

    Then you can set the options in your main program.
    Here's a possibility for blinking an LED on PORTA.1 with a 4550 using the Internal Oscillator @4Mhz and your original code ...
    Code:
    '18F4550 with Int OSC Blinky
    
    @   __CONFIG   _CONFIG1H,  _FOSC_INTOSC_XT_1H
    
    DEFINE OSC 4         ; CPU runs @ 4 Mhz
    OSCCON = %01100010   ; 4 Mhz Internal Oscillator
    
    ;DEFINE OSC 8         ; CPU runs @ 8 Mhz
    ;OSCCON = %01110010   ; 8 Mhz Internal Oscillator
    
    ADCON1 = $0F         ; Disable Analog inputs
    
    loop:
        High PORTA.1 'Turn on LED
        Pause 500 ' Delay for .5 seconds
        Low PORTA.1 'Turn off LED
        Pause 500 ' Delay for .5 seconds
    Goto loop ' Go back to loop and blink LED forever
    
    End
    Keep in mind that the internal oscillator can't drive the USB module. But you can add a crystal to drive the USB and still run the CPU on Internal. Your choice.

    HTH,
    DT

  13. #13
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Question

    Thanks to every one that want to help and share with us a piece of his
    (or her) experience.

    According to Darrel and his piece of his program, I have a problem.
    I used to use Micrcode studio Plus for 16f628.
    Now with the 18f4550 I need the MPLAB.So, I download the latest version of it and set it up to me laptop.
    I did what the microEngineering Labs says about the :
    --The PICBASIC™ and PICBASIC PRO™ Compilers can now be used with Microchip's MPLAB®!--
    http://www.melabs.com/support/mplab.htm

    After all that I try to compile the 18F4550 with Int OSC Blinky that Darrel post and I get two errors Error[118] look at the attached photo

    Please advice
    Nikos
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Steve

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

  15. #15
    Join Date
    Feb 2005
    Location
    GREECE
    Posts
    120


    Did you find this post helpful? Yes | No

    Default

    I did the following but nothing...
    Please H E L P ME.I DO NOT UNDERSTAND!!!!


    Why I have to change thE INC file?Why I never did it with 16f628?
    We are talking for the INC file in the pbp folder?



    ;************************************************* ***************
    ;* 18F4550.INC *
    ;* *
    ;* By : Leonard Zerman, Jeff Schmoyer *
    ;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
    ;* All Rights Reserved *
    ;* Date : 06/05/06 *
    ;* Version : 2.47 *
    ;* Notes : *
    ;************************************************* ***************
    NOLIST
    if def PM_USED
    LIST
    "Error: PM does not support this device. Use MPASM."
    __CONFIG _CONFIG1H, _FOSC_INTOSC_XT_1H <-------- add it
    NOLIST
    else
    LIST
    LIST p = 18F4550, r = dec, w = -311, w = -230, f = inhx32
    INCLUDE "P18F4550.INC" ; MPASM Header
    __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
    __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
    __CONFIG _CONFIG3H, _PBADEN_OFF_3H
    __CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
    NOLIST
    endif
    LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 32

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


    Did you find this post helpful? Yes | No

    Default

    Oops, my fault. I should have been more complete with my descriptions.

    The .INC file should look like this. The 2 red lines are commented out.
    Code:
    ;****************************************************************
    ;*  18F4550.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2004 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 12/31/04                                        *
    ;*  Version   : 2.46                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F4550, r = dec, w = -311, f = inhx32
            INCLUDE "P18F4550.INC"	; MPASM  Header
      errorlevel -230
    ;        __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 & _ICPRT_OFF_4L & _XINST_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	32
    DT

Similar Threads

  1. 18f4550 usb problem.. so im getting crazy..
    By MeSaKu in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th May 2009, 22:03
  2. Usb Mass Storage With 18f4550
    By wagner in forum USB
    Replies: 8
    Last Post: - 17th August 2008, 16:46
  3. 18F4550 to 18F2550
    By mpardinho in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th September 2007, 23:13
  4. How can I turn off USB support in 18F4550
    By BrianT in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 6th September 2007, 03:56
  5. USB Programmer for 18F4550 PICs
    By Kamikaze47 in forum USB
    Replies: 8
    Last Post: - 21st August 2007, 16:29

Members who have read this thread : 0

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