Way


Closed Thread
Results 1 to 6 of 6

Thread: Way

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Is rpm less than or equal to 3 when it doesn't work?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Exclamation Way

    This work
    if (RPM > 3) then
    low Estarter
    else
    high Estarter
    pause 100
    endif

    this no work

    if (RPM <= 3) then (when is less the 3)
    high Estarter
    pause 100
    low Estarter
    endif

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


    Did you find this post helpful? Yes | No

    Default

    IF THEN with out an else has to have the THEN condition on the same line. This should work assuming "Estarter" is a Label or Statement.
    Code:
    if (RPM <= 3) then high Estarter
    pause 100
    low Estarter
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    It should work fine as-is, but if you expect to see the LED blink, you would probably
    want a short pause after each logic state change.

    I.E.;

    Code:
    RPM VAR BYTE
    SYMBOL Estarter = PORTB.0
    PORTB.0=0
    TRISB.0=0
    
    Main:
        for RPM = 0 TO 255
        if (RPM > 3) then
          low Estarter
          pause 100
        else
          high Estarter
          pause 100
        endif
    
        if (RPM <= 3) then
          high Estarter
          pause 100
          low Estarter
          pause 100
        endif
        next RPM
        goto Main
        
        END
    This definitely works. LED blinks 4 times on each pass through the loop.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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