Hallo Forum,
bisher konnte ich meine Problemchen mit Bascom durch reines Mitlesen hier im Forum oder durch Internetrecherche selbst lösen, aber jetzt benötige ich mal Eure Hilfe!
Ich mache Input über eine AT-Tastatur ( Textzeilen ) um diese später wieder auf einem LCD auszugeben. Dabei wird abgefragt:
Bank (Wertebereich A-H )
Key ( Wertebereich 1-8 )
macro_no. ( Wertebereich 1-4 )
Den eingegeben Text habe ich in der Variablen kb_textstring. Jetzt würde ich den gerne in Abhängigkeit der oben abgefragten Werte zuordnen:
If Key = 1 AND Bank = "A" And macro_no = 1 Then
1A1 = kb_textstring
Endif
If Key = 1 AND Bank = "A" And macro_no = 2 Then
1A2 = kb_textstring
Endif
If Key = 1 AND Bank = "A" And macro_no = 3 Then
1A3 = kb_textstring
Endif
If Key = 1 AND Bank = "A" And macro_no = 4 Then
1A4 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 1 Then
2A1 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 2 Then
2A2 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 3 Then
2A3 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 4 Then
2A4 = kb_textstring
Endif
usw.
Das wären 256 If Anweisungen bis ich die letze Variable 8H4 einem Textstring zugeordnet hätte. Ok, ich weiß, das macht man mit Arrays oder Select Case,
aber egal was ich auch ausprobiert habe ich bin immer irgendwie hängen geblieben. Irgendwie fehlt mir das logische Verständnis oder die Übung das in einem Array umzusetzen. Letztendlich soll die Ausgabe wie folgt erfolgen:
On Taster_1
Locate 1,1
LCD 1A1
Locate 2,1
LCD 1A2
Locate 3,1
LCD 1A3
Locate 4,1
LCD 1A4
ON Taster_2
Locate 1,2
LCD 2A1
Locate 2,1
LCD 2A2
usw. bis Taster 8 und Bank H
On Taster_8
Locate 1,1
LCD 8H1
Locate 2,1
LCD 8H2
Locate 3,1
LCD 8H3
Locate 4,1
LCD 8H4
Wer gibt mir ein paar Denkanstöße für eine elegantere Lösung?
Danke Vorab
8TO8
bisher konnte ich meine Problemchen mit Bascom durch reines Mitlesen hier im Forum oder durch Internetrecherche selbst lösen, aber jetzt benötige ich mal Eure Hilfe!
Ich mache Input über eine AT-Tastatur ( Textzeilen ) um diese später wieder auf einem LCD auszugeben. Dabei wird abgefragt:
Bank (Wertebereich A-H )
Key ( Wertebereich 1-8 )
macro_no. ( Wertebereich 1-4 )
Den eingegeben Text habe ich in der Variablen kb_textstring. Jetzt würde ich den gerne in Abhängigkeit der oben abgefragten Werte zuordnen:
If Key = 1 AND Bank = "A" And macro_no = 1 Then
1A1 = kb_textstring
Endif
If Key = 1 AND Bank = "A" And macro_no = 2 Then
1A2 = kb_textstring
Endif
If Key = 1 AND Bank = "A" And macro_no = 3 Then
1A3 = kb_textstring
Endif
If Key = 1 AND Bank = "A" And macro_no = 4 Then
1A4 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 1 Then
2A1 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 2 Then
2A2 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 3 Then
2A3 = kb_textstring
Endif
If Key = 2 AND Bank = "A" And macro_no = 4 Then
2A4 = kb_textstring
Endif
usw.
Das wären 256 If Anweisungen bis ich die letze Variable 8H4 einem Textstring zugeordnet hätte. Ok, ich weiß, das macht man mit Arrays oder Select Case,
aber egal was ich auch ausprobiert habe ich bin immer irgendwie hängen geblieben. Irgendwie fehlt mir das logische Verständnis oder die Übung das in einem Array umzusetzen. Letztendlich soll die Ausgabe wie folgt erfolgen:
On Taster_1
Locate 1,1
LCD 1A1
Locate 2,1
LCD 1A2
Locate 3,1
LCD 1A3
Locate 4,1
LCD 1A4
ON Taster_2
Locate 1,2
LCD 2A1
Locate 2,1
LCD 2A2
usw. bis Taster 8 und Bank H
On Taster_8
Locate 1,1
LCD 8H1
Locate 2,1
LCD 8H2
Locate 3,1
LCD 8H3
Locate 4,1
LCD 8H4
Wer gibt mir ein paar Denkanstöße für eine elegantere Lösung?
Danke Vorab
8TO8