home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!mips!pacbell.com!tandem!zorch!amiga0!mykes
- From: mykes@amiga0.SF-Bay.ORG (Mike Schwartz)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Digitizing
- Distribution: world
- Message-ID: <mykes.0a6x@amiga0.SF-Bay.ORG>
- References: <1992Jul17.174123.3011@newshost.lanl.gov> <1992Jul21.024310.7360@ariel.ec.usf.edu>
- X-NewsSoftware: GRn 1.16e (7/4/92) by Mike Schwartz & Michael B. Smith
- Date: 25 Jul 92 11:10:52 PST
- Organization: Amiga makes it possible
- Lines: 57
-
- In article <1992Jul21.024310.7360@ariel.ec.usf.edu> stelmack@eggo.tmc.edu (Gregory M. Stelmack) writes:
- > I am writing some code to do digitizing. As it should be processor
- > independent, I was going to use the following approach:
- >
- > Allocate a CIA timer
- > Initialize it to countdown depending on my sampling frequency
- > Install an interrupt handler to get the current value
- > Signal the main task when done.
- >
- > So, I started with the CIA timer example from the Devices manual.
- > Unfortunately, the provided code did not compile with SAS/C 5.10b. It
- > complained that it was looking for "CxBase", which was in the pragmas.
- > I changed CxBase in the pragmas to be CIABase, and initialized CIABase
- > depending on the timer I allocated as being the pointer returned from
- > "OpenResource". Is that correct?
- >
- > Now, however, with my own interrupt handler, the machine freezes up, and
- > I have to do the 3 fingered salute three times before the machine reboots.
- > Any ideas what might cause that? Is it something related to that example?
- >
- > If anyone has code that allocates a CIA timer and installs an interrupt that
- > works under SAS/C 5.10b they would be willing to share, I would be most
- > appreciative.
- >
-
- Looks to me as if you are doing things the HARD way. The best way I've
- found to write sampling software is to use the audio hardware interrupts.
- If you don't use audio.device, you can just program the audio hardware
- to go at the sample rate you desire. Stuff a ZERO in the DAC register
- and you get interrupted by the audio hardware at exactly the time you
- want to sample your first byte from the sample. Take that byte and stuff
- it into the DAC register and wait for the next interrupt. Repeat until
- mouse button pressed or you otherwise determine it is time to stop sampling.
-
-
- To test the mouse button with interrupts disabled (a good idea if you want
- accuarate sampling):
-
- btst #6,$bfe001
- beq.s ButtonPressed ; note hardware is inverted logic :)
-
- You can easily code the above in 'C' if you must :)
-
-
- > --
- > -- Greg Stelmack (stelmack@eggo.csee.usf.edu)
- > -- FullTime Grad Student, PartTime Amiga Salesman, PartTime Amiga Developer
- > -- Author of: Spades, Pro Port Analyzer Plus, more to come...
- > -- DISCLAIMER: The opinions reflected here are mine and mine alone.
-
- --
- Amiga programmer of: GRn, MailMinder, Budokan, Beyond Dark Castle, Dark Castle
- Sega Genesis programmer of: Dick Tracy and Marble Madness.
- Mike Schwartz (ames!zorch!amiga0!mykes or mykes@amiga0.sf-bay.org)
- 1124 Fremont Ave.
- Los Altos, CA 94024
-
-