Sponsored by BoysStuff.co.uk



The Audio Frequency Test Set.

-----------------------------

Screen shots of the AFTS running in WinUAE compatibilty mode...

  Hi there readers, it's that AMIGA nutter again... :)

  Although this is not strictly part of my HW Access articles I decided to
  include it as yet another article...

  I am co-moderator of ACE Basic Compiler, (ABC :), (C) David Benn and I
  'design' the vast majority of my code around his compiler. As is well
  known now I 'GIVE' away all of my ideas whether it be Public Domain or GPL
  and I decided to restart this project again a short while ago.

  I worked out how to get the Arduino Diecimila USB Dev Board to talk to
  WinUAE, (AND, classic AMIGAs), so this gave me multiple analogue and
  digital I/O, mainly for WinUAE.

  This means that my WinUAE-ADC.lha archive on AMINET is now effectively
  redundant as the Arduino board has superceded it. I have also got this
  board running under Python 1.4x to 2.6x for both Windows, WinUAE and
  classic AMIGAs, and Python 3000 for Windows...

  For DEMOs see the archives:-

            http://main.aminet.net/docs/hard/WinUAE_Arduino.lha
            http://main.aminet.net/docs/hard/Arduino_Python.lha

  The WinUAE_Arduino.lha archive is ACE Basic Compiler code...
  The Arduino_Python.lha archive is the various Python code...

  The ACE Basic Compiler code for the WinUAE_Arduino.lha is at the and of
  this article and you WILL have to download the archive for the board
  programming code to program the board for all this to work...

  The AFTS.lha archive including the code below is now on AMINET, purely as
  a taster upload to see if there is any interest.

  The archive WILL run in Audio Function Generation Mode for both classic
  AMIGAs AND WinUAE with full sound emulation...

            http://main.aminet.net/docs/hard/AFTS.lha

  ...when NO HARDWARE is connected to either the games port AND parallel
  port. As the Arduino board works for both I am going to have to do some
  serious re-coding to either include this board OR just use this board
  on its own and ignore the games and parallel ports altogether.

----------------------------------------------------------------------------

  The ACE Basic Compiler Code, (Sweeper-HW.b):-
  ---------------------------------------------

  This particular code works on ANY classic A500+ and greater machine using
  OS2.0x or above. It also works on an A500 with 0.5MB upgrade and using the
  software KS2.0x 'emulator' and full Workbench 2.0x install.
  I've been told that it also works on Amithlon with 'BAER' running... :)

  It is an Audio Sweep Generator and sweeps from 100Hz to 5KHz at differing
  rates and steps. It is a 'Sinewave' that is generated, although it is not
  particularly pure under emulation...

  To 'Stop' the sweep LMB click once, ANYWHERE, on screen...

  NOTE:- There is ONLY ACE Basic code here as inline assembler is NOT
         needed to do this task.

REM This REQUIRES external hardware to obtain a CONSTANT output level!!!
REM HW constant output audio sweep generator, (C) B.Walker.
REM ACE Basic Compiler, (C) D.Benn.
REM
REM This is the Sweep Generator GUI.

REM Original idea copyright, (C)2004, B.Walker, G0LCU.
REM Now issued under GPL.

  LET version$="$VER: Sweeper-HW_Version_0.92.10_(16-06-2006)."
  WINDOW 9,"Sweep Generator, Hardware.",(200,0)-(640,70),6
  FONT "topaz.font",8
  COLOR 1,0
  CLS

