PIC18f4550 error


Closed Thread
Results 1 to 2 of 2
  1. #1
    williamlaw's Avatar
    williamlaw Guest

    Default PIC18f4550 error

    hi all

    i am currently trying to program a PIC18f4550 with a pickit 2, at the moment i am just trying to send PortB high, so my code is pretty simple, and i currently am useing a simulater called proteus to simulate my code and that works fine, so there is nothing wrong with my code. At the moment i have the 18f4550 set up on a bread board with its vdd pins at 5v and its vss pins at gnd. I am currety using the LVP for the pic, setting the PGM pin high to 5v, but it seems to work fine if you ground the PGM pin. I have tried unsucessfully tried to use HVP by setting MCLR to 10v whle grounding PGM, but that dosent work either

    I am using MPlab with the CC18 compler, but i have been using the Pickit 2 programmer as well.

    Mplab and the Pickit 2 programer can read and write to the pic, the hex file can be loaded, and it can be written to the pic, the problem is that nothing happens at the portb pins.........
    and here is where things get interesting, i have had it working on lvp where the program does what is expected, but it just stoped working, the only thing that may give some hints is that when i sent the program to the pic, instead of just making the portb pins 5v, it makes every pin 5v.
    i read in a post before that you need to set your lvp config bits, and i have done that by making a header file (PIC18f4550w.h) with all the config bits that i want. here is the code just to make sure i havent blown the obvious.

    #include <p18f4550.h>
    #include <PIC18f4550w.h>

    void main(void)
    {

    TRISD = 0;
    PORTD = 0xff;
    while (1)
    {
    }
    }


    and yes i do have a cap across the vdd and vss pins

    and help would be apreciated
    thanks will

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by williamlaw View Post
    the problem is that nothing happens at the portb pins.........
    #include <p18f4550.h>
    #include <PIC18f4550w.h>

    void main(void)
    {

    TRISD = 0;
    PORTD = 0xff;
    while (1)
    {
    }
    }
    Looks more like C than PicBasic to me, but to state the obvious, you want port B to go high, but you are telling port D to go high?

    Also, if using PicBasic, you can use Darrels handy dandy all digital to set up all your pins to be digital. This saves some time. But you will have to use basic commands that PicBasic will accept.

    See http://www.picbasic.co.uk/forum/showthread.php?t=11100
    Last edited by ScaleRobotics; - 14th May 2009 at 19:43.
    http://www.scalerobotics.com

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  2. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 04:58
  3. pbp245 compliation error
    By Woodzy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 25th July 2006, 05:59
  4. 16F88 Compile error
    By Toley00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd November 2005, 00:22
  5. Compiler/Assembler Error
    By LT_Pic in forum General
    Replies: 7
    Last Post: - 21st July 2005, 09:47

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