Home
Section 4.4
Contents
1. Save as type field to All Files as shown in Figure 4 43 to allow 4 4 3 7 the current text file to be saved with an extension such as BAT other than TXT Give the batch file a name ending with bat as shown in Figure 4 43 and click 4 4 3 8 Save This will create a new batch file with the given name in the directory selected in step 4 4 3 6 Vincent A Rosa Florida Gulf Coast University Page 8 of 19 Spring 2009 Atmel AVR STK500 4 4 3 9 Communicating with a User Manual Host PC and Temperature Sensor Save As ey rx Save in O stk500_exarmple v amp bi E gt fie A M Stk500 exe ite ES stk500_prog hex My Recent Documents Desktop yu My Documents 33 My Computer a File name stk 500_program_lHazh bat w My Network Save as type All Files v Encoding ANS pm Figure 4 43 Screenshot of an instance of the Save As window Add the desired commands within the editor window 4 4 3 10 While pressing the control key CTRL on the keyboard press the s key to save the batch file 4 4 3 11 Click the X in the top right corner of the editor window to close the Notepad application shown in Figure 4 44 Vincent A Rosa Florida Gulf Coast University Page 9 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor stk500_program_flash bat Notepad i opg File Edit Format view Help Figure 4
2. when both are used This prevents duplicate definitions for variables with the same names that are contained in both header files Both of the tips given here are implemented and commented upon within the serial program in Appendix A 2 2 2 4 4 3 Programming the STK500 from a Remote Location An application to program the STK500 needs to be located on its host This application must also be made available for the web server to execute when some remote user chooses to program the board via a website A batch file can be used as the application that programs the board and a PHP function can be used to execute this batch file when a remote user makes a request e g pushes a button to program the board from the website Before the board is programmed however the user must upload an appropriate HEX or ROM application to the server The server must then send the uploaded application to the host of the STK500 Since the host and the server are the same machine for this project the latter step can be omitted Vincent A Rosa Florida Gulf Coast University Page 3 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor The PHP code in Appendix section A 2 2 4 provides an example on how to achieve uploading files to the server and how to execute a program installed on the server It is important to use proper directories and file names For this project the batch file is placed in the same directory as th
3. and 4 4 3 Vincent A Rosa Florida Gulf Coast University Page 1 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor myi WI Atmel Host Computer LM75 STK500 l Web Server Temperature Software Sensor System 1 5 13 14 Pinout l ia J ms vas Od IML y Figure 4 36 Context diagram of the data acquisition system formed with a myTWI Temperature Sensor an STK500 evaluation board and a host PC also acting as a web server 4 4 2 Preparing the Host for Web Access Some sort of database installed on the server is needed to store any data acquired from the STK500 This data can then be made available to remote users via a website such as the one given by the HTML and PHP code in Appendix A 2 2 4 The website software will query the database for the information requested by some remote user For simplicity this project uses a flat text file txt rather than a database It is possible to retrieve and store data from the STK500 via HyperTerminal HyperTerminal receives data via RS 232 serial communication and then can save them into a text file However the data will only be saved once the HyperTerminal session is closed This poses a problem since a networked DAQ system should allow for the host to continuously Vincent A Rosa Florida Gulf Coast University Page 2 of 19 Spring 2009 Atmel AVR STK500 Communicating with a Us
4. http 69 88 163 18 vincent Functions ReadTemps php E z m Page C Tools H4290004 05 19 2009 17 07 46 19 0eC 66 20F H4290004 05 19 2009 17 08 24 19 00C 66 20F H4290004 05 19 2009 17 09 02 19 0eC 66 20F H4290004 05 19 2009 17 09 40 19 00C 66 20F H4290004 03 19 2009 17 10 17 19 00C 66 20F H4290004 03 19 2009 17 10 55 19 00C 66 20F H4290004 05 19 2009 17 11 32 19 00C 66 20F H4290004 03 19 2009 17 12 11 19 00C 66 20F H4290004 05 19 2009 17 12 48 19 00C 66 20F H4290004 05 19 2009 17 13 26 19 00C 66 20F Done Internet R 100 7 Figure 4 48 Screenshot of the DAQ results page for the sample website 4 4 4 3 Click on the link shown in Figure 4 47 labeled Click here to download all recorded temperature readings to do as it says Depending on the settings of the browser being used the file will be loaded and displayed over the current window in a new tab window or the browser will prompt to save the file to the local machine If the first happens click on the back button of the browser to go back to the website homepage 4 4 4 4 To select the desired HEX file to upload to the server click on the Browse button shown in figure 4 49 This is the file that will be programmed to the flash memory of the target MCU installed on the STK500 Vincent A Rosa Florida Gulf Coast University Page 15 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Load a HEX Applicat
5. http 69 88 163 18 vincent Functions UploadFile php tal t X Pi w ai http 69 88 163 18 vincent Functions UploadFile php a z m v 7 Page iG Tools j Upload stkS00_prog hex Type text plain Size 146484575 Kb Temp file C WINDOWS Temp phpC8 amp D tmp Stored in C Inetoub wwwroot vincent UploadedFiles stk500 prog hex Program the STK500 Back Done Internet 100 Figure 4 52 Screenshot of the results page after uploading a file to the server via the sample website 4 4 4 7 To program the target MCU installed on the STK500 click on the button labeled Program the STK500 within the results window shown in Figure 4 52 Click on the Back link to go back to the homepage without programming the board The results shown in Figure 4 53 should display if the board is successfully programmed This also means that the application started execution right after being loaded Vincent A Rosa Florida Gulf Coast University Page 17 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor http 69 88 163 18 vincent Functions ExecBat php Windows Internet Explorer x i i h d http 69 68 163 16 vincent Functions ExecBat php a 4 X Bie hea ww ake http 69 88 163 18 vincent Functions ExecBat php E 3 m Fage Gi Tools D Internet 100 Figure 4 53 Screenshot of the results page after successf
6. no mistakes are found and the errors persist refer to Appendix section A 3 to troubleshoot the possible causes This concludes writing a sample batch file that will erase the flash contents of the ATmega8515L MCU The STK500 User Guide 1 has a complete list and explanation of all viable commands for the STK500 DOS programmer The batch file in Appendix A 2 2 3 Vincent A Rosa Florida Gulf Coast University Page 12 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor provides a more complete example with comments on how to better utilize batch files to program an STK500 4 4 4 Website Operation The following instructions explain how to operate the sample website given by the code presented in Appendix section A 2 2 4 Steps 4 4 4 2 and 4 4 4 3 explain how to view the data acquired from the myTWI to STK500 data acquisition system formed in section 4 1 3 of this document Steps 4 4 4 4 through 4 4 4 8 explain how to program the STK500 in this same DAQ system Internet Explorer is the web browser used to provide screenshots for this set of instructions 4 4 4 1 Go to lt http 69 88 163 18 vincent index html gt in a web browser e g Internet Explorer or Firefox This is the web address to the sample website that allows for data acquisition and remote programming both with respect to the STK500 evaluation board that has an ATmega8515L MCU installed in one of its target sockets Figure
7. 4 46 shows a screenshot of the homepage Vincent A Rosa Florida Gulf Coast University Page 13 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Atmel AVR STKS500 Web Access and Remote Programming Last 10 Temperature Readings Load a HEX Application File to Program the Board GetData Filename hex only Browse Upload Click here to download all recorded temperature readings Dane Internet 100 Figure 4 46 Screenshot of the sample website used to remotely access the myTWI to STK500 data acquisition system 4 4 4 2 To display the last ten temperature readings obtained by the host server from the STKS500 click on the Get Data button shown in Figure 4 47 The results should load and display over the current browser window and should look similar to those shown in Figure 4 48 Click on the link labeled Back to return to the homepage Vincent A Rosa Florida Gulf Coast University Page 14 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Last 10 Temperature Readings Click here to download all recorded temperature readings Figure 4 47 Screenshot of the DAQ portion of the sample website e http 69 00 169 10 vincent Functions ReadTemps php Windows Internet Explorer Oleg E http 69 88 163 1e vincenk Fuinchone ReadTemps pho Ja X wot a wat aby
8. 44 Screenshot of the Notepad editor opened to the empty file stk500_program_flash bat This concludes how to create a batch file The requirements for writing a batch file to program an STK500 parallel those established in section 4 2 1 which explains how to program an STK500 using the Windows command line utility CMD The following instructions can be used to write a sample batch file that will erase the contents of the target MCU installed on the STK500 board the ATmega8515L in this example 4 4 3 12 Create a new batch file or open the one created from steps 4 4 3 1 through 4 4 3 11 Go to the directory that contains the desired batch file right click over the file and select Edit as seen in Figure 4 45 This will open a batch file for editing not running in the default text editor e g Notepad Vincent A Rosa Florida Gulf Coast University Page 10 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor a G T stk500_example road ole File Edit View Favorites Tools Help b i Back Ft 4 Search ey Folders fs a ie Xx Le Folder Sync r O C stk500_example bi Go P oo StkS00 exe stkS00_prog hesx File and Folder Tasks 2 i a J j Rename this file 5 Gy Move this File O stk 500_program_ Flash bat A Cop this fie 4 TE Batch File d Publish this File to the Open Web Edt G E mail this file Print Print this file H Convert to Adobe PDF Delete this file E Co
9. Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor 4 Application Programming 4 4 Remote Access 4 4 1 Networking an STK500 Web accessed data acquisition and remote programming are two aspects of networking that can be achieved using an STK500 evaluation board Web accessed data acquisition includes broadcasting data acquired from the STK500 board via the Internet Remote programming includes allowing a remotely located user to program the STK500 via the Internet Both of these networking aspects can be fulfilled by using a website as the user interface The DAQ system formed in section 4 1 3 can be expanded into a web based system illustrated by the context diagram in Figure 4 36 An example website for this system that runs on the host PC web server is given by the HTML and PHP code provided in Appendix section A 2 2 The customized serial program and batch file presented in Appendix A 2 2 also run on the host server and they are the key components used by the given website to achieve web based DAQ and remote programming respectively The sample website is hosted using IIS Internet Information Services on the same Windows PC that serves as the host for the STK500 board However the web server is not required to be the same machine as the host PC How to establish a web server goes beyond the scope of this document but the core components used to develop a networked STK500 are further explained in sections 4 4 2
10. Computer Folder Options Figure 4 37 Screenshot of accessing the Windows Folder Options from Windows Explorer Vincent A Rosa Florida Gulf Coast University Page 4 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor 4 4 3 2 Select the View tab within the Folder Options window and make sure that the field labeled as Hide extensions for known file types is unchecked as shown in Figure 4 38 Click on the check box to uncheck this field if is not already unchecked Select Apply and then OK to apply the settings and exit the Folder Options window respectively These settings will remain even after the machine is shutdown so this only needs to be done once Folder Options Ax General View File Types Offline Files Folder views You can apply the view such as Details or Tiles that you are using for this folder to all folders Apply to All Folders Reset All Folders Advanced settings Display the full path in the address bar A _ Display the full path in the title bar _ Do not cache thumbnails O Hidden files and folders Py Do not show hidden tiles and folders Show hidden files and folders USD BS BE TTT ETTET TTET e n Hide protected operating system files Recommended Launch folder windows in a separate process G Managing pairs of Web pages and folders Show and manage the pair as a single file Show both parts and manage them individ
11. Rosa Florida Gulf Coast University Page 19 of 19 Spring 2009
12. age 11 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor GOTO skip This is a sample batch file that will erase all contents from the flash memory of the ATmega8515L installed on an STK500 evaluation board gt Sskip 4 4 3 15 Add the following command lines to the batch file The stk500 is the command that accesses the Stk500 exe program to perform the operations that follow on the same line The order in which the following operations are listed does not matter Notice how the ATmega8515L is accessed using dATmega8515 This is the correct way of accessing all versions of the ATmega8515 MCU with the STK500 DOS programmer The ms operation enters into serial programming mode The e operation erases the target device REM The following command redirects the CMD session to a directory REM that contains the Stk500 exe program cd C stk500_example REM The following command will erase all contents in an ATmega8515L stk500 dATmega8515 ms e 4 4 3 16 Press CTRL and s at the same time on the keyboard to save the file 4 4 3 17 Click the X at the top right corner of the editor window to exit Notepad 4 4 3 18 Go to the directory where the batch file that has now been created is saved and open it by double clicking on its icon This should execute the batch file in a stand alone CMD session If any errors occur make sure that all steps were followed accurately and fix any mistakes If
13. e PHP program that executes it and each uploaded HEX file has its name changed to match the one used within this batch file stk5OO_prog hex in this case The purpose of the batch file stk500_program_flash bat in Appendix A 2 2 3 is to allow a remotely located user to program the flash memory of the installed target MCU via the Internet from a webpage This is achieved by the webpage allowing for the user to first upload a HEX file to the server host PC and then initiate an event 1 e push a button to execute the batch file on the server host Executing the batch file should then program the flash of the target MCU A batch file is a special type of text file that contains lines of commands that are executed within a CMD window session as soon as the file is opened The following instructions can be used to make a batch file in Windows XP Although Notepad is used in the following steps as the text editor any text editor can be used e g WordPad 4 4 3 1 The Folder Options for Windows Explorer must be set up so that text files txt can be saved as batch files bat Open an Explorer window by opening any folder e g My Computer or My Documents Then click on the Tools menu and select Folder Options as seen in Figure 4 37 The Folder Options window should pop up d My Computer Fie Edit View Favorites Tools Help Map Network Drive wi Disconnect Network Drive l Synchronize f s My
14. er Manual Host PC and Temperature Sensor acquire data while the target system the STK500 in this case is running A customized serial communication utility can be developed to overcome this problem The serial communication program host_serial_com cpp in Appendix A 2 2 2 was produced for a Windows platform using the Win32 API 12 It is designed to run on the host PC to store all data received from the STK500 board into a text file This text file can then be used to broadcast the received data via the Internet on a webpage as implemented with the HTML and PHP code in Appendix A 2 2 4 Developing a serial communication program for a Windows platform can be achieved by following the instructions provided in the Windows Serial Port Programming document 12 The Win32 API can be imported into a C program by including the windows h header file when using the Microsoft Visual Studio IDE Microsoft provides free versions of Visual Studio called Express Editions available online at http www microsoft com Express It is important to know that the current Win32 API has been changed by Microsoft to use the UNICODE character set instead of the ASCII character set still utilized by the standard C C libraries These standard C C libraries are outlined online at lt http www cplusplus com reference gt Another important tip is that the Windows sockets API given by winsock2 h must be included into a C program before windows h
15. ion File to Program the Board Filename hex only Upload Figure 4 49 Screenshot of the remote programming portion of the website 4 4 4 5 Within the pop up window for choosing a file go to the directory that contains the desired HEX file e g Figure 4 50 and double click on it to select it Choose file 2 leg Look ir stk500_example 7 P mg E C Stks00 exe Ets stkS00_prog hex My Recent M stk500_program_flash bat Documents My Computer My Network File name stk500_proa hex Places Files of type All Files Cancel Figure 4 50 Screenshot of the Choose file window used by Internet Explorer to select a file to upload to a website 4 4 4 6 Click on the Upload button shown in Figure 4 51 This figure also shows that the local path of the selected HEX file from step 4 4 4 5 is displayed in the Filename field The results should load and display over the same browser window as shown in Figure 4 52 Florida Gulf Coast University Page 16 of 19 Vincent A Rosa Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Load a HEX Application File to Program the Board Filename hex only C stk500_example stk5 Upload Figure 4 51 Screenshot of an instance of the remote programming section of the sample website http 69 80 163 18 vincent Functions UploadFile php Windows Internet Explorer J leg ey E
16. nvert to Adobe PDF and EMail Scan For Viruses Dther Places S Add to archive 83 Add to stk500_program _flash rar sa Local Disk Ci 2 Compress and email My Documents 22 Compress to stk500_program_flash rar and email E Shared Documents E mail with Yahoo 4 My computer h PowerI50 J My Network Places Send To uk Caps Details A Create Shortcut stk500_program_flash b MS DOS Batch File Date Modified Today May 19 2009 7 56 PM Delete Rename Properties Figure 4 45 Screenshot of how to open a batch file to edit and not to run 4 4 3 13 Every command in a batch file should be on its own line It is common practice to not display i e to not echo the commands contained within a batch file during their execution in a CMD session Add the command ECHO OFF to the top of the batch file to achieve this The symbol prevents the command that follows from being echoed The ECHO OFF command stops all following commands from being displayed 4 4 3 14 Itis good practice to provide comments to explain the purpose of the batch file and why certain commands are used All comments should not be executed so the remark keyword REM must precede each individual comment line Multiple lines of comments can be handled in one block by placing them between the GOTO label_name command and a label e g LABEL Add the following block of comments to the batch file Vincent A Rosa Florida Gulf Coast University P
17. ty Vincent A Rosa Florida Gulf Coast University Page 6 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor 4 4 3 5 Goto the File menu and select Save As within the Notepad editor as seen in Figure 4 41 Untitled Notepad File Edit Format View Help New Ctri h Open Chri 0 Save Ctrl 5 Save AS Page Setup Print Ctrl P Exit Figure 4 41 Screenshot of accessing the Save As feature in Notepad 4 4 3 6 Select the desired directory from the Save in field which is C stk500_example for this procedure as shown in Figure 4 42 Vincent A Rosa Florida Gulf Coast University Page 7 of 19 Spring 2009 Communicating with a User Manual Atmel AVR STK500 Host PC and Temperature Sensor Save As 2 e Save in stk500_example 3 e Eih ty My Recent Documents A Desktop ai My Documents My Recent of My Computer Documents H 3 Floppy A z Local Disk C to B DYD FiW Drive D Desktop ED Drive p 4 CD Drive fr S Shared Folders on host 2 gt Shared Documents My Documents G My Documents a My Network Places G Sundry E My Computer amp File name bet fael in 5 My Network Save as type Text Documents tet Encoding ANS Figure 4 42 Screenshot of the Save As pop up window in Windows The selected directory is lt C stkSO0_example gt Change the
18. ually w Restore Defaults Figure 4 38 Screenshot of the View section within the Folder Options configuration for Windows 4 4 3 3 Goto the Windows Start menu and select Run as shown in Figure 4 39 to open the Windows Run utility Vincent A Rosa Florida Gulf Coast University Page 5 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Internet My Documents Internet Explorer Y A My Recent Documents E mail uo ir ta My Pictures D Microsoft Update oy My Music PE My Computer a My Network Places CodevisionaYR Evaluation Yeg l Nobepad Control Panel Set Program Access and Defaults SOL Server Configuration Manager AVR Studia 4 iS Printers and Faxes e OR 22 microsoft office Word 2007 Help and Support 2 Search Hig WinsiP va All Programs gt Log Off oJ Turn OFF Computer s Stan eM Figure 4 39 Screenshot of how to access the Windows Run utility from the Start menu 4 4 3 4 Type notepad into the Open field of the Run window and push Enter on the keyboard or select OK in the window as shown in Figure 4 40 This should open the Notepad application for writing editing text files wn Type the name of a program Folder document or Internet resource and Windows will open it For you Open notepad v Figure 4 40 Screenshot of the Windows Run utili
19. ully programming the networked STK500 4 4 4 8 Click on the button labeled View Last Received Data shown in Figure 4 53 to view the most current data sent from the STK500 to the server This button is used as a way to reassure whether the board has been properly programmed with the correct HEX application Click the Back link to go back to the homepage without viewing the last received data If the View Last Received Data is selected the results page will load over the current browser window and will display a message similar to that shown in Figure 4 54 From here click the on the link Back to go back to the homepage Vincent A Rosa Florida Gulf Coast University Page 18 of 19 Spring 2009 Atmel AVR STK500 Communicating with a User Manual Host PC and Temperature Sensor Sex Lel i http 169 89 163 18 vincent Functions ReadLastRec php v 4 X p E http 69 00 163 10 vincent F une tions ReadLastRec php Windows Internet Explorer BF ate http 69 88 163 1 vincent Functions ReadLastRec i bu m iri Page iG Tools 05 19 2009 23 32 01 Data Received USART Communication Test Succeeded 28 Internet 4 100 Figure 4 54 Screenshot of an instance of the results page for the data last received by the server from the networked STK500 This concludes how to use the sample website to remotely access the mylWI to STK500 data acquisition system Vincent A
Download Pdf Manuals
Related Search
Related Contents
Philips SHJ066 T-Mobile LG D801 32GB 4G Black PFC-Sergio Marabot Garcia Yarvik GoTab 9.7 4GB Metallic, Silver AT9922PC 取扱説明書 Tecumseh AEA2413YXA Drawing Data service manual - JA WATERTECHNIC A/S Manuel d`Instructions SG2 Extended Bedienungsanleitung - SICOM - Prozeß Copyright © All rights reserved.
Failed to retrieve file