New to PIC


Closed Thread
Results 1 to 21 of 21

Thread: New to PIC

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    Here is my code, it flashes leds on PORTA.0 and PORTB.0

    ADCON0 = 0
    ADCON1= 127
    define OSC 4
    led var PORTA.0
    sink var PORTB.0

    loop:
    toggle PORTA.6
    pause 5
    high led
    pause 5
    low led
    pause 5
    high sink
    pause 5
    low sink
    goto loop
    end


    PORTA.6 is just low, it does not toggle or go High if I change the code.

    The schematic is simple, I connected VPP, +5, Gnd, PGD and PGC.
    I have 470 ohm resistors from the PIC to leds connected to GND.

    Could it be the clock output function? How do I set INTRC_OSC_NOCLKOUT?
    Last edited by Mike2545; - 25th July 2009 at 21:32.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    http://www.picbasic.co.uk/forum/showthread.php?t=543
    The above talks about how to set the configs.
    You can do it in your code or just modify the PICs *.inc file.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    Well, nothing I have tried with this has worked, I can get it to work in Swordfish Basic but Microcode studio is not what I expected for the Price they charge.

    Has anyone else gotten a 18F1320 to work correctly with PICBasic Pro?

    I am beginning to regret shelling out good money for a product that does not work as well as a free compiler.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Did you get the OSC set correctly ?

    Post you config settings.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,

    Welcome to the forum.

    I was reading through this thread and it looked like something Savnik pointed out might not be too clear. (But very correct.)

    Porta.6 and a.7 are reserved for an external oscillator, so they can't be used as regular pins unless you put a config line in PicBasic Pro to explicitly enable them as pins. That's probably why the other LEDs work, but those don't.

    Since I don't know anything about Swordfish, I can't compare how it does this. For me, once I started understanding the setting of fuses, things started getting smoother.

    Hang in there. I find PicBasic Pro to be very powerful. So far, whenever something doesn't go as planned, it is just a little thing I haven't learned yet.

  6. #6
    Join Date
    Jul 2009
    Location
    Ohio, USA
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    OK, I got the OSC set with OSCCON =$60 so its not running at 37khz anymore, which makes sense that the pause statements were way too fast for the result I was getting; pause 5 is way too small for what I was used to in basic, now pause 500 is more like it.

    As for setting the fuses, I think I will need help figuring out how to do that.


    Mike2545

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Mike2545 View Post
    OK, I got the OSC set with OSCCON =$60 so its not running at 37khz anymore, which makes sense that the pause statements were way too fast for the result I was getting; pause 5 is way too small for what I was used to in basic, now pause 500 is more like it.

    As for setting the fuses, I think I will need help figuring out how to do that.


    Mike2545
    First off read the thread I linked to above. Then let's just change the configs in the Inc file. If you were going to change things often then doing it in code is handy.

    Go to the PBP directory and find the Inc file with your chips name. There you will see the config settings. You may want to male a backup of the file.

    Then go to the MPASM directory in program files and find the coorosponding Inc there. The microchip Inc near the end has all of the possible settings.

    Change the PBP Inc to the way you want it.

    I am on my phone at the moment so I can not show the exact change.
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. Replies: 67
    Last Post: - 8th December 2009, 02:27
  3. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  4. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  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 : 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