Serin
leshea2
Posts: 83
When I use this code, does the stamp serin the letters "ready", or the ASCII form of "ready" ?
' {$STAMP BS2sx}
' {$PBASIC 2.5}
YMTU··· VAR···· Word
GJH···· VAR···· Word
TGM··· DATA "God Bless The World !", 0
Main:
YMTU = TGM
GOSUB Main2
END
Main2:
SEROUT 16, 16624, [noparse][[/noparse]"ready"]
PAUSE 10
SERIN 16, 16624, [noparse][[/noparse]WAIT ("ready")]
GOSUB main3
END
Main3:
· READ YMTU, GJH
· YMTU = YMTU + 1
· PAUSE 100
· SEROUT 16, 16624, [noparse][[/noparse]GJH]
GOTO Main3
END
Thanks !
' {$STAMP BS2sx}
' {$PBASIC 2.5}
YMTU··· VAR···· Word
GJH···· VAR···· Word
TGM··· DATA "God Bless The World !", 0
Main:
YMTU = TGM
GOSUB Main2
END
Main2:
SEROUT 16, 16624, [noparse][[/noparse]"ready"]
PAUSE 10
SERIN 16, 16624, [noparse][[/noparse]WAIT ("ready")]
GOSUB main3
END
Main3:
· READ YMTU, GJH
· YMTU = YMTU + 1
· PAUSE 100
· SEROUT 16, 16624, [noparse][[/noparse]GJH]
GOTO Main3
END
Thanks !
Comments
SERIN 16, 16624, [noparse][[/noparse]WAIT ("ready")]
It's waiting to get the ascii "ready" -- which is altogether different from "READY" (it's case sensitive, meaing capitals make a difference) -- and it'll sit there WAITing till it gets a ready from the other device.· It comes in as a series of letters, for sure (r e a d y).
Make sense?
Edit --
By the way the quotation marks aren't part of what is sent from the device, or vice versa.
"16624" baudmode -- are you using a BS-2sx or BS-2p?
Post Edited (PJ Allen) : 2/14/2006 1:15:06 PM GMT
Is there a formatter that will allow me to fix this ? Thanks !
ready = $72 $65 $61 $64 $79
READY·= $52 $45 $41 $44 $59
Regarding your PC program -- is it sending "READY" or "ready"?· It makes a difference.
Post Edited (PJ Allen) : 2/14/2006 7:17:14 PM GMT
Thanks !
SERIN 16, 16624, [noparse][[/noparse]WAIT ("ready")]
GOSUB main3
END
Main3:
· READ YMTU, GJH
· YMTU = YMTU + 1
· PAUSE 100
· SEROUT 16, 16624, [noparse][[/noparse]GJH]
GOTO Main3
END
· If your STAMP is GOSUB'ing to Main3: then it is receiving the message "ready"; if it doesn't, then it's not.· Is your PC program sending the ASCII character numbers for the ASCII codes for "ready"?
· Given: SERIN 16, 16624, [noparse][[/noparse]WAIT ("ready")], the STAMP is waiting for a succession of bytes in the range of, I believe, $30 - $7A, furthermore those specified by that within the parentheses in succession.
· Why do you figure this isn't so?· Because your program doesn't GOSUB?
· I'd like to see an U/L of the program that you are using as opposed to "re-types".
Post Edited (PJ Allen) : 2/14/2006 10:37:56 PM GMT
I only have a BS2, but I tested the attached program.· It waits for my terminal program to send it the message "ready" (lower-case).· In response, it print out to my lcd the message "God Bless The World!"
Is that what you're looking for?
· If so, you need to D/L it and make these changes:
- change the Baudmodes from 16468 to 16624
- SEROUT 0 to SEROUT 16
- STAMP directive from {$STAMP BS2} to {STAMP BS2sx}
- Save it with a name of your choice·
It works for me -- it should work for you, too.·If not, why not?·
Post Edited (PJ Allen) : 2/14/2006 11:54:15 PM GMT
' {$STAMP BS2sx}
' {$PBASIC 2.5}
YMTU VAR Word
GJH VAR Word
TGM DATA "God Bless The World !", 0
Main:
YMTU = TGM
GOSUB Main2
END
Main2:
SERIN 16, 16624, [noparse][[/noparse]WAIT ("ready")]
PAUSE 10
READ YMTU, GJH
YMTU = YMTU + 1
IF (GJH = 0) THEN GOTO Main ELSE SEROUT 16, 16624, [noparse][[/noparse]GJH]
GOTO Main2
· The irritating thing is the echo back, but that's to be expected.·
· I've attached the program (ymtu3) --·all that needs to be modified are the Baudmodes and the Directive (for BS2sx.)· If it doesn't work, well,·then:· 1)·it's not getting the "ready" message (I think you're actually sending "READY") OR 2) there's a cabling fault (if it isn't the same one that you program your STAMP with.)
· Either way -- from this point, I'm out.· Anybody else wants in, you have my leave.
Your microcontroller is a digital device (for the most part) and it seens everything as 1's and 0's.· Like your home computer.
So, the number 1 is the same as 0000 0001 as number 25 is the same as 0001 1001....
There are HEX equivalents of these values and there are ASCII equivalents of these values......it's all really for aiding us humans in understanding what the controller is doing...but so far as the controller is concerned they're all just 1's and 0's!
So, in your controller you have to tell it how to output it.
This is right out of the help file for serout
"Keep in mind that when we type something like "XYZ" into the SEROUT command, the BASIC Stamp actually uses the ASCII codes for each of those characters for its tasks. We could also typed: 88, 89, 90 in place of "XYZ" and the program would run the same way since 88 is the ASCII code for the "X" character, 89 is the ASCII code for the "Y" character, and so on. "
There's also this 'special formatter' (I've never used this one)
so...I'd assume you could do this
serout 16, 16624, [noparse][[/noparse]ASC GJH],CR·· (The CR will drop each consequetive data on the next line...just makes things neat).
If you want to test to see what your program does....then drop some debug statements here and there just giving a progress report (see your code snippet).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Steve
"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
ymtu2.bs2 has SEROUT going to the LCD through "P0"
·
N.B. -- SEROUT 0, 16468, [noparse][[/noparse]$0C]············ 'this clears my serial LCD
In another Subject you posted, it looks like you are using a "parallel" LCD.· The above is for a serial LCD.· If your situation is like that in the Stampworks tutorial/s then you are using a parallel LCD and this won't work for you.
Post Edited (PJ Allen) : 3/10/2006 10:46:57 PM GMT