need help


Closed Thread
Results 1 to 5 of 5

Thread: need help

Hybrid View

  1. #1
    pierre2030's Avatar
    pierre2030 Guest


    Did you find this post helpful? Yes | No

    Default hi

    HI,paul borgmeier

    -i finish reading the manual and found out that IF---THEN can operate in 2 manners.
    -In one form,the THEN in an IF...THEN is essentially a GOTO. If the condition is true,the program will GOTO the label after the THEN.
    -In the second form, IF...THEN can conditionally execute a group of statements following the THEN. The statements must be followed by an ELSE OR ENDIF to complete the structure.

    -the message got worse when i add ENDIF in the first IF---THEN

    TEST:
    IF PORTA.0=1 Then
    goto TESTING
    Else
    goto TEST
    Endif

    and become:

    Error C:\CDLITE\THESIS\DECODE1.ASM 67:[231] Attempt to Redefine '_TEST'
    Error C:\CDLITE\THESIS\DECODE1.ASM 70:[231] Attempt to Redefine '_TESTING'
    Error C:\CDLITE\THESIS\DECODE1.ASM 77:[231] Attempt to Redefine '_TESTING'
    Error C:\CDLITE\THESIS\DECODE1.ASM 80:[231] Attempt to Redefine '_CHECKING'

    *** 4 Errors***

    -what is meaning of those errors?
    thank u very much

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Look at the first If-Then you just fixed. How does it differ from your next If-Then? In the first, we added the goto statement to both conditions. Do the same for the second If-then and then your code will compile without errors.

    TESTING:
    IF PORTA.0=0 Then
    goto CHECKING
    Else
    goto TESTING
    EndIF

    Good Luck,

    Paul Borgmeier
    Salt Lake City, Utah
    USA

  3. #3
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    For clarification as to why your original format did not compile.

    snip ... "If the condition is true,the program will GOTO the label after the THEN"

    The LABEL needs to be on the same line as the THEN in order for it to be assumed a GOTO. If used in this manner it cannot have an ELSE associated with it.

    EXAMPLES:


    IF PORTA.0 = 1 THEN TESTING

    and

    If PORTA.0 = 1 THEN
    GOTO TESTING
    ENDIF

    do the same thing (but the second form takes more program words)

    Paul
    Last edited by paul borgmeier; - 26th March 2006 at 20:37.

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