Rockwell-automation 1747-PBASE BASIC Development Software Programming Manual do Utilizador Página 111

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 144
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 110
Publication 1746-PM001A-US-P
Communicating with the Module 9-11
Debugging Example
The following example program will be used to illustrate the debugging features. It
is a simple program so that you can visualize each lines execution as it is being
debugged.
REM THIS IS A DEBUGGING EXAMPLE
{SORT EVEN NUMBERED POSITIVE ENTRIES}
{$L START}
INPUT ”ENTER A NUMBER: ”,Y
FOR X=1 TO Y
IF X*2=Y THEN GOTO DONE
NEXT X
PRINT ”NUMBER IS ODD OR LESS THAN 1, RESTARTING”
GOTO START
{$L DONE}
PRINT ”NUMBER IS EVEN”
END
After entering the program, save it under the name DEBUG.BDL, and then
translate/compile it. If there are no errors, go to Terminal mode and download the
translated file (DEBUG.BAS) to the module. Follow the steps below to observe the
features available with the BASIC Debugger:
1. After downloading, type RUN to execute the program. You are prompted to
enter a number. If not, you may have a bug in the program, using the debugger
may help you find it.
2. Enter an odd number (less than 100) and press
[Enter]. A message appears
indicating it is odd. You are prompted to enter a number again.
3. Enter an even number (less than 100) and press
[Enter]. A message appears
indicating it is even, and the program terminates.
4. Select
deBug from the menu at the top of the screen, then select Run
Debugger. If you have loaded a previously translated file for which a .MAP file
exists (as is the case with this example), a message appears indicating that
.MAP file will be used.
5. Press any key to continue. A split screen appears with your program
(DEBUG.BDL) above and a watch window below. The watch window is
where the variable values you designate will be displayed.
Vista de página 110
1 2 ... 106 107 108 109 110 111 112 113 114 115 116 ... 143 144

Comentários a estes Manuais

Sem comentários