|
|
| Author |
Message |
sturgessb
Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK
|
|
Posted: 01 November 2008, 20:18 PM Post subject: PWM8 problems |
|
|
Hi Guys
Are there any known problems with the new compiler and PWM8, Im opening and setting, but no output?
Any ideas?
Ben |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 01 November 2008, 20:50 PM Post subject: Re: PWM8 problems |
|
|
| sturgessb wrote: | | Are there any known problems with the new compiler and PWM8 | There are no known problems. Which ZX device are you using? Can you post some simple test code that doesn't work. The code below produces a "winking" effect on the red LED for a ZX-24a. | Code: | Const DutyChg as Integer = 1
Const Period as Single = 0.01
Const MaxDuty as Integer = 100
Const MinDuty as Integer = 0
Const PWM_chan as Byte = 1
Sub Main()
Call OpenPWM8(PWM_chan, 50.0, zxFastPWM)
Dim duty as Integer, change as Integer
Call SetInterval(Period)
duty = 0
change = DutyChg
Do
Call PWM8(PWM_chan, duty)
Call WaitForInterval(0)
duty = duty + change
If (duty > MaxDuty) Then
duty = MaxDuty
change = -DutyChg
ElseIf (duty < MinDuty) Then
duty = MinDuty
change = DutyChg
End If
Loop
End Sub |
|
|
| Back to top |
|
 |
sturgessb
Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK
|
|
Posted: 05 November 2008, 15:51 PM Post subject: |
|
|
| sorted. sorry I don't know what i was doing, tried your code and then mine again and it works fine. |
|
| Back to top |
|
 |
|