I don't understand this code!


Closed Thread
Results 1 to 40 of 47

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    What I mean by "upside down" is: When the programmed output is high, the output actually goes low and when the programmed output is low, it actually goes high. I don't understand that.

    Russ

  2. #2
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Question upside down

    Hi Russ,
    Quote Originally Posted by Russ Kincaid View Post
    What I mean by "upside down" is: When the programmed output is high, the output actually goes low and when the programmed output is low, it actually goes high.
    We are not trying to give you a difficult time about this inverted waveform thing. It is just difficult to tell what you are seeing on a recurring waveform. Do you have another circuit synchronized with this output? Are you referencing the measurement to the PIC common?
    The timing may be difficult to see with a rapidly cycling code. You could change the code to seconds, just to watch the sequence.

    It looks like you WANT the output to be HIGH for three time increments and LOW for one. (See attachment.) http://www.picbasic.co.uk/forum/atta...1&d=1178466510
    Is the waveform LOW for three time increments and HIGH for one?

    -Adam-
    Attached Images Attached Images  
    Ohm it's not just a good idea... it's the LAW !

  3. #3
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User View Post
    Hi Russ,



    It looks like you WANT the output to be HIGH for three time increments and LOW for one. (See attachment.) http://www.picbasic.co.uk/forum/atta...1&d=1178466510
    Is the waveform LOW for three time increments and HIGH for one?

    -Adam-
    Exactly right. Why does it do that?
    BTW, GPIO.0 produces the positive half of an AC signal while GPIO.1 produces the negative half. The result is an AC that reads the same on a true RMS meter or one that reads 0.7 of the peak.
    Last edited by Russ Kincaid; - 6th May 2007 at 18:24.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    I'm thinking it might be time to post your schematic so we can quit guessing and start fixin' !

  5. #5
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    This is a very simple circuit, and not part of the problem, I believe.

    Russ
    Attached Images Attached Images  

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Russ Kincaid View Post
    This is a very simple circuit, and not part of the problem, I believe.

    Russ
    Turn the LEDs around and connect them to ground.
    When you apply a logic 0 to the pin, the pin sinks current and the LED lights...when you apply a logic 1 to the pin, the LED has the same voltage on both sides and doesn't light up...negative logic.
    That's why everything is backwards...but it's really not...it's working just as designed.

  7. #7
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default

    No, No, not working as designed. I know I can turn the LEDs around, but I want to know why I have to do that. I suppose I could write the program to do the opposite of what I want and see what happens.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  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. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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