A PIC can switch it's I/O in only a few uS - probably a lot faster than your Audio Chip can handle. You need to refer to the Datasheet of your Audio Chip to see how big or small those control pulses need to be.
You pretty much got the code, except I would set the pin High or Low BEFORE setting the TRIS... Here's an example to send a 250uS Pulse...
If there is a minimum time BETWEEN consecutive pulses specified in the Datasheet, you may need a suitable PAUSE (or PauseUS) just before the RETURN statement.Code:SoundUp con 1 SoundDown con 0 ChAVol var PortC.1 ChATris var TRISC.1 ' Assumes ChATris=1 previously initialised... ' ' Subroutine Pulses Channel-A Sound UP ' ------------------------------------ ChASoundUp: ChAVol=SoundUp ChAPulse: ChATris=0 PauseUS 250 ChATris=1 Return ' ' Subroutine Pulses Channel-A Sound DOWN ' ---------------------------------------- ChASoundDown: ChAVol=SoundDown Goto ChAPulse




Bookmarks