Shop OBEX P1 Docs P2 Docs Learn Events
Romvar question.... — Parallax Forums

Romvar question....

EGG09000EGG09000 Posts: 4
edited 2008-07-28 20:26 in BASIC Stamp
If my bs2 code was·· SEROUT 2,84, [noparse][[/noparse]RomVar ]· and if i wanted it to CR when it recieved a RomVar = "C"

If i used the debug it would be something like this,

· IF RomVar = "9"· THEN DEBUG "9"
· IF RomVar = "="· THEN DEBUG "="
· IF RomVar = "?"· THEN DEBUG "?"
· IF RomVar = "E"· THEN DEBUG "E"
· IF RomVar = "C"· THEN DEBUG "C"



·

Comments

  • EGG09000EGG09000 Posts: 4
    edited 2008-07-28 19:58
    How would i make it cr using the serout when reading a RomVar of "C"?
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-07-28 20:00
    IF RomVar = "C" THEN SEROUT 2, 84, [noparse][[/noparse]CR]

    Or was there something more complicated you had in mind?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-28 20:05
    I don't understand what you want to do. CR (carriage return) is a character like any other except that you can't put something between quotes to get it. The value is 13, so to transmit it, you'd put "SEROUT 2,84,[noparse][[/noparse] 13 ]". Some terminal programs will accept just a CR. By default, Windows expects the CR to be followed by a LF (line feed) whose value is 10. The default for the Mac OS is to use just a CR. For Linux, it's just a LF. To transmit CR followed by LF, you'd do "SEROUT 2,84,[noparse][[/noparse] 13,10 ]". As you might expect, you can combine this with other stuff in the same SEROUT statement. To output "OK" on one line, then "Try Again" on a second line do: SEROUT 2,84,[noparse][[/noparse] "OK",13,10,"Try Again",13,10 ]

    I'm not sure if CR and LF are predefined in Basic for the BS2. If not, you can define them with "CR CON 13" and "LF CON 10".
  • EGG09000EGG09000 Posts: 4
    edited 2008-07-28 20:07
    I am using it to read the eeprom. I am having trouble. You see its written like

    Download_Data:
    SEROUT 2,84, [noparse][[/noparse]"Downloading Data...",CR ]
    'PAUSE 20
    'DEBUG CR, "Downloading Data...", CR
    FOR DataSlot = 1 TO 15

    STORE DataSlot
    SEROUT 2,84, [noparse][[/noparse]CR, ? DataSlot ]
    ' PAUSE 20
    FOR RomLoc = 0 TO 2047

    SERIN 16, 16468, Cont_Download,1, Cont_Download, [noparse][[/noparse]Result]
    'SERIN 3, 84 , Cont_Download,1, Cont_Download, [noparse][[/noparse]Result]
    Cont_Download:
    IF Result = 27 THEN GOTO Start
    'IF RomVar = " " THEN Cont_Download:
    READ RomLoc, RomVar

    'DEBUG ? Romloc
    'DEBUG RomVar
    SEROUT 2,84, [noparse][[/noparse]RomVar ]

    PAUSE 10

    NEXT

    'STORE DataSlot
    PAUSE 5000
    NEXT
    GOTO Main
  • EGG09000EGG09000 Posts: 4
    edited 2008-07-28 20:23
    What is value 27?

    IF Result = 27 THEN GOTO Start
  • Mike GreenMike Green Posts: 23,101
    edited 2008-07-28 20:26
    You'll have to explain what you mean by "trouble" and what you're trying to do, what works, and what doesn't work.
Sign In or Register to comment.