MediaWiki-API-Ergebnis

This is the HTML representation of the JSON format. HTML is good for debugging, but is unsuitable for application use.

Specify the format parameter to change the output format. To see the non-HTML representation of the JSON format, set format=json.

See the complete documentation, or the API help for more information.

{
    "batchcomplete": "",
    "continue": {
        "gapcontinue": "Static_Memory_Allocation",
        "continue": "gapcontinue||"
    },
    "query": {
        "pages": {
            "43": {
                "pageid": 43,
                "ns": 0,
                "title": "SPI DataFlash Library",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "== Overview ==\nThis library reads/writes Atmel AT25DF-compatible SPI DataFlash ICs (ex. Spansion S25FL) through either a SW or HW SPI interface.\nThe sample serves also as Firmware for the DataFlash Programmer application to write data to the memory.\nIt uploads a list of any type of files, image files are converted on the fly to the uncompressed 16-Bit color BIN format. To access the stored information, an include file with all the neccessary constants (memory position, size, image width & height) is generated.\n\nThe library has been developed and tested using an XMega-A1 Xplained board with a Spansion S25FL032P (32Mbit) dataflash mounted on it.\n\n\n[http://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=12892 Forum thread]\n\n\n== How to use ==\n\nInclude the library. Set the options above the $include statement, needs the new Submode.\n<pre>Config Submode = New\n\n\nConst Flash_port_spi = PORTC\n$include \"SpiFlash.inc\"</pre>\n\n\nInit the DataFlash SPI interface\n<pre>Sub Flash_init()</pre>\n\n\nRead the 81 Bytes JEDEC RDID information\n<pre>Sub Flash_get_info(byref Spiflashbuffer() As Byte)</pre>\n\n\nDisable the SPI interface\n<pre>Sub Flash_stop()</pre>\n\n\nErase a sector (64Kb block, upper 8 Bit of 24 Bit byte adress). The memory has to be erased (set to &HFF) before writing data.\n<pre>Sub Flash_sector_erase(byval Sector As Byte)</pre>\n\n\nErase the whole memory\n<pre>Sub Flash_bulk_erase()</pre>\n\n\nWrites a page to the memory (256 Bytes) to a specified page adress (upper 16 Bit of 24 Bit byte adress).\n<pre>Sub Flash_write_page(byval Address As Word , Byref Pagedata() As Byte)</pre>\n\n\nReads a block of data starting from the 24 Bit adress\n<pre>Sub Flash_read(byval Address As Dword , Byref Spiflashbuffer() As Byte , Byval Length As Word)</pre>\n\n\nReads a block of data from the flash memory to an SRAM adress\n<pre>Sub Flash_readto(byval Sourceaddress As Dword , Byval Destinationaddress As Dword , Byval Length As Dword)</pre>\n\n\nStart an asynchronous read sequence. Data can be read byte-wise from the 24 Bit start adress until Flash_endread() is called.\n<pre>Sub Flash_beginread(byval Address As Dword)</pre>\n\n\nReads a Byte (needs Flash_beginread() first)\n<pre>Function Flash_readbyte() As Byte</pre>\n\n\nStop a read sequence\n<pre>Sub Flash_endread()</pre>\n\n\n=== Options ===\nOptions and settings need to be set before the $include-statement, every setting has a default value that will be used if not specified otherwise. (in the list below the default values for the ATXMega are shown, values for ATMega are written in brackets () if applicable).\n\n\nSet to true to use software SPI instead of hardware modules, any GPIOs will work.\n<pre>Const Flash_use_soft_spi = False</pre>\n\n\nFalse only configures the SS pin, does not enable and configure the SPI interface, this needs to be done manually (useful if the memory shares the SPI interface with other hardware).\n<pre>Const Flash_init_spi = True</pre>\n\n\nSets the port of the SPI interface.\n<pre>Const Flash_port_spi = Portc (Portb)</pre>\n\n\nSet the SPI pins (CS, CLK, SDO and SDI are set to the hardware SPI pins by default)\n<pre>Const Flash_pin_cs = 4 (0)</pre>\n<pre>Const Flash_pin_clk = 7 (1)</pre>\n<pre>Const Flash_pin_sdo = 5 (2)</pre>\n<pre>Const Flash_pin_sdi = 6 (3)</pre>\n\n\n(HW SPI) If the memory's SS signal is not connected to the HW SPI CS pin, the correct pin needs to be set:\n<pre>Const Flash_port_ss = Flash_port_spi</pre>\n<pre>Const Flash_pin_ss = Flash_pin_cs</pre>\n\n\nEnable the status LED. Active during ongoing transmissions.\n<pre>Const Flash_enable_statusled = False</pre>\n\n\nInvert the status LED (active low)\n<pre>Const Flash_invert_statusled = False</pre>\n\n\nSet the pin of the status LED\n<pre>Flash_statusled Alias Porte.0 (Porta.0)</pre>\n\n\n=== Electrical connection ===\n[[File:FlashConnectionSchem.jpg|width|600px|SPI DataFlash connection schematic]]\n\nOnly a handful small components are needed to connect the memory. The status LED is optional.\n\n\n== Sample ==\nThis sample also serves as firmware to program the memory with the DataFlash Programmer application, works for both ATMega and ATXmega devices.\n<pre>$regfile = \"xm128a1def.dat\"\n'$regfile = \"m128def.dat\"\n$crystal = 32000000\n$hwstack = 64\n$swstack = 64\n$framesize = 64\n\nConfig Submode = New\nConst False = 0\nConst True = 1\n\n' XMega settings\n#if _xmega = True\n   ' sets the clock frequency using the PLL with the internal 2MHz oscillator\n   $include \"XMegaPll.inc\"\n\n   ' Host communication\n   Config Com1 = 115200 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8\n\n   ' use the watchdog for communication timeouts\n   Config Watchdog = 1000\n\n   ' Xplained DataFlash SS\n   Const Flash_port_ss = Portq\n   Const Flash_pin_ss = 2\n\n' ATMega settings\n#else\n   ' Host communication\n   $baud = 115200\n   Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0\n\n   ' use the watchdog for communication timeouts\n   Config Watchdog = 1024\n#endif\n\nOpen \"COM1:\" For Binary As #1\n\nConst Flash_enable_statusled = True                                             '\n$include \"SPI-Flash.inc\"\n\nDim Flashbuffer(256) As Byte\nDim Shakedhands As Boolean\nDim Sector As Byte , Page As Word , Address As Dword\n\nFlash_init\n\nDo\n   ' wait for command\n   Inputbin #1 , Sector\n   Select Case Sector\n\n   ' Handshake/Exit\n   Case &HAA:\n      Shakedhands = Not Shakedhands                                             ' some kind of accidental write protection\n      Printbin #1 , &HF0                                                        ' ack\n\n   ' erase a sector (address bits 23..16)\n   Case &H01:\n      Reset Watchdog\n      Start Watchdog\n      Inputbin #1 , Sector                                                    ' read sector address\n      Stop Watchdog\n      If Shakedhands = True Then Flash_sector_erase Sector\n      Printbin #1 , &HF0                                                        ' ack\n\n   ' erase whole memory\n   Case &H02:\n      If Shakedhands = True Then Flash_bulk_erase\n      Printbin #1 , &HF0                                                        ' ack\n\n   ' write a page (256 Bytes, address bits 23..8)\n   Case &H03:\n      Reset Watchdog\n      Start Watchdog\n      Inputbin #1 , Page                                                    ' read page address\n      Inputbin #1 , Flashbuffer(1) ; 256                                        ' read 256 bytes page data\n      Stop Watchdog\n      Swap Page\n      If Shakedhands = True Then Flash_write_page Page , Flashbuffer(1)\n      Printbin #1 , &HF0                                                        ' ack\n\n   ' read a page (256 Bytes, address bits 23..8)\n   Case &H04:\n      Reset Watchdog\n      Start Watchdog\n      Inputbin #1 , Page                                                    ' read page address\n      Stop Watchdog\n      Swap Page\n      Address = Page\n      Shift Address , Left , 8\n      If Shakedhands = True Then Flash_read Address , Flashbuffer(1) , 256\n      Printbin #1 , Flashbuffer(1) ; 256                                        ' write page data\n\n   ' read the device ID data (81 Bytes)\n   Case &H05:\n      If Shakedhands = True Then Flash_get_info Flashbuffer(1)\n      Printbin #1 , Flashbuffer(1) ; 81\n\n   End Select\nLoop</pre>\n\n\n=== Application example (XMega-A1 Xplained) ===\nLoad all data from flash memory to the extended SRAM memory for faster access:\n<pre>$regfile = \"xm128a1def.dat\"\n$crystal = 32000000\n$hwstack = 64\n$swstack = 64\n$framesize = 64\nConfig Submode = New\n\nConst False = 0\nConst True = 1\n\n' use the XMega PLL clock system to set the desired system clock frequency\n$include \"XMegaPll.inc\"\n\n'the XPLAIN has a 64 MBit SDRAM which is 8 MByte, it is connected in 3 port, 4 bit databus mode\n'in the PDF of the SDRAM you can see it is connected as 16 Meg x 4. Refreshcount is 4K and the row address is A0-A11, column addressing is A0-A9\n$xramsize = 8388608                                                             ' 8 MByte\nConfig Xram = 3port , Sdbus = 4 , Sdcol = 10 , Sdcas = 3 , Sdrow = 12 , Refresh = 500 , Initdelay = 3200 , Modedelay = 2 , Rowcycledelay = 7 , Rowprechargedelay = 7 , Wrdelay = 1 , Esrdelay = 7 , Rowcoldelay = 7 , Modesel3 = Sdram , Adrsize3 = 8m , Baseadr3 = &H0000\n'the config above will set the port registers correct. it will also wait for Ebi_cs3_ctrlb.7\nConst Xramstart = _hwstackstart + 1                                             ' the address where XRAM data space starts\nConst Xramend = Xramstart + _xramsize                                           ' end address\n\n'Const Flash_use_soft_spi = True                                                  ' uncomment to use SW SPI (works on any GPIO)\nConst Flash_port_ss = Portq                                                     ' set to select a different pin as SS instead of the dedicated HW SPI module's\nConst Flash_pin_ss = 2\n$include \"SPI-Flash.inc\"                                                        ' include the library\n$include \"DataFlashFiles.inc\"                                                   ' include the file info constants written by the DataFlash Programmer application\nConst Xramdataend = Xramstart + Flash_totalsize                                 ' calculate the start of free SRAM memory after loading the data from the flash memory\n\nDim Sram_file_address As Dword\n\n' load all the data stored in the flash memory into the extended SRAM memory for faster access\nFlash_init                                                                      ' init the SPI interface\nFlash_readto 0 , Xramstart , Flash_totalsize                                    ' load all data at once into the SRAM\nFlash_stop                                                                      ' stop the SPI interface\n\n' the file addresses are now calculated as follows:\nSram_file_address = Xramstart + Flash_myfile_bin</pre>\n\n\n== DataFlash Programmer ==\nThe SPI DataFlash Programmer application allows in-circuit programming of the memory over a serial connection. It uploads any types of files, images files (BMP, JPG, PNG, TIFF) can be converted to the uncompressed 16 Bit color BIN format on the fly when writing the data (standard).\n[[File:SpiDataFlashProgrammer.jpg|SPI DataFlash Programmer application]]\n\nTo use this application, the sample from above has to be programmed in the microcontroller, set up the SPI and the USART interface correctly.\nOn the left side, choose the files to upload, rearrange them as you need and choose whether to convert image files to BIN by checking the box (initially checked for images) or upload them as they are by unchecking (does not affect other file types).\nSelect the correct port and baudrate for the communication to the device, the \"R\" button refreshes the available serial port list.\nDuring the programming process, the File addresses include file is written, which contains information about the stored files (start address, size, width & height for images) as constants.\nBecause page writes can't change 0's to 1's, the memory needs to be erased (sets everything to 1) before writing data to it. Erasing is done sector-wise, which are 64Kb blocks. This is done automatically during programming process for each sector containing pages to write. You can skip this sector-erasing by ticking the checkbox, only page writes are executed. Bulk erase could be used instead, this erases the whole memory at once (takes a while).\nIf the DataFlash device supports the JEDEC RDID command (likely), \"Read Flash Info\" displays these informations.\n\"Write to file...\" writes the resulting data stream into a binary file instead of programming a memory.\nAt least, a file list in .txt format (one file path per line), containing the files to write, can be saved or loaded.\n\n\n== Download ==\n* [http://www.braunecker.at/downloads/dataflash/SpiFlash.zip SPI DataFlash Library 1.0]"
                    }
                ]
            },
            "8": {
                "pageid": 8,
                "ns": 0,
                "title": "Simple LCD Menu Main Page",
                "revisions": [
                    {
                        "contentformat": "text/x-wiki",
                        "contentmodel": "wikitext",
                        "*": "== Overview ==\nThis is a menu system for standard alphanumerical LC-displays.\n\nTo navigate through the menu, only 3 buttons are needed: Forward, Backward and Menu/Enter (or a rotary encoder with push button).\n\nYou can make multiple nested sub-menus, hidden menus (not supported by the designer yet), function calls and display or edit different value types (Bit, Byte, Word, Integer, DWord, Long, Single, Double, String).\n\nThe menu structure and associated data is stored in arrays at runtime, the structure is made by connecting the right entries together (with their array indexes).\n\nNumerical values are displayed both as value and as a [[LCD Bargraph with different styles|bargraph]] showing the current position in the specified range.\n\nBit values can be set to On/Off (or another custom text), numerical values will be increased/decreased by the specified step size and string values can be edited using a custom set of characters (and two special characters for backspace/enter). Read-Only values just show the content of a variable.\n\nEditable values could be preserved in EEPROM by option, stored values are loaded automatically in the init routine.\n\nTo save program space, just the pieces of code you use are compiled. You get the smallest size if you just use Links and Function Calls, it will increase if you use values (read-only, editable or both) and for each data type used.\n\n== Video Demo ==\nWatch this [http://www.vimeo.com/25921689 video] to see it in action.\n\n== How to use it ==\n=== Setup ===\nInclude the menu structure created with the designer and the menu functions:\n<pre>Macro Menu_include_data\n   $include \"inc\\menu_data.bas\"\nEnd Macro\n$include \"inc\\menu.bas\"</pre>\n\n=== Dimension used Variables ===\nBetween the function include and the initialisation you have to dimension the variables used to display or edit in the menu:\n<pre>Dim Test_bit As Byte\nDim Test_byte As Byte\nDim Test_word As Word\nDim Test_integer As Integer\nDim Test_dword As Dword\nDim Test_long As Long\nDim Test_single As Single\nDim Test_double As Double\nDim Test_string As String * Menu_value_string_width</pre>\nBit data types have to be defined as a byte.\nNote that a constant was created containing the maximum string size.\n\n=== Initialisation ===\n<pre>Menu_init</pre>\n\n=== Main Loop ===\n<pre>Do\n   If Switch_minus = 1 Then Menu_backward()            ' back button pressed\n   If Switch_plus = 1 Then Menu_forward()              ' forward button pressed\n   If Switch_enter = 1 Then                            ' enter button pressed\n      Select Case Menu_enter()\n      Case Menu_exit:                                  ' Exit entry selected\n         ...\n      Case 2-255:                                      ' Function call\n         ...\n      End Select\n   End If\n   Menu                                                ' Main function\n   ...\nLoop</pre>\n\n\n== Interface description ==\n<pre>Const Menu_default_entry</pre>\nID of the default entry\n\n\n<pre>Const Menu_value_string_width</pre>\nsize for strings used to display\n\n\n<pre>Macro Menu_init</pre>\nloads the menu data\n\n\n<pre>Macro Menu_check_update</pre>\ncall this macro in the time interval you wish to update read-only values\n\n\n<pre>Declare Sub Menu()</pre>\nMain function, called in Main Loop\n\n\n<pre>Declare Sub Menu_forward()</pre>\nGoes one step forward in the menu or while in edit mode, bit values are set to true, numerical values are increased by the step size and for strings, the following character in the table will be selected.\n\n\n<pre>Declare Sub Menu_backward()</pre>\nGoes one step backward in the menu or while in edit mode, bit values are set to false, numerical values are decreased by the step size and for strings, the preceeding character in the table will be selected.\n\n\n<pre>Declare Function Menu_enter() As Byte</pre>\nShows the menu if inactive, follows a link, enters/exits the edit mode, adds a character in string edit mode or selects a function\n\n\n<pre>Declare Sub Menu_show(byval Entry_id As Byte)</pre>\nDisplays the menu with the provided entry id, if 0, the default entry is selected\n\n\n<pre>Declare Sub Menu_hide()</pre>\nhides the menu\n\n\n<pre>Const Menu_eeprom_start = 1</pre>\nOptional parameter for the EEPROM start address, default value is 1. To use another adress set the constant before the include directive:\n<pre>...\nConst Menu_eeprom_start = 123\n#include \"menu.inc\"\n...</pre>\n\n\n<pre>Const Menu_eeprom_size = xxx</pre>\nThe size in bytes the menu uses in EEPROM to preserve values. This constant is defined in the menu data file.\n\n\n<pre>Const Menu_eeprom_end = xxx</pre>\nPoints to the first unused memory location after the menu data in EEPROM (defined in menu.inc).\n\n== LCD Menu Designer ==\n=== Global Settings ===\n[[File:Menu_designer_settings.jpg|Global menu settings]]\n\nWhen the first entry in the menu tree is selected, the global settings are visible. Here you can select the LCD character width, the visual style for the [[LCD Bargraph with different styles|bargraph]], edit the character table used in string edit mode and choose the texts to display for bit values (Default is On/Off, you can set it for example to Yes/No or High/Low etc.).\n\n=== Link ===\n[[File:Menu_designer_link.jpg|Entry is a link, select the target]]\n\nWith links you can jump to another entry in the menu, just select it in the right menu tree.\nSubmenu- and Back entries are also links, but the target is created automatically.\n\n=== Value ===\n[[File:Menu_designer_value.jpg|Value settings]]\n\nSelect the variable type (all Bascom types are supported) and choose if the value should be editable or read-only.\nIn the \"Associated variable\" field enter the Variable name you declared in your code.\nThen set the range of the value (lowest and highest possible value).\nIf the value is editable, you further have to set its initial value (will be set in Menu_init) and, if its a numerical value, the step size (positive, > 0).\nEditable values could also be preserved in EEPROM. On startup, values stored in EEPROM are loaded to the linked variables. If no values have been saved before/data is not valid (ex. the menu structure changes), they will be set to the initial value. When exiting the edit mode, the updated value is stored in EEPROM for the next startup.\n\n=== Function ===\n[[File:Menu_designer_function.jpg|Function ID select]]\n\nSelect a function ID between 2 and 255. When this entry is selected, the menu hides and the Menu()-function returns the ID.\n\n=== Tool: Character Table ===\n[[File:Menu_designer_character_table.jpg|Tool: interactive LCD character table]]\n\nWith this little tool it is easy to get the corresponding code for characters supported by alphanumerical LCDs.\nClick on the desired character, the calculated code, formatted ready to use in Bascom strings, appears in the text field below.\n\n== Samples == \n=== Sample 1: Small menu ===\nBare sample with minimal functions\n[[LCD Menu Sample 1]]\n\n=== Sample 2: All functions ===\nComplete sample demonstrating all functions of the menu\n[[LCD Menu Sample 2]]\n\n=== Sample 3: All functions, simulation ===\nUses the same menu as in [[LCD Menu Sample 2]], but is optimized for use in the simulator, button events are generated using the serial connection.\n\n=== Sample 4: All functions, Arduino M2560 + LCD Keyboard Shield ===\nUses the same menu as in [[LCD Menu Sample 2]], runs on off-the-shelf hardware Arduino M2560 and the LCD Keyboard shield.\n\n== Download ==\n* [http://www.braunecker.at/downloads/lcd_menu/setup_lcd_menu_1_5.exe LCD Menu Version 1.5]\n\nTo install the Menu Designer, run setup_lcd_menu_*_*.exe with administrator privileges.\n\n\nold Versions:\n* [http://www.braunecker.at/downloads/lcd_menu/setup_lcd_menu_1_4.exe LCD Menu Version 1.4]\n\n== Changelog ==\n=== Version 1.5 (21.11.2017) ===\nEnhancements:\n* Added option to preserve editable values in EEPROM\n* Changed file extensions from .bas to .inc\n* Added menu entry move up/down buttons\nBug fixes:\n* Exported wrong count of values of type Long\n* Exported wrong data for Dword data types\n* Minor bug fixes\n\n=== Version 1.4 (21.05.2014) ===\nEnhancements: \n* Menu Tree Drag and Drop function\n* Automatic Check & File copy of Bascom sources in the data file location\n* Toolbar button to locate the Bascom source files\nBug fixes:\n* Save function stopped saving the embedded Menu Designer data\n* Update Component was broken, so you have to manually download & install V.1.4, sorry for that\n* It was possible to enter longer strings than the max string length, following memory was overwritten\n* R23 is used in the timer ISR, but was not saved\n\n=== Version 1.3 (11.08.2013) ===\n* in some constellations, the designer gave false child IDs to value entries.\n* the read-only state of bit variables was taken from their start value\n* minor bug fixes\n\n=== Version 1.2 (07.12.2011) ===\n* fixed a major bug when using Function-entries\n* LCD width was set to 0 if the default value was changed\n* new setup routine\n* automatic updates (searches on startup, shows a notification if a new version is available and installs it)"
                    }
                ]
            }
        }
    }
}