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

Alter Prog. Execution Speed

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Ahmed El Sherbiny
Guest







Alter Prog. Execution Speed
PostPosted: Sun Jun 15, 2003 3:33 am     Reply with quote

Hello everyone,

I'm building a PIC-controlled circuit, and I want the user to be able to change the program execution speed (or part of the program's execution, whatever) - I think the most suitable way is a potentiometer.

How do I implement this ? using ADC, perhaps ?
Any suggestions are welcome

Thank you in advance
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515252
R.J.Hamlett
Guest







Re: Alter Prog. Execution Speed
PostPosted: Sun Jun 15, 2003 4:35 am     Reply with quote

:=Hello everyone,
:=
:=I'm building a PIC-controlled circuit, and I want the user to be able to change the program execution speed (or part of the program's execution, whatever) - I think the most suitable way is a potentiometer.
:=
:=How do I implement this ? using ADC, perhaps ?
:=Any suggestions are welcome
:=
:=Thank you in advance
It depends on what you want to do. You _could_ use a potentiometer, to return a reading to an A/D, which you then use to change a value used in a time delay. However this would still leave the instructions between the delay running at full speed, and only code with delays would change. The advantage of this is low cost, but the disadvantage is that accurate 'speeds' won't be available, and won't affect all the code.
Some PICs, contain hardware to allow 'two speed' operation. On these, you can run the processor, off the main oscillator, or 'switch down' to the second oscillator for low speed operation.
You could also offer genuine 'variable speed' operation, by a variety of means. For instance, run the chip of the external R/C oscillator, and use a CMOS bilateral switch, to change the resistance used in the oscillator, and the speed. The disadvantage of this, is that the speeds will never be accurate, but this is relatively simple to do, and could easily give a reasonably wide speed range, and will affect all the code. The OSCCAL register allows similar behaviour over a limited range for the internal RC oscillator, on models supporting this.
You can use an external switchable crystal divider, to give multiple accurate speeds. You have to be careful, that the divider logic used, does not give spurious pulses when the rate is changed. The advantage of this approach, is that you could program operation at (say), 16MHz, 8MHz, 4Mhz, with each rate being accurate. There are several programmable chips on the market that can do this. The Dallas DS4000, is an example of this type of unit, which under SPI control, allows the output frequency to be programmed over a wide range.
You need to work out how much the speed must change, and what actually has to change (for instance, if your chip is using RS232, you don't really want to change the oscillator frequency, to a lot of different rates).

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515253
Ahmed El Sherbiny
Guest







Re: Alter Prog. Execution Speed
PostPosted: Mon Jun 16, 2003 12:59 am     Reply with quote

Thanks alot for your help.

I guess I'll go with the ADC, or maybe changing the RC osc. frequency (if RC proves to be sufficient - I'm currently using a crystal).

Thanks again
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515276
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