PDA

View Full Version : Romvar question....



EGG09000
07-29-2008, 02:56 AM
If my bs2 code was·· SEROUT 2,84, [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"



·

EGG09000
07-29-2008, 02:58 AM
How would i make it cr using the serout when reading a RomVar of "C"?

allanlane5
07-29-2008, 03:00 AM
IF RomVar = "C" THEN SEROUT 2, 84, [CR]

Or was there something more complicated you had in mind?

Mike Green
07-29-2008, 03:05 AM
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,[ 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,[ 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,[ "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".

EGG09000
07-29-2008, 03:07 AM
I am using it to read the eeprom. I am having trouble. You see its written like

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

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

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

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

PAUSE 10

NEXT

'STORE DataSlot
PAUSE 5000
NEXT
GOTO Main

EGG09000
07-29-2008, 03:23 AM
What is value 27?

IF Result = 27 THEN GOTO Start

Mike Green
07-29-2008, 03:26 AM
You'll have to explain what you mean by "trouble" and what you're trying to do, what works, and what doesn't work.