CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to run a controller on very low speed

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

How to run a controller on very low speed
PostPosted: Mon Feb 29, 2016 5:46 am     Reply with quote

Greetings! I want to use dsPIC30F5015 on very low speed. I think 32kHz should be OK! I tried to put 32kHz quartz as main oscillator, but it doesn't work. Can you help me?!
Thanks!
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 6:11 am     Reply with quote

Ok I have to ask WHY? You do realize it'll take forever to run EVERY line of code? At least 1000s of time slower ?

Now to run at 32KHz, use an external oscillator and divide it down or use a watch xtal and 4049 to roll your own.Since I don't use dsPIC I can't say IF it can run from the internal 32KHx osc (if it has one ?).

EDIT: OK downloaded the datasheet, simplest way is a 4049 and 32KHz xtal though it will be snail slow and a real waste of PIC processor/speed.
Now I really want to know why as all operation will consume a LOW more power to execute.

Jay
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 7:08 am     Reply with quote

Hi! Can I use RC group instead of oscillator?!
Thanks!

PP: I need the low speed because of the motor control unit. The debugger doesn't give any real feedback on it's registers. So I need to improvise!
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 7:30 am     Reply with quote

I read the datasheet page 152 that the LP mode ( 32KHz on sosc) can be shared with system clock, maybe that will work for you. Couldn't find the chart of RC mode which most PICs can run though....

It sure will be slow running !!

EDIT:
as for slow running, I did use a 4060 with 2.4576MHz xtal and /1024 to create a 2400 Hz clock THEN divide by 100 to get 24 Hz. This is the UART clock for my remote engery control system, could get 15 miles with it.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 10:02 am     Reply with quote

The lowest frequency mode, would be to use an external oscillator.
As Temtronic says a simple 4049, or a little crystal module.
EC mode supports operation down to DC.

Generally though the 'per instruction' power consumption rises at very low frequencies, and there is nothing that can be done at low speeds that couldn't be done by just writing the code to be slower. Your comment 'I need the low speed because of the motor control unit', doesn't really make any sense. I can do jobs hundreds of seconds per effective cycle, clocking at 60Mhz. Far the simplest way is to use the internal RC oscillator, and just write your code to give the speed required.
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 10:26 am     Reply with quote

I'll put RC oscillator. Now I'm looking into 70054 Microchip oscillator AN. On page 29 there is a graphic which says 300pF and 10k should be equal to around 75kHz!
I'll try it!
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Feb 29, 2016 10:58 am     Reply with quote

Just remember that RC oscillators are NOT 'precise' by any means and will vary widly with temperature and humidity. Maybe not a concern on the bench but in the field it's a big deal,that's why I went the 4060/xtal route.
I imaging 'startup 'time to big quite awhile as well. Obviously nothing is time critical in your test !!???

Jay
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 2:20 am     Reply with quote

There is a problem! I found the controller has internal RC 512kHz oscillator. I conducted blink test and everything works fine. The problem comes with the motor control unit. It seems this unit stays on the internal 8MHz oscillator in spite of I`ve sellected RC 512kHz oscillator.
I`ve tried with external RC oscillator - same result!
Any suggestions?!
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Tue Mar 01, 2016 4:32 am     Reply with quote

What are you setting the prescaler to?.

This is what I was saying about using a higher speed. You have the PTPER register controlling the actual count, and a prescaler.
The prescaler is the third value in the setup_motor_pwm function

setup_motor_pwm(1,MPWM_FREE_RUN,64,0,0x7FFF);

Gives /64 prescaler.

You can then run the CPU at a much more sensible rate....

Prescaler can be 1, 4, 16 or 64.

Also, look at the 70268A data sheet already mentioned. This shows where Fpwm actually comes 'from' in th various clock routes.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group