Basic help for 12F629


Results 1 to 6 of 6

Threaded View

  1. #4
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Gene,

    You arm missing the port settings (TRIS). I haven't touched PBC since 2000 so I'm very rusty but here is an example I pulled from my files taken from this forum. Please note the GPIO and TRISIO settings. They set the port pins as either input or output and whether the pin starts out as high or low. CMCON disables the comparator.
    Code:
    'PIC: 12F629
    ' GP0:  Turn Something On (relay, FET, alarm, etc)
    ' GP1:  Test Location LED, Buzzer, VOM, nothing?
    ' GP2:  
    ' GP3: (MCLR Internal)
    ' GP4: XTAL 4.0000 Hz (w/tolerance = 30 ppm) w/ cap to GND
    ' GP5: XTAL 4.0000 Hz (w/tolerance = 30 ppm) w/ cap to GND
    '
    '         -_-
    '   +5V--|   |--GND
    '   Xtal-|12F|--to turn on circuit (relay, FET, alarm, etc)
    '   Xtal-|629|--test location (LED, buzzer, etc. if required)
    '       -|   |-
    '         ---
    ' (Xtal caps to GND not shown)
    '
    ' CONFIGURATION SETUP
    '  Oscillator:          XT
    '  Watchdog Timer:      OFF
    '  Power up Timer:      OFF
    '  Master Clear Enable: Internal
    '  Brown Out Detect:    OFF
    '  Code Protect:        OFF
    '  Data EE Read Protect:OFF
    '**********************************************************
    CMCON=7                'all digital for low power use
    GPIO=$00001000
    TRISIO=$00001000
    OPTION_REG=%10000111   'weak pullups off, TMRO prescale = 256
    INTCON=0               'interrupts off
    '**********************************************************
    HzTimer VAR Word         '1/2 second counter (2 Hz)    
    SS VAR Byte  ' Seconds 0-59
    col VAR Bit  ' colon 1=on, 0=0ff
    trip var bit 
    cnt var byte
    HzTimer=$7A12        'for 1/2 Sec
    '*********************************************************
    I sure hope this helps you out. After thinking about this I think you have to "poke" the values into the GPIO and TRISIO registers. I don't have my PBC manual with me where I live during the week but I will check over some file archives and see if I can find some old files I did years ago. I will get back to you.


    BobK
    Last edited by BobK; - 22nd September 2009 at 01:03. Reason: Forgot code commands

Similar Threads

  1. Sending Commands from Visual Basic about IR to Pic
    By tne_de in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th April 2009, 06:09
  2. Indexer not indexing...a basic PBP problem??
    By jellis00 in forum General
    Replies: 8
    Last Post: - 24th March 2009, 16:53
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Visual Basic 2005
    By keithdoxey in forum Off Topic
    Replies: 4
    Last Post: - 1st August 2007, 12:10
  5. vb6 to pic basic
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th December 2005, 01:56

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts