new to 8 pin pic


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Hello hoyles,

    let me give you some pointers on that

    For the PIC12F629/675 you have no portb, it's called GPio

    So:

    where you have :
    Code:
    TRISB = %00000000
    pb0 var PORTA.0
    you need to have something like:


    trisio=%000001
    pb0 var gpio.0

    and for:

    Code:
    If pb0 = 1 and b0 = 0 Then one
    you need to have something like:

    if ( pb0=1 ) and ( b0=0 ) then one

    Get the ideia?
    Last edited by ruijc; - 22nd February 2008 at 18:03.

  2. #2
    Join Date
    Sep 2005
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thanks ruijc,

    i guess what i should have asked first was, how to access the i/o pins on the 12f629 and how to identify them as inputs or outputs.
    can i assume that the 6 i/o ports will be gpio.0 thru gpio.5?
    are there any pull up resistors needed for the inputs?
    are there any picbasic cammands that may not be used in this pic?

    thanks,
    mike

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by hoyles View Post
    thanks ruijc,
    i guess what i should have asked first was, how to access the i/o pins on the 12f629 and how to identify them as inputs or outputs.
    can i assume that the 6 i/o ports will be gpio.0 thru gpio.5?
    are there any pull up resistors needed for the inputs?
    are there any picbasic cammands that may not be used in this pic?
    thanks,
    mike
    The answer to EVERY one of those questions is right in the PBP manual.

    -You ask about I/O ports, there's a couple of pages in the PBP manual that have specific (to the 8 pin PIC) examples of the 8 pin PIC I/O ports and accessing them, as either inputs or outputs and setting or reading those inputs or outputs.
    -You ask about pull ups? There may or may not be a section in the 12F629 datasheet about pullups.
    -You have a 12 bit PIC, there's a whole section in the PBP manual on the 12 bit PIC and commands that may or may not have special needs when used with 12 bit PICs.
    Tell me I'm wrong, and prove it, and I'll GIVE you every PIC I have in my desk drawer.
    Last edited by skimask; - 22nd February 2008 at 18:48.

  4. #4
    Join Date
    Sep 2005
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thanks skimask,

    i did not realize that there was specific info on the 8 pin pic in the manual.

    that should be a great help.

    thanks again,
    mike

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,

    Welcome to the forum. This series PIC has a 4MHz internal oscillator, an analog comparator,
    and a host of other goodies you'll need the data sheet to get familiar with.

    CMCON = 7 will disable the onboard comparator so you can use associated pins as digital I/O.

    If you plan to use the internal oscillator, then you'll want to enable it using the INTRC_OSC
    option in config. Use this below to get started. Just place the next line at the very beginning
    of your program.

    Code:
    @ DEVICE pic12F629, INTRC_OSC_NOCLKOUT,WDT_OFF,PWRT_ON,MCLR_OFF,BOD_ON,CPD_OFF,PROTECT_OFF
    DEFINE OSCCAL_1K 1' Set OSCCAL for 1k ' <-- this loads the factory calibration value for the int osc
    DEFINE OSCCAL_1K 1 is in your PBP manual.

    If you're curious about what all these config options are, just look in the data sheet under
    the Special Features of the CPU section. You might also want to use the search feature
    here to turn up even more info, but this will get you up & going for now.

    I/O-pins on these are refered to as GPIO. GPIO.0, GPIO.1, etc,,.

    The TRIS register is called TRISIO. TRISIO = %xxx x being 1's or 0's for inputs or outputs.

    Now try something simple just to get familiar with the 12F part;
    Code:
    @ DEVICE pic12F629, INTRC_OSC_NOCLKOUT,WDT_OFF,PWRT_ON,MCLR_OFF,BOD_ON,CPD_OFF,PROTECT_OFF
    DEFINE OSCCAL_1K 1
    
        CMCON = 7
    
    loop: 
        High GPIO.0 ' Turn on LED connected to 0
        Pause 500 ' Delay for .5 seconds
        
        Low GPIO.0 ' Turn off LED connected to 0
        Pause 500 ' Delay for .5 seconds
        
        GoTo loop ' Go back to loop and blink LED forever
    TIP: Just in case, you might want to first read a new 12F629 with your device programmer,
    and jot down the factory calibration value. If your programmer erases this, you'll need to
    know what it was.

    There should be several threads around here with info on finding the proper value again, so
    I won't re-type it all again here.

    Use the search feature here to look around for more on using the 12F series. If you have
    more questions after reading any of them, then fire away.

    MeLabs has a few examples for the LAB-X4 board you might also want to have a look at;
    http://www.microengineeringlabs.com/doclist.htm#X4

    P.S. The 12F629 is not a 12-bit core device. It's 14-bit, so pretty much any PBP command
    should work just fine with it. As long as it's not a hardware command for a peripheral that
    doesn't exist on the PIC itself.
    Last edited by Bruce; - 22nd February 2008 at 19:43. Reason: P.S.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Sep 2005
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    thanks bruce,

    that is the exact information i was looking for.

    now it's time to experiment with it.

    i have learned a lot over the years from your website. keep up the good work!

    thanks again,

    mike

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    P.S. The 12F629 is not a 12-bit core device. It's 14-bit, so pretty much any PBP command should work just fine with it. As long as it's not a hardware command for a peripheral that doesn't exist on the PIC itself.
    Jeeze...I don't know how many times I've done that to myself! I've done bunches of applications with the 12Fxxx and it seems like every time, I talk myself into the fact it's a 12-bit...only to RE-figure out after a few days that it's actually a 14.
    (Ok...I'll take a burger and one FOREHEAD SLAP to go...)

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Some of the 12Fxxx series are 12-bit core. Just not this one. In general, 12F5xx are
    12-bit core, and 12F6xx are 14-bit core. The Program Memory Organization section of most
    data sheets will normally indicate the core type, so it's worth a quick check if you're not
    sure.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Is this a K Type sensor?
    By jessey in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 21st November 2009, 13:55
  2. newbe looking for PIC advice
    By Mad Professor in forum General
    Replies: 3
    Last Post: - 27th May 2009, 07:56
  3. PIC to PIC communication problem
    By precision in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st June 2007, 03:51
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. 8 port Signal Loss Detector, possible to use a pic?
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th March 2006, 15:59

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