In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: Try this... [code] ' Prog5.2 SXB tone player pg 75 ' JWB Jan 4,2007 DEVICE SX28L, OSC4MHZ, TURBO, STACKX, OPTIONX IRC_CAL IRC_SLOW FREQ 4000000 i VAR Byte j VAR Byte k VAR Byte note VAR Byte tone VAR Byte spkr PIN RB.7 OUTPUT ' Make speaker output NOTES CON 3 ' maximum note number PROGRAM Start NOSTARTUP ' Don't generate startup code Start: spkr=0 ' state of speaker top: for i=0 to NOTES LOOKUP i,1,3,2,1,note ' get quasi-note gosub beep, note pause 500 ' pause between notes next i pause 10000 ' let your ears rest goto top ' subroutine makes 200 cycles at the specified note ' note*256uS 1/2 period beep: tone=__PARAM1 for j=1 to 20 for k=1 to 100 spkr = ~spkr ' toggle Speaker pauseus 0,tone next k next j return [/code] Bean. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=163425#m163428 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)