Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
PWM8 problems

 
Post new topic   Reply to topic    Forum Index -> ZX-24
Author Message
sturgessb



Joined: 25 Apr 2008
Posts: 246
Location: Norwich, UK

Posted: 01 November 2008, 20:18 PM    Post subject: PWM8 problems Reply with quote

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 Reply with quote

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: Reply with quote

sorted. sorry I don't know what i was doing, tried your code and then mine again and it works fine.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZX-24 Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group