REM Set up the buttons.
  GADGET 255,ON,"10Hz.",(2,1)-(65,17),BUTTON,1,"topaz.font",8,0
  GADGET 254,ON,"50Hz.",(66,1)-(129,17),BUTTON,1,"topaz.font",8,0
  GADGET 253,ON,"100Hz.",(130,1)-(193,17),BUTTON,1,"topaz.font",8,0
  GADGET 252,ON,"500Hz.",(194,1)-(257,17),BUTTON,1,"topaz.font",8,0
  GADGET 247,ON,"Start.",(367,1)-(430,17),BUTTON,1,"topaz.font",8,0
  BEVELBOX (258,1)-(365,16),2
  PENUP
  SETXY 264,11
  PRINT "Sweep Steps.";
  GADGET 251,ON,"Slow.",(2,18)-(65,34),BUTTON,1,"topaz.font",8,0
  GADGET 250,ON,"Medium.",(66,18)-(129,34),BUTTON,1,"topaz.font",8,0
  GADGET 249,ON,"Fast.",(130,18)-(193,34),BUTTON,1,"topaz.font",8,0
  GADGET 248,ON,"Single.",(194,18)-(257,34),BUTTON,1,"topaz.font",8,0
  GADGET 246,ON,"Quit.",(367,18)-(430,34),BUTTON,1,"topaz.font",8,0
  BEVELBOX (258,18)-(365,33),2
  MENU 1,0,1,"Sweep Generator, 100Hz to 5KHz."
  MENU 1,1,1,"HW controlled constant output."
  PENUP
  SETXY 264,28
  PRINT "Sweep Rates.";
  COLOR 3,0
  PENUP
  SETXY 65,45
  PRINT "(C)2004, B.Walker, G0LCU, & A.Hoffman.";
  COLOR 0,0
  SETXY 33,54
  PRINT version$;
  LINE (0,35)-(432,35),2
  LINE (0,36)-(432,36),1
  COLOR 1,0

REM Initial memory setup.
  LET addr&=ALLOC(512,3)
  LET sineaddr&=addr&
  LET sounddata=0
  LET n=0
  FOR n=0 TO 509
  LET dataaddr&=(addr&+n)
  READ sounddata
  POKE dataaddr&,sounddata
  NEXT n
  GOTO variable_list:

REM Sine wave sample 2, 4 Bytes.
  DATA 0,127,0,-128

REM Sine wave sample 3, 8 Bytes.
  DATA 0,90,127,90,0,-90,-128,-90

REM Sine wave sample 4, 16 Bytes.
  DATA 0,49,90,117,127,117,90,49,0,-49,-90,-117,-128,-117,-90,-49

REM Sine wave sample 5, 32 Bytes.
  DATA 0,24,48,70,89,105,117,124,127,124,117,105,89,70,48,24
  DATA 0,-24,-48,-70,-89,-105,-117,-125,-128,-125,-117,-105,-89,-70,-48,-24

REM Sine wave sample 6, 64 Bytes.
  DATA 0,12,24,36,48,59,70,80,89,98,105,112,117,121,124,126,127,126,124,121,117
  DATA 112,105,98,89,80,70,59,48,36,24,12,0,-13,-25,-37,-49,-60,-71,-81,-90
  DATA -99,-106,-113,-118,-122,-125,-127,-128,-127,-125,-122,-118,-113,-106
  DATA -99,-90,-81,-71,-60,-49,-37,-25,-13

REM Sine wave sample 7, 128 Bytes.
  DATA 0,6,12,18,24,30,36,42,48,54,59,65,70,75,80,85,89,94,98,102,105,108,112
  DATA 114,117,119,121,123,124,125,126,126,127,126,126,125,124,123,121,119,117
  DATA 114,112,108,105,102,98,94,89,85,80,75,70,65,59,54,48,42,36,30,24,18,12,6
  DATA 0,-6,-12,-18,-24,-30,-36,-42,-48,-54,-59,-65,-70,-75,-80,-85,-89,-94,-98
  DATA -102,-105,-108,-112,-114,-117,-119,-121,-123,-124,-125,-126,-127,-128
  DATA -127,-126,-125,-124,-123,-121,-119,-117,-114,-112,-108,-105,-102,-98,-94
  DATA -89,-85,-80,-75,-70,-65,-59,-54,-48,-42,-36,-30,-24,-18,-12,-6

variable_list:
  LET a$="(C)2003 B.Walker, G0LCU, and A.Hoffamn."
  LET theGadget=248
  LET n=255
  LET hop=100
  LET delay=0.06
  LET leftbutton=1
  LET singleshot=0
  LET vol1=0
  LET sine1=100
  LET period1=INT(3563220/(128*sine1))

REM Reset audio hardware.
  POKEW 14676118,15                   'Switch off audio dma.
  POKE 12574721,252                   'Enable audio filter.

REM This is the main loop.
main_loop:
  PENUP
  SETXY 264,11
  PRINT "Sweep Steps.";
  PENUP
  SETXY 264,28
  PRINT "Sweep Rates.";
  LET vol1=0
  LET hop=100
  LET delay=0.06
  LET sine1=100
  LET singleshot=0

