Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Creating String Arrays in PicBASIC

Status
Not open for further replies.

transistance

New Member
Code:
DEFINE OSC 4

scheme VAR word[10]
name VAR WORD[10]
i var byte
set var bit
bck var bit
fwd var bit

scheme[0] = "<    STANDARD E    >" : scheme[1] = "<    STANDARD Eb   >"
name[0]   = "  E  A  D  G  B  E  " : name[1]   = "  Eb Ab Db Gb Bb Eb "
scheme[2] = "<    STANDARD D    >" : scheme[3] = "<    STANDARD Db   >"
name[2]   = "  D  G  C  F  A  D  " : name[3]   = "  Db Gb B  E  Ab Db "
scheme[4] = "<    STANDARD C    >" : scheme[5] = "<    DROPPED D     >"
name[4]   = "  C  F  Bb Eb G  C  " : name[5]   = "  D  A  D  G  B  E  "
scheme[6] = "<    DROPPED Db    >" : scheme[7] = "<    DROPPED C     >" 
name[6]   = "  Db Ab Db Gb Bb Eb " : name[7]   = "  C  G  C  F  A  D  "
scheme[8] = "<    DROPPED B     >" : scheme[9] = "<      MANUAL      >"
name[8]   = "  B  Gb B  Fb Ab Db " : name[9]   = ""
 
pause 500

i = 0

menu:   lcdout $fe, 1,#scheme[i]
        LCDOUT $fe, $c0, #name[i]
poll:   if set = 0 then 
            I = 0
            goto tuning
        ENDIF
        IF bck = 0 then
            if i > 0 then i = i - 1
            else i = 9
            goto menu
        endif
        if fwd = 0 then
            if i < 9 then i = i + 1
            else i = 0
            GOTo menu
        endif
        goto poll

How can I create a string array in PICBASIC? I know that the above code doesn't compile, it's there so you get the general idea about what I'm trying to do.

Is there a less exhaustive approach to make such a menu work?

thanks,
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top