How do I use BRANCH to determine what get's sent to an lcd without creating lar
beazleybub
Posts: 102
I am trying to use a branch statement to determine what·gets printed on an lcd screen but am having trouble.
How can I acomplish using something similar to below? "I know it's not right but you get the idea."
Edited to clarify the question.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can there be·nothing? Nothing is something!
Post Edited (beazleybub) : 8/18/2008 7:23:18 PM GMT
How can I acomplish using something similar to below? "I know it's not right but you get the idea."
English DATA "English" Spanish DATA "Spanish" GET 54, Work BRANCH Work,[noparse][[/noparse]N,E,S] N: E: English: S: Spanish: SEROUT 11, 240, [noparse][[/noparse]"?f?y0 LANGUAGE?y1?x07", [color=green]What Goes Here?[/color] ] RETURN
Edited to clarify the question.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can there be·nothing? Nothing is something!
Post Edited (beazleybub) : 8/18/2008 7:23:18 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Alternatively, you could put most of the SEROUT statement before the BRANCH and, at each label, put a SEROUT with only the language specific words like
The I used the data statement because of something I had looked at earlier that shows printing characters one at a time like what Mike has described below. I am not very familiar with using DATA.
What I am asking is how to send a specific word to the lcd based on the input.
As it is currently written my subroutine sends out the value of work in the serout to the LCD.
In my case it would be a "1" or a "2". But I wanted to substitute the "1" with "ENGLISH" and the "2" with "SPANISH".
I just do not understand how to inject·a text string into the serout statement instead of a decimal number.
Mike,
I will try to use your "alternitave" you have suggested if what I am asking for is what you are describing.
Thank you
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can there be·nothing? Nothing is something!
I know I am not the best wordsmith and I also do not understand how you read between the lines with my jumbled question.
Never less,·thank you very much your suggestion worked perfectly!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can there be·nothing? Nothing is something!
You can't "inject" a text string into a serout statement. PBasic doesn't really have text strings except as constants in I/O statements and DATA statements. As far as you're concerned, there are only single characters or small arrays of single characters. That's why you have to use a subroutine like I showed.
I must have used a word that is used in programming or something to get the response you just gave.
Not ("inject" programming word) but ("inject" place·text there).
What you had described as a subroutine I basically already knew because I even used something similar in another part of my program.
· And here...
I was looking for an alternitave though because I hoped to find a way to cut down on the program size.
If I used as an example say seven diferent languages the serout statement would be repeated so many times it would gobble up too much program space. I know I could use another subroutine for that but thought maybe that using something like.....
Would work to save space on the serout commands but was not sure how to accomplish that.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
How can there be·nothing? Nothing is something!
Some years ago I built a board for a customer which displayed data on a 4X40 LCD. The data had to be displayed in two languages. Due to the number of items that had to be displayed I used a BS2p24 and I assigned SLOT 1 to English selections and SLOT 2 to Spanish selections. This way the lookup subroutine needed only change the slot it was picking data from.
In your case I don’t know how much data you have, but if you have sufficient room for it and want to simplify lookup then you can always group the English and Spanish words together and then your program can simply add an offset to the English address when Spanish is selected. Of course, this requires the word fields to be the same length (English and Spanish words are often not), but in my case I padded each line of text for formatting anyway, so everything had the same relative offset.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering