Save this page as ezservo.txt, and open in notepad with wordwrap to read. Below is how I generate batch and HTML files for controlling the ezservo servo control chip via a web brouser. The below batch files are spaced two spaces from the left margin so you can see when line wrap is occuring. It would probably be best to open this file in notepad with word wrap turned off when copying the batch files (read with word wrap turned on). Copy the parts between the ======= lines, paste in notepad, and save as a .bat file. Double click the bat file to run it. The echoo.com file and the bat files need to be in the same folder (or on the desk top, or in the cgi folder) when being run (or you can add full paths for seperate folders). The echoo.bat file generates the echoo.com application that allows bytes to be sent to the com port. Copy the below (four lines), paste in notepad, save as echoo.bat. Then double click on the echoo.bat file and the echoo.com file will be generated. Echoo will echo hex bytes when they are preceded by a $. Echoo $dd$ff > com1 will echo the hex bytes dd and ff to the com1 port. To learn more about echoo, down load the ube.zip file at the below link. ftp://137.193.64.130/pub/assembler/ube.zip =============ECHOO.BAT============= echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>echoo.com echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>echoo.com echo ?@xAyJHmH@=a?}VjuN?_LEkS?`w`s_{OCIvJDGEHtc{OCIKGMgELCI?GGg>>echoo.com echo EL?s?WL`LRBcx=k_K?AxVD?fCo?Cd?BLDs0>>echoo.com =================================== The test.bat file for 8bit control of the ezservo chip. It is used for initial testing of the ezservo chip connected to com1. It sets the com1 port to the desired settings, then sends the bytes to the com1 port. First, servo 00 is moved to two different positions, then both servo 00 and 01 are moved to two positions (like a pan/tilt preset position). Double click the test.bat file to run it. ========test.bat 8bit for com1========== @echo off mode com1:9600,N,8,1 >nul echoo $00$80$32 >com1 pause echoo $00$80$fa >com1 pause echoo $00$80$6E$01$80$64 >com1 pause echoo $00$80$00$01$80$64 >com1 ============================= The ez8bit.bat file generates a txt and html file for all servo positions between hex 00 and ff (decimal 0 to 255) for use with web server/brouser cgi control of the servos. In this instance this uses the internal tcp/ip loopback address of 127.0.0.1 with a web server operating on port 88, sending bytes to servo 01. =========ez8bit.bat============ @ECHO OFF if "%1"=="##" GOTO %1 FOR %%a IN (0 1 2 3 4 5 6 7 8 9 A B C D E F) DO CALL %0 #%1 %2 %%a GOTO EOF :## ECHO %2%3 ECHO ^*^ >> ez8bit.htm ECHO ^*^ >> ez8bit.txt :EOF =============================== The ez8bit-n.bat file allows for making smaller arrays for the web pages. This instance will make about 12 positions fairly evenly spaced between 00 and ff (256 devided by 20). If you wanted to have about 25 evenly spaced positions, change the EQU 20 to EQU 10 (256 devided by 10). ====ez8bit-n.bat change EQU 20 to desired increment number==== @ECHO OFF if "%1"=="##" GOTO %1 FOR %%a IN (0 1 2 3 4 5 6 7 8 9 A B C D E F) DO CALL %0 #%1 %2 %%a GOTO EOF :## set /a count+=1 if %count% EQU 20 set count=0 if %count% NEQ 1 goto :EOF ECHO %2%3 ECHO ^*^ >> ez8bit-n.htm ECHO ^*^ >> ez8bit-n.txt :EOF =============================== The ez16bit.bat file generates all the hez codes between the desired hex values. For most hobby servos to get ~180 deg rotation, they need pulse widths between .5 ms (500us) and 2.5 ms (2500us). The ezservo chips have 1us resolution in the 16 bit mode. To get the hex value for 500us, use the windows accessory calculator in the scientific mode. With the calculator in the DEC mode, enter 500, then click the HEX dot and 1F4 will appear. This is the hex value for 500, and is sent to the ezservo chip as 01 and F4. For 2500us, in the DEC mode enter 2500 and click the HEX dot, and 9C4 should appear. This is sent to the ezservo chip as 09 and C4. When you first click on the ez16bit.bat file, you will see the dos scteen, then the hex values will start to scroll on the screen as they are written to the files. When the scrolling stops, click the x in the upper right of the dos box to close the batch file. You should now have both a txt and htm files with the URL links. You will need to experiment with the min and max pulse widths to get the max servo rotation. Don't allow the servo to run against the rotation hard stops or the 5v regualtor chip will get very hot! =========ez16bit.bat=========== @ECHO OFF if "%1"=="####" GOTO %1 FOR %%a IN (0 1 2 3 4 5 6 7 8 9 A B C D E F) DO CALL %0 #%1 %2 %3 %4 %%a GOTO EOF :#### if 0x%2%3%4%5 LEQ 0x01f4 goto :EOF if 0x%2%3%4%5 GEQ 0x09c4 goto :EOF ECHO. %2%3%4%5 ECHO ^*^ >> ez16bit.txt ECHO ^*^ >> ez16bit.htm :EOF ================================= The ez16bit-n.bat will do the same as the ez16bit.bat, but it will only send every nth hex value to the generated files. There are 2000 increments between 500us and 2500us, which is a large clickable array. If you want to reduce this to ~20, then you would set the EQU to EQU 100 so only every 100th line will be sent to the files. ===ez16bit-n.bat change EQU 100 to desired increment number== @ECHO OFF if "%1"=="" type nul>servoN-hex.txt if "%1"=="####" GOTO %1 FOR %%a IN (0 1 2 3 4 5 6 7 8 9 A B C D E F) DO CALL %0 #%1 %2 %3 %4 %%a GOTO EOF :#### if 0x%2%3%4%5 LEQ 0x01F4 goto :EOF if 0x%2%3%4%5 GEQ 0x09C4 goto :EOF set /a count+=1 if %count% EQU 100 set count=0 if %count% NEQ 1 goto :EOF echo %2%3%4%5 ECHO ^*^>> servoN-hex.txt ECHO ^*^>> ez16bit-n.htm :EOF =================================== Reversing the order of the generated files: I've found that a 500us pulse will make some servos go full counter clowckwise, while other servos will go full clockwise. An application called COLS can reverse the line order in the files (down load the cols.zip file below). Put the cols.exe, cols.pas, cols.bat, and the ez16bit-n.htm (or what ever your file name is) files in the same folder. double click the cols.bat file and the reversed line ez16bit-n-r.htm file should be generated. http://www.merlyn.demon.co.uk/programs/cols.zip =========cols.bat==================== COLS _5,99999 1- < ez16bit-n.htm | sort | COLS 6- > ez16bit-n-r.htm ======================================== Below is the basic webcam.bat file that moves the servo with out having the brouser page refresh (which would mess up the streaming video). It goes in the cgi or cgi-bin folders. It sends the 204 status code to the web server, sets com1 for 9600 baud, gets the bytes contained in the query_string, and has echoo send them to com1. ===========webcam.bat=============== @echo off echo status: 204 echo. echo. mode com1:9600,N,8,1 >nul echoo %QUERY_STRING% >com1 cls ==============================================