question regarding use of variables
Posted: Wed Apr 15, 2009 8:22 am
Hi
I'm writing a programme in flowcode that uses a keypad to determine what particular folder of music plays. The music is stored in various folders on a usb stick and the usb stick is plugged into a vmuisc2 module, whic in turn is connected to the pic microcontroller
Example
If keypad 1 is pressed then the following sequence occurs
vmusic 2 is stopped
folder change to CD\
folder is then changed to reflect the keypad button pressed - in this case it would be folder1
vmuic2 is started to repeat all mp3 tracks in folder1.
so this would be
VST (cr)
cd\ (cr)
cd folderx (cr) where x reflects the keypad button pushed
VPR (cr)
As I want to have upto 20 folders I'm looking at ways to shorten the number of decisions
At present I have a macro that says is myvariable (which is the return of getkeypad) = 1 - no; then go to next decision
is myvariable = 2 no; then go to next decision
This would require 20 decisions potentially one for each button in a 4 x 5 keypad
The only line that is different in each decision branch is the CD folderx line where x could be anything from 1 through to 20
I was wondring what could be done to reduce the number of the decisions
I've tried storing the keypad into eeprom and recalling it later as a variable to send to RS232 port but without success. At best I can get the RS232 send to change to a * which is basically saying it is a non printable character.
I guess my thought is to recall the keypad number selected so I can set it direct to RS232
Example
keypad value stored (somewhare as a variable)
component macros to send RS232
VST (cr)
cd/ (cr)
Cd folder
recall keypad variable
(cr)
VPR (cr)
The intent being to insert the keypad value directly after folder ( with no spaces) rather then have a decision for each possible value.
Any thoughts please
Regards
Ian Burrows
I'm writing a programme in flowcode that uses a keypad to determine what particular folder of music plays. The music is stored in various folders on a usb stick and the usb stick is plugged into a vmuisc2 module, whic in turn is connected to the pic microcontroller
Example
If keypad 1 is pressed then the following sequence occurs
vmusic 2 is stopped
folder change to CD\
folder is then changed to reflect the keypad button pressed - in this case it would be folder1
vmuic2 is started to repeat all mp3 tracks in folder1.
so this would be
VST (cr)
cd\ (cr)
cd folderx (cr) where x reflects the keypad button pushed
VPR (cr)
As I want to have upto 20 folders I'm looking at ways to shorten the number of decisions
At present I have a macro that says is myvariable (which is the return of getkeypad) = 1 - no; then go to next decision
is myvariable = 2 no; then go to next decision
This would require 20 decisions potentially one for each button in a 4 x 5 keypad
The only line that is different in each decision branch is the CD folderx line where x could be anything from 1 through to 20
I was wondring what could be done to reduce the number of the decisions
I've tried storing the keypad into eeprom and recalling it later as a variable to send to RS232 port but without success. At best I can get the RS232 send to change to a * which is basically saying it is a non printable character.
I guess my thought is to recall the keypad number selected so I can set it direct to RS232
Example
keypad value stored (somewhare as a variable)
component macros to send RS232
VST (cr)
cd/ (cr)
Cd folder
recall keypad variable
(cr)
VPR (cr)
The intent being to insert the keypad value directly after folder ( with no spaces) rather then have a decision for each possible value.
Any thoughts please
Regards
Ian Burrows