' {$STAMP BS2} ' {$PBASIC 2.5} ' {$PORT COM1} '=================================================================================================== '================Programme to test the BOB4 Graphics overlay module================================= ' By John Smith 2007 ' '===============================constants=========================================================== bob CON 3 'Output pin to bob4 p3 on serial cable baud CON 16468 'Baud rate for 9600baud 8 N 1 BS2/E/PE 'baud2 CON 16624 'Baud rate for 9600baud 8 N 1 BS2 SX/P hold CON 1900 ' default 1900 '==================================Variables======================================================== csi VAR Byte(2) 'Control Sequence Introducer ESC,[ counter VAR Byte ' font VAR Byte(2) 'font message VAR Byte(9) '==================================== Start of programme============================================ csi(0) = 27 'esc 'csi components csi(1) = 91 '[ 'csi components restart: PAUSE 1000 'one second pause SEROUT bob,baud,[STR csi\2,"20;0v"] 'set display to 320 x 240 'SEROUT bob,baud,[STR csi\2,"20;1v"] 'set display to 384 x 288 'SEROUT bob,baud,[STR csi\2,"20;2v"] 'set display to 480 x 240 'SEROUT bob,baud,[STR csi\2,"20;3v"] 'set display to 480 x 288 SEROUT bob,baud,[STR csi\2,"0m"] 'clear display settings main: SEROUT bob,baud,[STR csi\2,"3z"] 'display settings select font SEROUT bob,baud,[STR csi\2,"2,J"] 'clear screen SEROUT bob,baud,[STR csi\2,"4;3H"] 'select row column PAUSE hold SEROUT bob,baud,[STR csi\2,"30;30.r "] 'Graphics cursor start point SEROUT bob,baud,[STR csi\2,"250;30 -r"] 'line from x to graphics cursor SEROUT bob,baud,[STR csi\2,"250;190 -r"] 'last position down 220 SEROUT bob,baud,[STR csi\2,"30;190 -r"] 'last position 220 to left SEROUT bob,baud,[STR csi\2,"30;30 -r"] 'back to cursor start point SEROUT bob,baud,[STR csi\2,"/r"] 'paint pixels white PAUSE hold SEROUT bob,baud,[STR csi\2,"25;25.r "] SEROUT bob,baud,[STR csi\2,"255;25 -r"] 'draw box outside box SEROUT bob,baud,[STR csi\2,"255;195 -r"] SEROUT bob,baud,[STR csi\2,"25;195 -r"] SEROUT bob,baud,[STR csi\2,"25;25 -r"] SEROUT bob,baud,[STR csi\2,"/r "] PAUSE hold SEROUT bob,baud,[STR csi\2,"3;7H"] 'select row column SEROUT bob,baud,[" Milford Instruments "] 'type text " between question marks " SEROUT bob,baud,[STR csi\2,"7;13H"] 'select row column SEROUT bob,baud,[" BOB4 "] 'Type text SEROUT bob,baud,[STR csi\2,"11;10H"] 'Position cursor SEROUT bob,baud ,["Graphics Test"] PAUSE hold SEROUT bob,baud,[STR csi\2,"2,J"] 'clear screen SEROUT bob,baud,[STR csi\2,"3;10H"] 'Position cursor SEROUT bob,baud,["Triangles"] 'Object SEROUT bob,baud,[STR csi\2,"2;1H"] 'Position cursor SEROUT bob,baud,[STR csi\2,"160;120.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"120;120 -r"] 'draw line for base of triangle e-w SEROUT bob,baud,[STR csi\2,"160;80 -r"] 'draw hypotenuse of triangle SEROUT bob,baud,[STR csi\2,"!r"] 'close path back to start point n-s SEROUT bob,baud,[STR csi\2,"1/r "] 'Colour in lines (1 = half tone) PAUSE hold SEROUT bob,baud,[STR csi\2,"160;120.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"160;160 -r"] 'draw line of triangle n-s SEROUT bob,baud,[STR csi\2,"120;120 -r"] 'draw hypotenuse of triangle SEROUT bob,baud,[STR csi\2,"!r"] 'close path back to start point w -e SEROUT bob,baud,[STR csi\2,"1/r "] 'Colour in lines (1 = half tone) PAUSE hold SEROUT bob,baud,[STR csi\2,"160;120.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"200;120 -r"] 'draw line for base of triangle w-e SEROUT bob,baud,[STR csi\2,"160;160 -r"] 'draw hypotenuse of triangle SEROUT bob,baud,[STR csi\2,"!r"] 'close path back to start point n-s SEROUT bob,baud,[STR csi\2,"1/r "] 'Colour in lines (1 = half tone) PAUSE hold SEROUT bob,baud,[STR csi\2,"160;120.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"200;120 -r"] 'draw line to base of triangle w-e SEROUT bob,baud,[STR csi\2,"160;80 -r"] 'draw hypotenuse of triangle SEROUT bob,baud,[STR csi\2,"!r"] 'close path back to start point n-s SEROUT bob,baud,[STR csi\2,"1/r "] 'Colour in lines (1 = half tone) PAUSE hold SEROUT bob,baud,[STR csi\2,"2,J"] 'clear screen SEROUT bob,baud,[STR csi\2,"1;10H"] 'Position cursor SEROUT bob,baud,["Circles"] 'Object SEROUT bob,baud,[STR csi\2,"9;5H"] 'Position cursor SEROUT bob,baud,[STR csi\2,"60;0;12.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"60;360)r"] 'set radius and sweep for circle SEROUT bob,baud,[STR csi\2,"1/r "] 'Colour in line (1 = half tone) PAUSE hold SEROUT bob,baud,[STR csi\2,"60;0;12.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"60;360)r"] 're draw circle and fill with halftone pixels SEROUT bob,baud,[STR csi\2,"3;5H"] 'Position cursor SEROUT bob,baud,[STR csi\2,"1#r "] 'fill circle with halftone pixels PAUSE hold SEROUT bob,baud,[STR csi\2,"40;0;12.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"40;360)r"] 're draw smalller circle and fill white SEROUT bob,baud,[STR csi\2,"3;5H"] 'Position cursor SEROUT bob,baud,[STR csi\2,"#r "] 'fill circle with white pixels PAUSE hold SEROUT bob,baud,[STR csi\2,"20;0;12.r "] 'position graphics cursor in centre SEROUT bob,baud,[STR csi\2,"20;360)r"] 'redraw smaller circle and fill black SEROUT bob,baud,[STR csi\2,"3;5H"] 'Position cursor SEROUT bob,baud,[STR csi\2,"2#r "] 'fill circle with black pixels PAUSE hold SEROUT bob,baud,[STR csi\2,"2,J"] SEROUT bob,baud,[STR csi\2,"3;10H"] 'Position cursor SEROUT bob,baud,["Star"] 'Object SEROUT bob,baud,[STR csi\2,"100;100.r"] 'Position graphics cursor SEROUT bob,baud,[STR csi\2,"100;150+r"] SEROUT bob,baud,[STR csi\2,"70;110+r"] 'Draw star on screen SEROUT bob,baud,[STR csi\2,"120;125+r"] SEROUT bob,baud,[STR csi\2,"70;140+r"] SEROUT bob,baud,[STR csi\2,"100;100+r"] SEROUT bob,baud,[STR csi\2,"#r"] PAUSE hold SEROUT bob,baud,[STR csi\2,"30;30.r "] 'Graphics cursor start point SEROUT bob,baud,[STR csi\2,"300;30 -r"] 'line from x to graphics cursor SEROUT bob,baud,[STR csi\2,"300;220 -r"] 'last position down 220 SEROUT bob,baud,[STR csi\2,"30;220 -r"] 'last position 220 to left SEROUT bob,baud,[STR csi\2,"30;30 -r"] 'back to cursor start point SEROUT bob,baud,[STR csi\2,"#r"] 'paint pixels white PAUSE hold 'SEROUT bob,baud,[STR csi\2,"2,J"] SEROUT bob,baud,[STR csi\2,"7;10H"] 'Position cursor SEROUT bob,baud,["End of Graphics Demo"] PAUSE 2000 GOTO restart