Shop OBEX P1 Docs P2 Docs Learn Events
CR command after DEBUG Comment — Parallax Forums

CR command after DEBUG Comment

tucson.warrentucson.warren Posts: 8
edited 2012-07-30 10:55 in BASIC Stamp
Help, I'm new to basic stamp programming and purchased the Parallax BS2 project board with instruction book. The instruction book does not address very well exactly what the protocall for using the CR command at the end of a DEBUG comment statement is. Sometimes in there example program the command is: ,CR,CR, or ,CR,CR or just a single ,CR. Why all the different configurations? Can anyone explaine how the various combinations od CR and comma's work. I would really appreciate any input I can get. Thank You for your help. Warren

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2012-07-30 10:28
    It's up to the programmer to decide whether or not they want single spacing, double spacing etc.. The CR appear at eithere the beginning or at the end of the DEBUG statement. No matter where it is, it will move the cursor on the terminal down one line.

    Well, that isn't 100% correct. There is also LF, the linefeed. The DEBUG screen that comes up when you run a program, it automatically moves the cursor down one line and also back to the left edge of the screen. Some other terminal programs treat those as separate operations, and a program to deal with that kind of terminal has to include both CR and LF. Or else you have to find an option in the terminal program's configuration that will do both when either arrives.
  • tucson.warrentucson.warren Posts: 8
    edited 2012-07-30 10:45
    Hi Tracy, Thanks for you help. Could you explain the purpose of the Comma at the end of the CR command. It seems like some DEBUG statement lines have it like "statement", CR, CR, and some don't like: "statement" , CR, CR . I don't understand the logic of the comma. Thanks again. - Warren
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-30 10:55
    Commas are used as separators. A trailing comma indicates that the same DEBUG statement is continued on the next line, viz:
    DEBUG "Testing", CR,
      "123", CR
    

    This can be done to enhance readability when there is too much stuff to fit comfortably on one line or in order to visualize columnar alignment.

    -Phil
Sign In or Register to comment.