REM Generate a simple sinewave only, CH0.
  POKEL 14676128,(sineaddr&+124)      'Set address to chip ram.
  POKEW 14676132,64                   'Number of words in data sample.
  POKEW 14676134,period1              'Period of sampling time.
  POKEW 14676136,vol1                 'Volume max 64, min 0.
  POKEW 14676126,255                  'Disable any other modulation.
  POKEW 14676118,33281                'Enable sound on channel 0.
  POKE 12574721,252                   'Enable audio filter.

waitgadget:
  GADGET WAIT 0
  LET theGadget=GADGET(1)
  IF theGadget=255 THEN LET hop=10
  IF theGadget=254 THEN LET hop=50
  IF theGadget=253 THEN LET hop=100
  IF theGadget=252 THEN LET hop=500
  IF theGadget=247 THEN GOTO sweep_loop_setup:
  IF theGadget=251 THEN LET delay=0.12
  IF theGadget=250 THEN LET delay=0.06
  IF theGadget=249 THEN LET delay=0.02
  IF theGadget=248 THEN LET singleshot=1
  IF theGadget=246 THEN GOTO getout:
  GOTO waitgadget:

sweep_loop_setup:
  POKEW 14676118,33281                    'Enable sound on channel 0.
  POKE 12574721,252                       'Enable audio filter.
  PENUP
  SETXY 264,11
  PRINT "            ";
  PENUP
  SETXY 264,28
  IF delay>=0.01 THEN PRINT "    Fast.   ";
  SETXY 264,28
  IF delay>=0.05 THEN PRINT "   Medium.  ";
  SETXY 264,28
  IF delay>=0.11 THEN PRINT "    Slow.   ";
  SETXY 264,28
  IF singleshot=1 THEN PRINT "   Single.  ";
  GOTO sweep_loop_start:
sweep_loop:
  LET a$=INKEY$
  IF a$=" " THEN GOTO main_loop:
  LET leftbutton=MOUSE(0)
  IF leftbutton=-1 THEN GOTO main_loop:
  LET sine1=sine1+hop
sweep_loop_start:
  LET vol1=64
  IF sine1>5000 AND singleshot=1 THEN GOTO main_loop:
  IF sine1>5000 THEN LET sine1=100
  PENUP
  SETXY 264,11
  PRINT " ";sine1;"Hz.  "
  SLEEP FOR delay
  IF sine1>3500 THEN GOTO band1:
  IF sine1>1750 THEN GOTO band2:
  IF sine1>875 THEN GOTO band3:
  IF sine1>440 THEN GOTO band4:
  IF sine1>220 THEN GOTO band5:
  GOTO band6:

REM Frequency range bands.
band1:
  LET period1=INT(3563220/(4*sine1))
  POKEL 14676128,sineaddr&
  POKEW 14676132,2
  POKEW 14676134,period1
  POKEW 14676136,vol1
  GOTO sweep_loop:
band2:
  LET period1=INT(3563220/(8*sine1))
  POKEL 14676128,(sineaddr&+4)
  POKEW 14676132,4
  POKEW 14676134,period1
  POKEW 14676136,vol1
  GOTO sweep_loop:
band3:
  LET period1=INT(3563220/(16*sine1))
  POKEL 14676128,(sineaddr&+12)
  POKEW 14676132,8
  POKEW 14676134,period1
  POKEW 14676136,vol1
  GOTO sweep_loop:
band4:
  LET period1=INT(3563220/(32*sine1))
  POKEL 14676128,(sineaddr&+28)
  POKEW 14676132,16
  POKEW 14676134,period1
  POKEW 14676136,vol1
  GOTO sweep_loop:
band5:
  LET period1=INT(3563220/(64*sine1))
  POKEL 14676128,(sineaddr&+60)
  POKEW 14676132,32
  POKEW 14676134,period1
  POKEW 14676136,vol1
  GOTO sweep_loop:
band6:
  LET period1=INT(3563220/(128*sine1))
  POKEL 14676128,(sineaddr&+124)
  POKEW 14676132,64
  POKEW 14676134,period1
  POKEW 14676136,vol1
  GOTO sweep_loop:

REM Orderly closedown...
getout:
  POKEW 14676118,15     'Turn off audio DMA.
  POKE 12574721,252     'Enable audio filter.
  CLEAR ALLOC
  MENU CLEAR
  FOR n=255 TO 246 STEP -1
  GADGET CLOSE n
  NEXT n
  WINDOW CLOSE 9
