how to use 12F509


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

    Smile how to use 12F509

    Hi, I have a Picstart + and am using CDLite. (runs great, by the way!) The information in the PBP manual, as well as John Iovine's book is very scanty about how to use the IO on the chip.
    Questions:
    1. Do I call the IO "GPIO" or something else? I have tried PORTA.X and GPIO.X and both assemble ok. However, I can't get any output or input from the chip in its application.
    The MPLab assembler seems to work ok but calls programming a "failure".
    2. Can I use the 12C509 firmware code in Picstart + with a 12F509?
    3 Does anyone have some sample code that works well with 12F509 and PBP?
    4. Do I need to set up the oscillator differently? (from internal similar to 12C509)
    Would appreciate any help I can get, since I am fairly new at this!
    Thanks,
    Ron

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


    Did you find this post helpful? Yes | No

    Default

    I don't us CDLite and it's no longer supported by Melabs so may i suggest you to use MicroCode Studio instead?
    Download it here

    Or you can still use MPLAB and do everything in. For that you'll need to install the PicBasic plug-in
    MPLAB installation page

    Now you may need to upgrade your PICSTART firmware and MPLAB to the latest version
    MPLAB download page

    Once it's done, you should'nt have any other compilation or you still have an older PBP version wich doesn't support the 12F509 like Version 2.44 and those before. If so, you'll need an update of it too.

    Once everything above is done, you should be able to do something workable.

    When you want to access to an i/o, you must call the proper PIC register as stated in the PIC datasheet, in your case GPIO.

    to set the internal oscillator and all config fuses.. read the following link
    http://www.picbasic.co.uk/forum/showthread.php?t=543

    a sample code... well let's try something using MPASM config fuses... oh no i never use the PM compiler, sorry.
    Code:
        '
        '    Pic Configuration
        '    =================
        @ __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC    ' Disable MCLR pin
                                                                   ' Disable code protection
                                                                   ' Disable Watch-Dog timer
                                                                   ' Use internal OSC      
    
        '
        '    Hardware configuration
        '    ======================
        TRISIO=0                   ' Set almost i/o to output 
        '
        '    Software/Hardware initialisation
        '    ================================
        GPIO = 0                   ' Clear almost i/o 
        '
        '    ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\        
        '                             Program Start Here                               
        '    ////////////////////////////////|\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\        
        ' 
        '    Nothing fancy, just do a blink on almost i/o   
        '
    Start:
          GPIO=GPIO ^ $FF
          pause 500
          goto start
    Why i said 'almost i/o'? it's up to you to discover now
    Last edited by mister_e; - 30th April 2006 at 21:52.
    Steve

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

Similar Threads

  1. 12F509 / 609 IR and speed control
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th October 2009, 01:51
  2. PIC 12F509 begins to heat at power up
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 25th July 2009, 12:11
  3. Timer and 12F509
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd November 2008, 14:51
  4. 12F509 vs 12C509
    By DavidK in forum Off Topic
    Replies: 4
    Last Post: - 5th June 2007, 03:23
  5. How to address I/O pins on 12F509?
    By Len in forum General
    Replies: 3
    Last Post: - 25th February 2005, 17:04

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