Q: using MCLR for Input on 12F683


Closed Thread
Results 1 to 40 of 47

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Try changing pos to a WORD size var and see if that helps
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jan 2009
    Posts
    34


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by mackrackit View Post
    Try changing pos to a WORD size var and see if that helps
    Thanks! it worked on the 16F84A chip.

    I'm still having difficulty with the 12F683 though. The pulsout doesn't seem to work. I wonder if the chip supports that command?

    I've also tried running the servo by setting the pin high and low timing the high between 1 to 2 ms and the low to 20ms. It works, but it won't accept a decimal number.

    at 4 mHz, I need to pause for between .5ms and 2.5ms but it only accepts 1 and 2 !!!

    suggestions??

    John.

    p.s., here's the code:



    posit var word

    cont var word
    cont2 var word
    Q var word


    let posit = 3/2

    Let Q = 25

    start:

    for cont = 1 to 50
    high 0
    pause posit
    low 0
    pause 20
    next cont



    goto start

  3. #3
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default

    It doesn't show in your code so I will assume that the device has not been configured to what you want to do with it since it has other features.
    Start by setting the oscillator then the ports with the TRISIO command, found on page 35 of the data sheet, shut OFF the comparators and the A/D feature:
    Code:
    OSCCON = %01100000  ' Ocs set to 4 MHz
    TRISIO = %00000000  ' Set all ports to outputs, in this example
    CMCON0 = 7                ' Analog comparators off
    ANSEL  = 0                ' Analog select set to digital, pg 69 data
    ADCON0 = 0                ' A/D turned OFF, pg 68 of data
    Then use the PAUSES command instead of PAUSE for a better resolution of the timming you need:
    PAUSE 1 gives you 1ms where PAUSES 1000 will do the same but now you can get your 1.5ms with PAUSES 1500.
    Last edited by LinkMTech; - 3rd January 2009 at 03:49. Reason: Then use GPIO.# not PORT.#
    Louie

  4. #4
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Red face One more thing

    Didn't know how to edit last post so:

    Use GPIO.# instead of PORTB.# per pg. 35 of data sheet.
    Louie

  5. #5
    Join Date
    Oct 2007
    Location
    The Netherlands
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    That should be PAUSEUS not PAUSES.
    PAUSEUS will pause microseconds, not milliseconds.
    If you let PBP devide 3 by 2 then you will always get 1 as an answer.
    So if you want to pause 1.5 milliseconds use PAUSEUS 1500 instead.

    happy new year

  6. #6
    Join Date
    Jan 2009
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Thanks LinkMtech and eggman (sounds like a TV show in the making!). I'll try your comments today.

    Happy new year to both of you.

    John.

  7. #7
    Join Date
    Jan 2009
    Posts
    34


    Did you find this post helpful? Yes | No

    Default

    Thanks gents, both option worked like a charm.

    Cheers!

Similar Threads

  1. How to MCLR by code for 16F877
    By fbestepe in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 26th November 2014, 00:51
  2. 12F683 - Pin1 not working
    By ruijc in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th February 2014, 17:38
  3. 16f677a to 12f683
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th July 2007, 06:16
  4. What does this MCLR instruction mean?
    By bartman in forum General
    Replies: 16
    Last Post: - 30th November 2004, 00:32
  5. I/O pin and MCLR
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 1
    Last Post: - 15th July 2004, 10:52

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