REM Beep on a successful exit...
  BEEP
  END

----------------------------------------------------------------------------

  WinUAE_Arduino_ADC.pde IS required for this to work, see above...

  The ACE Basic Compiler Code, (WinUAE_Arduino_ADC.b):-
  -----------------------------------------------------

REM Accessing Arduino as an ADC for WinUAE.
REM This idea copyright, (C)2008, B.Walker, G0LCU.
REM ACE Basic Compiler, (C) David Benn.
REM This is a DEMO only and gives WinUAE another I/O method
REM other than my now ancient WinUAE-ADC.lha on AMINET.
REM
REM $VER: ADC-Arduino_Version_0.00.10_(C)04-10-2008_G0LCU.
REM
REM To be used with the 'Arduino Diecimila' development board.
REM
REM WARNING!!! Do NOT run without the 'Arduino Diecimila' board connected!

REM Generate a simple window.
  WINDOW 2,"WinUAE-Arduino Diecimila ADC DEMO, (C)2008, G0LCU.",(0,0)-(640,200),6
  FONT "topaz.font",8
  COLOR 1,0
  CLS

REM Set up some basic variables.
  LET ser$="0"
  LET a$="(C)2008, B.Walker, G0LCU."

loopit:
REM Open up the serial port for reading. Note, this rate is used purely
REM for simplicity only.
  SERIAL OPEN #3, 0, 1200, "N81", 1

REM Read the 'PORT' for one byte only.
  SERIAL READ #3, ser$, 1

REM IMMEDIATELY close the opened 'PORT' after reading.
  SERIAL CLOSE #3

REM Simple printing to the default window.
  PRINT "Decimal value from Arduino is";ASC(ser$);CHR$(8);".   "

REM Press almost any key to QUIT.
  LET a$=INKEY$
  IF a$="" THEN GOTO loopit:

REM Normal cleanup.
  WINDOW CLOSE 2
  END

----------------------------------------------------------------------------

  Well that's all there is to it... :D

  REMEMBER! Enjoy finding simple solutions to often very difficult problems.

----------------------------------------------------------------------------

                                IMPORTANT:-
                                -----------

    The Legal Stuff:-
    -----------------

    These programs are Public Domain and no profit will be made from them,
    also all of the files must remain unaltered and intact including this
    one. The author is not responsible for any damage to, or loss of, or
    failure of equipment or data caused in any way by the use of these
    programs. There is NO warranty with the use of these software releases
    and YOU USE THEM AT YOUR OWN RISK.

----------------------------------------------------------------------------

    Testing Evaluation:-
    --------------------

    An A1200 in 2MB, 6MB and 10MB modes using trapdoor memory AND/Or PCMCIA
    memory expansions. WinUAE version 1.5.3 in classic Workbench 3.0x mode. 

    Also see above for the Sweeper-HW.b code...

    All test conditions were/are running STANDARD 3.0x, and using standard
    ~topaz 8~ fonts throughout.

    I have no idea what a strange configuration setup will create so refer
    to the ~The Legal Stuff~ above.

----------------------------------------------------------------------------

                                 WARNING.
                                 --------

  1) DISCONNECT any faulty equipment under test from the MAINS supply.
  2) If a DC supply is used do NOT reverse polarity the connections.
  3) Do NOT power up any electronic item until it is safe to do so.
  4) CHECK and RECHECK all of your construction and repair work thoroughly.
  5) Handle ALL tools used with care.
  6) Beware of ALL types of solvents, glues and etching fluids.
  7) NEVER leave a soldering iron switched on unattended.
  8) KEEP everything OUT of the reach of small children.
  9) Switch OFF the AMIGA before disconnecting or connecting any hardware.
 10) And finally read 1) to 9) again.

----------------------------------------------------------------------------

   Contact:-
   ---------

   Mr Barry Walker, G0LCU,

   Email:-     wisecracker@tesco.net
   URL:-       http://homepages.tesco.net/wisecracker/G0LCU.HTM

   Author of the ~TestGear?~ projects in the ~docs/hard~ drawer of AMINET.

----------------------------------------------------------------------------

   A very useful HardWare related site, (C) Anthony Hoffman, for
   modifications, schematics, repairs and the like is:-

                          http://amiga.serveftp.net/

============================================================================




© RIYAN Productions

AmigaZ Logo