alphanumeric string question
guydb
Posts: 29
here's my problem:
I am using a stamp (sx) to control professional pioneer dvd players and this works perfectly, but now, instead of lugging my computer over to the controller each time, I would like a small interface with numeric keypad and lcd display. the keypad and display are working perfectly as well and there would be no problem if I would only need to upload numbers to the dvd players, but the required code looks as follows:
SEROUT tx6,16624,1,[noparse][[/noparse]"FR27657PL",CR] (indicating "play up to frame 27657")
What I want to do is implement (in the case of the example) 27657 with the keypad using 'write' to store it in the eeprom from where the stamp can read it at start up and send it to the dvd player. But how do I make 'FR27657PL" from 27657???
I guess either it cannot be done or it is very easy and I don't see it.
any help would be most welcome.
thanks
Guy
I am using a stamp (sx) to control professional pioneer dvd players and this works perfectly, but now, instead of lugging my computer over to the controller each time, I would like a small interface with numeric keypad and lcd display. the keypad and display are working perfectly as well and there would be no problem if I would only need to upload numbers to the dvd players, but the required code looks as follows:
SEROUT tx6,16624,1,[noparse][[/noparse]"FR27657PL",CR] (indicating "play up to frame 27657")
What I want to do is implement (in the case of the example) 27657 with the keypad using 'write' to store it in the eeprom from where the stamp can read it at start up and send it to the dvd player. But how do I make 'FR27657PL" from 27657???
I guess either it cannot be done or it is very easy and I don't see it.
any help would be most welcome.
thanks
Guy
Comments
·· Have you tried:
You could store strings in DATA statements, then send them out via SEROUT, one character at a time.· The 0 ends a particular string.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
SEROUT SerPin, SerBaud, STR Codes
If he put it in a DATA statement that way?
FrameVal VAR WORD
FrameVal = 27657
SEROUT tx6,16624,1,[noparse][[/noparse]"FR", DEC FrameVal, "PL",CR] (indicating "play up to frame 27657")
·· This won't work for two reasons...One, the data in a SEROUT statement needs to be inside [noparse]/noparse.· Second, the STR doesn't work on a DATA statement.· Only an array.· Anyway, after re-reading the original message, I see he wants to be able to input data in real-time...I thought he wanted presets originally, and thus the DATA statements.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Msg··· DATA··· "FR00000PL", CR, 0
Here's a subroutine that updates the frame string with a number stored in "theFrame":
Update_Cmd:
· FOR idx = 0 TO 4
··· temp = theFrame DIG (4 - idx) + "0"·· ' extract digit, convert to ASCII
····WRITE (Msg + 2 + idx), temp·········· ' write to embedded command string
· NEXT
· RETURN
And, finally, to send the message:
Send_Cmd:
· FOR idx = 0 TO 15
··· READ (Msg + idx), temp
··· IF (temp = 0) THEN EXIT
··· SEROUT Tx, Baud, [noparse][[/noparse]temp]
· NEXT
· RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
this would be perfect if it works, I have no idea how the players will like the original string ("FRxxxxPL") spelled as "FR",xxxx,"PL". Otherwise Jon's solution seems very elegant. As soon as I get back to the machines I will try it.
The general idea is:
I turn on the stamp, I get a little message on the display asking me whether I want to implement a new figure or just go ahead. If I choose to implement a new figure it write the new figure in the eeprom and will use it each time the stamp is started up and the user chooses to go on instead of implementing a new figure. and the real life situation is as follows: I put together the stamp for friends who show art videos on a continuous schedule, often on two players that have to be synched (hence the need for a controller instead of somebody that has to be around every 30 minutes). Every two or three months they change their program and I have to go up there with my computer to reprogram the stamp with the new figures and I figured it would be much easier if they could do it themselves with a little interface (they are computer illiterates).
SEROUT Tx, Baud, 1, [noparse][[/noparse]"FR", DEC5 frameVal, "PL", CR]
This will give the same output as my verbose version, but with far less code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
what "SEROUT Tx, Baud, 1, [noparse][[/noparse]"FR", DEC5 frameVal, "PL", CR]" actuall puts on the serial line is:
FR28999PL<CR> -- Where <CR> is replaced by the character value ascii 13
The "FR"... etc are formatting indicators to the SEROUT command, the quotes are not actually sent.