I don't understand this code!


Closed Thread
Results 1 to 40 of 47

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Russ Kincaid View Post
    high GPIO.0 'INITIAL CONDITIONS
    high GPIO.1
    START:
    low GPIO.1
    high GPIO.0 'GPIO.0 GOES LOW
    PAUSEUS 4168 ' ON TIME
    high GPIO.1 ' GPIO.1 GOES LOW
    HIGH GPIO.0 'GPIO.0 STAYS LOW
    PAUSEUS 4167 'DEAD TIME,
    high GPIO.1 ' BOTH GO HIGH
    PAUSEus 4168 'FOR 4.168 MILLISECONDS
    high GPIO.1 BOTH STAY HIGH
    PAUSEUS 4167 'DEAD TIME
    GOTO START '60 HZ FREQUENCY
    END
    I think you might be confusing yourself a bit...not sure, but that's what it looks like to me...
    high GPIO.0 'GPIO.0 GOES LOW ---- GPIO.0 looks like it goes low because the LED goes out. No... it's got 5v on both sides of the LED...no current flow...

    I think, in the end, you're going to end up cutting traces and doing some rewiring.

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


    Did you find this post helpful? Yes | No

    Default okay

    This code should work with the LEDs wired the original way.
    You could even put a time delay before the ON time and after the ON time, to “push” the waveform around. To get the desired timing to get the quasi sine wave at 60 Hz. I have no idea what timing will help!
    Just be sure the total adds up to the times for 60Hz.

    START:
    PAUSEUS 2074 ' before pulse
    LOW GPIO.1 ‘ON = pulse
    PAUSEUS 4168 ' ON TIME - GPIO.1 only
    HIGH GPIO.1 ‘both pins OFF
    PAUSEUS 2074 ' after pulse
    PAUSEUS 20 ' anti-overlap time
    ‘should add to 8.336 milliseconds

    PAUSEUS 2074 ' before pulse
    LOW GPIO.0 ‘ON = pulse
    PAUSEUS 4168 ' ON TIME - GPIO.0 only
    HIGH GPIO.0 ‘both pins OFF
    PAUSEUS 2074 ' after pulse
    PAUSEUS 20 ' anti-overlap time
    ‘should add to 8.336 milliseconds
    GOTO START '60 HZ FREQUENCY

    END

    I still would like to know between which points are you measuring the wave (voltage) from?
    Ohm it's not just a good idea... it's the LAW !

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User View Post
    I still would like to know between which points are you measuring the wave (voltage) from?
    I'm guessing just looking at the LEDs, not actually measuring voltage...
    I could be wrong...been there before

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


    Did you find this post helpful? Yes | No

    Smile don't blink

    Quote Originally Posted by skimask View Post
    I'm guessing just looking at the LEDs, not actually measuring voltage...
    I could be wrong...been there before
    Bet you’re right. Must be difficult to tell if both come on together at 60 Hz tho...
    Ohm it's not just a good idea... it's the LAW !

  5. #5
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User View Post
    Bet you’re right. Must be difficult to tell if both come on together at 60 Hz tho...
    Unless the guy has REALLY FAST eyes!

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Unless the guy has REALLY FAST eyes!
    Hard on the eyes!
    Maybe that's why they call it 60 hurts.
    Ohm it's not just a good idea... it's the LAW !

  7. #7
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User View Post
    Hard on the eyes!
    Maybe that's why they call it 60 hurts.
    Me anyways, even after a good sleep and a cup of coffee cannot see the 50 Hz. As for the 60....

    Ioannis


    P.S. May be it's the age!

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