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
PWM and Timer Conflicts

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 22 December 2006, 22:36 PM    Post subject: PWM and Timer Conflicts Reply with quote

In my ever increasing monstrosity of an application, I find the need to dim an LED. 12 of them actually. I'm using Com1 for continuous PC communications, Timer 1 for Counting a pulse train (along with WaitForInterrupt), and there's 5 tasks running besides the Main task.

I'm a little fuzzy on what conflicts with what, and I'm unsure what method I can use to perform the dimming. PWM would be the first choice, but I could also use PutDAC although I'm fairly sure that the 200uS delay would interfere with the pulses I am counting.

Don, is there a list or table somewhere that describes what timers and which functions can and/or can't be used simultaneously? There are references throughout the system library and other documentation, but they always elude to the fact that there are more than what is listed.

-Don
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 23 December 2006, 1:00 AM    Post subject: Re: PWM and Timer Conflicts Reply with quote

Don_Kirby wrote:
[...]is there a list or table somewhere that describes
what timers and which functions can and/or can't be used simultaneously?
The overview is that the RTC uses Timer0, some I/O routines use Timer1 and serial I/O on Com3-6 use Timer2. Each I/O routine that requires Timer1 indicates so in the description but there is also a comprehensive list in the ZBasic Reference Manual.

In almost all cases, Timer1 is only required for the duration of the specific call. The exceptions are ADCtoCom1() and Com1ToDAC() where the processes is performed in the background. This means that there is no possibility (with the noted exceptions) that one task using a particular I/O routine will cause the failure of another task attempting to use an I/O routine that needs Timer1.

However, if you choose to use Timer1 by directly manipulating its registers (during which time you should obtain and hold a semaphore on Register.Timer1Busy) it is possible that a routine requiring Timer1 will fail.
Back to top
Don_Kirby



Joined: 15 Oct 2006
Posts: 329
Location: Long Island, New York

Posted: 23 December 2006, 13:15 PM    Post subject: Re: PWM and Timer Conflicts Reply with quote

dkinzer wrote:

However, if you choose to use Timer1 by directly manipulating its registers (during which time you should obtain and hold a semaphore on Register.Timer1Busy) it is possible that a routine requiring Timer1 will fail.


I am, in fact, manipulating the Timer 1 registers directly.

Reading AN-216, I find that it is possible to use Timer 2 to generate a PWM signal. I think that might be the way to go.

On a related topic; I had, in the past, avoided the use of PWM in this circuit for fear of generating RFI. Do devices using PWM fall under FCC part 15?

-Don
Back to top
dlh



Joined: 15 Dec 2006
Posts: 266
Location: ~Cincinnati

Posted: 23 December 2006, 15:58 PM    Post subject: Reply with quote

Anything that plugs into the mains is subject to the conducted emissions limits and anything that emits RF within the frequency range covered by Part 15 is subject to the "unintentional radiator" emission limits. You can self-test for the former (or use a wall-wart) but are supposed to use FCC certified labs for the latter.

However, the FCC appears far more interested in boobs than in these more mundane technical matters.
Back to top
GTBecker



Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral

Posted: 23 December 2006, 16:23 PM    Post subject: Reply with quote

What is about PWM that might be more RF-troublesome than any other rectangular wave?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language 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