LCD Menu Sample 1

Aus ProjectWiki
Wechseln zu:Navigation, Suche

This sample demonstrates the basic functions of the menu. It also uses the software timer library, but that's not necessary for the menu.

Menu structure

Menu structure simple.jpg

Menu data include file

$nocompile

Const Lcd_width = 16
Const Lcd_bar_style = 1
Const Lcd_bit_display_off = "Off"
Const Lcd_bit_display_on = "On"

Const Menu_entries_count = 9
Const Menu_default_entry = 1

Const Menu_values_use = True
Const Menu_values_edit_use = False
Const Menu_values_count = 1
Const Menu_value_bit_count = 0
Const Menu_value_byte_count = 0
Const Menu_value_word_count = 0
Const Menu_value_integer_count = 0
Const Menu_value_dword_count = 0
Const Menu_value_long_count = 0
Const Menu_value_single_count = 0
Const Menu_value_double_count = 0
Const Menu_value_string_count = 1

Goto Menu_data_jumpover

Menu_entries:
   ' Type, Text ID, Before, Next, Child
   Data Menu_link , 0 , 7 , 2 , 4                           ' 1, Submenu
   Data Menu_value , 5 , 1 , 3 , 1                          ' 2, Another Entry
   Data Menu_link , 6 , 2 , 7 , 3                           ' 3, 3rd Entry
   Data Menu_link , 1 , 6 , 5 , 2                           ' 4, Sub-Entry 1
   Data Menu_link , 2 , 4 , 6 , 8                           ' 5, Submenu 2
   Data Menu_link , 4 , 5 , 4 , 1                           ' 6, {127} Back
   Data Menu_exit , 7 , 3 , 1 , 0                           ' 7, {127} Exit
   Data Menu_link , 3 , 9 , 9 , 4                           ' 8, Entry
   Data Menu_link , 4 , 8 , 8 , 5                           ' 9, {127} Back

Menu_string_constants:
   Data "Submenu"                                           ' 0
   Data "Sub-Entry 1"                                       ' 1
   Data "Submenu 2"                                         ' 2
   Data "Entry"                                             ' 3
   Data "{127} Back"                                        ' 4
   Data "Another Entry"                                     ' 5
   Data "3rd Entry"                                         ' 6
   Data "{127} Exit"                                        ' 7

Menu_values:
   ' Type, Value Child, Step/ReadOnly (if 0), Min, Max, [Init value]
   Data Menu_value_string , 1 , 0                           ' 1, Another Entry

Macro Menu_varpointers
   Menu_value_varpointer(1) = Varptr(test_string)           ' Another Entry, entry: 2, value: 1
End Macro

Menu_string_characters:
   ' Table of characters used in string editing
   Data 254                                                 ' start of table, needed

   Data "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"

   ' special characters with function, these are needed
   Data Menu_character_backspace                            ' backspace
   Data Menu_character_finish                               ' finish string editing
   Data 254                                                 ' end of table

Menu_data_jumpover:

'(
###DESIGNER###
1f8b0800000000000400ecbd07601c499625262f6dca7b7f4af54ad7e074a10880601324d8904010
ecc188cde692ec1d69472329ab2a81ca6556655d661640cced9dbcf7de7befbdf7de7befbdf7ba3b
9d4e27f7dfff3f5c6664016cf6ce4adac99e2180aac81f3f7e7c1f3f22fec7bff71fdcfdf4374e76
7fe3e4f8c9c9d3d3679f7ffbec3bbfd7f32f5e7cf9f2275ebd7ef3d54f7ef7f7fe7d7e2addd9ddbb
b77fffd307070f7fe3e4cb25fdfffc9c5fd9e17fbfc897ebe7c5f2ed6f9cbc5e4f16f4c76f9cecf3
17fb9defb64f976d7d9dd2377bfcfdfdc8bb297d75c05f1df8dff29b0c91be7928df3cc9a6f4cd2f
dedd7bf04b52f9fd3e83fd74e86bc1784fbefec9ac5ce734ea65d5cef33ad50ef8d3d76d5d2c2fb8
f19bbc697fff46ff7e53e30d8172cfc7ee5e3d3300eef1b70fe4dbd377456b5090dfe9bb1ffff11f
3ffdf219fdfb1b27
###DESIGNER_END###
')

Main file