You get your sound from PORTB,3 And unzip the PW file and place it in your swordfish user Library. You put the PW.bas in the user library only. Here the code
Code:
{
*****************************************************************************
* Name : UNTITLED.BAS *
* Author : [select VIEW...EDITOR OPTIONS] *
* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
* : All Rights Reserved *
* Date : 3/31/2009 *
* Version : 1.0 *
* Notes : hook your sound up from PORTB.3 *
* : *
*****************************************************************************
}
Device = 18F1320
Clock = 8 // tells the compiler the FOSC speed
Config OSC = INTIO2, WDT = OFF, LVP = OFF
Include "Utils.bas"
Include "PW.bas" // import PWM module..
Dim Duty As Byte
OSCCON = %01111111 // select 8MHz internal oscillator
SetAllDigital
// main program...
PWM.SetFreq(5000) //this set it for a 5000khz
While true
Duty = 40 // this starts it at 2000khz
Repeat
PWM.SetDutyPercent(Duty)
Inc(Duty)
DelayMS(25)
Until Duty > 100 // takes it up to 5000
Repeat
PWM.SetDutyPercent(Duty)
Dec(Duty)
DelayMS(25)
Until Duty = 40 // lower it back down
Wend