Help, problems first time with 18F452 PIC


Closed Thread
Results 1 to 5 of 5
  1. #1
    MikeTamu's Avatar
    MikeTamu Guest

    Default Help, problems first time with 18F452 PIC

    Hello, I just recieved my MELABS seriel programmer and PIC Basic Pro. I tried doing the initial 'Blink' program with no success. Let me begin by telling my process for programming in case I am doing something wrong.

    1) I first select the right PIC and write my code in MicroCode Studio, my program is:

    DEFINE OSC 10
    loop: High PORTB.1 ' Turn on LED connected to PORTB.1
    Pause 200 ' Delay for .2 seconds

    Low PORTB.1 ' Turn off LED connected to PORTB.1
    Pause 200 ' Delay for .2 seconds

    Goto loop ' Go back to loop and blink LED forever

    End

    As you can see I am operating at 10 Mhz with a 10 Mhz ceramic resonator with built in capacitors.

    2) Next, I compile to get the Hex file for the program. I open Melabs Programmer, select the correct PIC, load my Hex file, Erase the PIC, check for blank, then Program the PIC. I then turn off the seriel programmer and remove the PIC, followed by placing it in my circuit.

    My circuit consists of a 5 Volt supply, a 10 uf and .1 uf decoupling capacitors across the +5 and ground, and the ceramic 3 pin resonator (with built in caps) connected to the 2 resonator pins and the ground pin tied to ground. Portb.1 is tied to a 1k resistor and led in series.

    Results:

    When the power is turned on, Portb.1 outputs 5 volts for about 1 second, shuts off and then nothing else happens. I have tried troubleshooting this problem with no success whatsoever.

    Is there anything wrong with my PicBasic Pro code that I am not seeing here?

    Thanks for any help.

  2. #2
    MikeTamu's Avatar
    MikeTamu Guest


    Did you find this post helpful? Yes | No

    Default

    Update:

    After struggling with this problem for half a day, I have learned my lesson well. In Melabs Programmer, XT was the selected speed mode whereas HS should of been for 10 Mhz. Doh!

  3. #3
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Thumbs up Congratulations

    Hi there,

    Did you know that you can run your PIC18F452 @ 40MHz using the same 10MHz resonator! The config is then HS_PLL (It does a x4 PLL multiply)

    Happy PICing

    Regards

    Sougata

  4. #4
    MikeTamu's Avatar
    MikeTamu Guest


    Did you find this post helpful? Yes | No

    Default

    Wow, I didn't know that. Thanks.

    Where do I put this 'config' command and what is the full command to use?

    Also, does PBP know that I will be doing this and adjust its pause times accordingly?


    Thanks.

  5. #5
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Cool search for a post by melanie on config

    Hi there,

    As far as I remember Melanie did give a full reference on the @config issues. I do it in a different way. I edited the 18F452.inc file in the pbp folder and change the XT_OSC to HS_PLL. Actually I run almost all my 18F452 @40MHz. That gives me fastest running code however practical serial communication is limited to 9.6K. Higher rates yield high baud rate error. BTW a simple define "DEFINE osc 40" will make your timing correct under PBP. Keep exploring.

    Regards

    Sougata

Similar Threads

  1. Serial VB 2005 pic 16f877a problems
    By Snap in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 8th July 2013, 00:52
  2. Pic getting part power from Analog Port
    By ShaneMichael in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 22nd April 2009, 10:34
  3. PIC instruction time
    By Adrian in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 26th June 2007, 02:53
  4. problems on power up of PIC
    By dmairspotter in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 13th June 2006, 14:11
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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