PIC12F683 Pinouts?


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Aug 2005
    Location
    NC, USA
    Posts
    53

    Unhappy PIC12F683 Pinouts?

    I am trying to write a simple program on a 12F683. Its my first time using a 8 pin PIC. I can't figure out how to do a TRIS. I am not able to get pin GP3 to work as an output and I can't get GP1 to work as an input. I only need AN0, which I have not tested yet. Anyone have any ideas what I'm missing. Code is below. Thanks

    @ device INTRC_OSC_NOCLKOUT
    @ DEVICE MCLR_OFF ' Master Clear Options

    OSCCON = $60 'sets the oscillator speed
    DEFINE OSC 4 'Oscillator speed in MHz

    ' Alias pins
    LED_Sig VAR GPIO.3 ' LED - Rx Complete Flag
    LED_Rx VAR GPIO.4 ' LED - I2C Data being written
    LED_Tx VAR GPIO.5 ' LED - Serial Data Being Read

    ' Set up Analog
    ADCON0 = %11000001 'AN0 Analog, rest digital
    ANSEL = %00110001 'AN0 Analog, rest digital
    INTCON = %00000000 'all interrupts OFF

    ' Define used register flags
    DEFINE ADC_BITS 10
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 50

    ' Allocate RAM
    i VAR BYTE

    for i = 1 to 10
    high LED_Sig ' LED won't work... It works is I just jumper 5V to the PIN
    pause 50
    Low LED_Sig
    pause 50
    High LED_Rx
    pause 50
    low LED_Rx
    pause 50
    high LED_TX
    pause 50
    low LED_Tx
    pause 50
    next i

    start:
    if GPIO.1 = 1 then
    low LED_Rx
    else
    high LED_Rx
    endif

    if GPIO.2 = 1 then 'can't turn the LED off with 5V put right on the PIN
    low LED_Tx
    else
    high LED_Tx
    endif
    goto start

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Cpayne,

    GP3 can only be an input and never output (see datasheet section 4.1)

    Add:

    TRISIO = 3

    to makes GP0(AN0) and GP1 inputs with the rest output (see datasheet section 4.1 again)

    Good Luck,

    Paul Borgmeier
    Salt Lake City, Utah
    USA

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


    Did you find this post helpful? Yes | No

    Default

    also, don't forget to disable the analog comparator...
    section 8 of the datasheet...
    Steve

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

Similar Threads

  1. Pic12f683 Cmcon0 = 7
    By penelopepug in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 12th June 2009, 18:23
  2. Programming Problem PIC12F683
    By StoneColdFuzzy in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 2nd June 2009, 21:39
  3. pic12F683 , gpio.5 not accessible...
    By flipper_md in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 9th May 2008, 05:25
  4. How to calculate ADC resolution (pic12f683)
    By peu in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th April 2007, 18:39
  5. Using the pic12F683
    By TonyA in forum General
    Replies: 2
    Last Post: - 6th April 2006, 12:46

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