BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 11:59 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Am I reading the manual wrong or is the manual wrong?
PostPosted: Tue May 11, 2010 2:26 pm 
Offline
Citizen

Joined: Wed Nov 25, 2009 3:33 pm
Posts: 16
Location: Webster, NY
According to the sample in page 143 of the manual, the following code should work.
pwm p7,duty, duration
However, when I try to build the following program, I get error messages in the areas indicated in the code.
Am I reading the manual wrong or is the manual wrong? :?
Code:
         MAIN
pulsin 0,1,RXIN
RXIN=RXIN/3
         Jumper
If RXIN < 125 then Blinker
If RXIN < 175 then Blinker1
         CONT_CHANGE
OUTL = %00000000
For duty = 90 to 255 step 15
pwm p7,duty,duration       '****ERROR****
pause Paus
duty = duty + stepp
pwm P6, duty, duration     '****ERROR****
pause Paus
duty = duty + stepp
pwm p5, duty, duration     '****ERROR****
pause Paus
duty=duty-(stepp*2)
pulsin 0,1,RXIN
RXIN=RXIN/3
'debug [dec RXIN,13]
If RXIN >174 then Jumper1
DIRL = %00010001
Goto Main
Jumper1
NEXT
goto Main


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Tue May 11, 2010 6:45 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
It's possible that "duty" and "duration" are reserved words, in which case Studio will throw a hissy fit. Try changing the variable names and see if that flies right.
Later.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Tue May 11, 2010 7:14 pm 
Offline
Citizen

Joined: Wed Nov 25, 2009 3:33 pm
Posts: 16
Location: Webster, NY
It did not work when I changed the names
But it worked if I changed from
pwm p7, duty, duration
to
pwm p7, duty, duration, 1
Does that mean that it, in this case, will perform one cycle and stop?
Something must have changed in the compiler because that instruction worked before


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Tue May 11, 2010 7:53 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
This command may have a "period" variable as well. I'm not home so can't check the "new" (unreleased) manual that contains later syntax. And syntax can differ between Atom/Nano and Atom Pro devices. Let me get home and check the manual. Maybe I'll dump the entire "PWM" section in here.
Later.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Tue May 11, 2010 8:11 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
the PWM command has 4 arguments. pin,period,duty,cycles

Cycles is how many periods to execute. Because the software PWM command does not run in the background you must specify how long it runs(eg by using the cycles argument) before moving on to the next command.

The HPWM command has 3 arguments and DOES run in the background so you don't specify how long it runs. Arguments are pin,period,duty and pin has to be a HPWM capable pin(eg like p9,p10 or p11 on a Pro28 module).

So definitely looks like a manual typo. We are making headway in the complete rewrite of the manual though it's always slower than we'd like.

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Wed May 12, 2010 9:27 am 
Offline
Citizen

Joined: Wed Nov 25, 2009 3:33 pm
Posts: 16
Location: Webster, NY
I think I found the answer.
I wrote the program sometime ago and it built without problems.
BUT the version of basic studio that was using then, was 1.0015.
With that version, I assume, that the number of cycles defaulted to 1 and did not generate an error message.
My challange now is to find a pic with the capability to perform THREE continuous PWM in the background
Thank you Acidtech and Ken for your replies
Andres


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Thu May 13, 2010 10:26 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
No. The previous version of PWM had no period argument. It had pin,duty,cycles.

I afraid there is no PICmicro I'm aware of that has 3 HPWM channels. You could move to an AtomPro processor which has 3(or 6) HPWM capable pins. You could also write an ISRASM routine that produced an interrupt driven PWM on however many pins you wanted depending on how fast you need the PWM to function(eg this would need to be pretty slow PWMing).

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Thu May 13, 2010 6:05 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Get the data sheet for the PIC16F88x series. This series covers all non-Pro Atoms, except the Nano18. Check out CCP1. It has FOUR multiplexed hardware PWM outputs. These four pins have four possible output types, including half bridge and fullbridge capability, with deadband feature for good measure. Get a brew first, it is a considerable read.
This might be just what you need. And it may not.
Later.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Am I reading the manual wrong or is the manual wrong?
PostPosted: Fri May 14, 2010 9:39 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 903
Location: Temecula, CA
Yes, the 88X chips technically have 4 outputs for CCP1 but they are all linked. So they can't have unique PWM periods or duties. So they are not considered 4 PWMs, just 1. If that is what you need though, a full bridge or half bridge PWM driver, then that is what you want to use. However you will have to set it up manual. The HPWM command will only use the CCP hardware in single channel mode(eg one PWM output per CCP).

_________________
Tech Support
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO