home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / amiga / programm / 11644 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  3.0 KB

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