PortA.2 on a 16F676


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    448

    Default PortA.2 on a 16F676

    Hi,

    I have a circuit designed around a 16F676. Basically, I am feeding the mains sine wave (after the transformer, thru' a 22K resistor) to PortA.2. I did a pulsin to measure the width of the positive cycle, and got a reading of around 120 (12 ms).

    Since I am feeding a sine wave, I dont expect to get a precise reading, as I realise the clipping would happen somewhere on the rising and falling edges. This would be allright. (Actually for 50 Hz, I would have expected the reading to be *less* than 100, or 10ms for a half cycle, but like I said I dont need absolute values)

    But, the problem is this; the same signal fed to any other PortA pin gives a much higher value (175 or thereabouts).

    I could of course shift the input to the other pin(s), but my PCB is designed.

    What could be causing this? What is different about PortA.2 from say A.0,A.1 or A.5?

    BTW, I have configured the PIC for all digital, comparators disabled and weak pullups disabled.

    Any help would be appreciated!

    Regards,

    Anand

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Red face

    Hi,

    A look at the datasheet shows A.2 is a schmitt trigger input ... not so good for such measurements.
    Measurement differences with other ports come from here ...

    The only way to keep your board as-is would be to raise the voltage from your trafo ... the trigger levels occur on the "very low" ( read closest to zero crossing) part of the sine.

    no real hope of saving your board ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Oct 2004
    Posts
    448


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi,

    A look at the datasheet shows A.2 is a schmitt trigger input ... not so good for such measurements.
    Measurement differences with other ports come from here ...

    Alain
    oh, missed that.

    Thank you so much; fortunately I do have a spare pin I could use.

    I still dont understand why the pulsin should not be 10ms (50 Hz, positive half cycle) or *less*, rather than the roughly 17 ms that I'm getting?

    Regards,

    Anand

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Just look at your sine w/the scope ...

    some surprises guaranteed !!!

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. 16f684 Porta.2 Instability
    By JDM160 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 5th November 2006, 02:38
  2. SEROUT workaround for 16F676
    By rkeene0517 in forum Code Examples
    Replies: 0
    Last Post: - 12th February 2006, 03:39
  3. Using 16f676 with comms
    By Peter1960 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2005, 20:01
  4. Problem during compilation 16F676
    By mat janssen in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th October 2005, 07:05
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

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