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

PIC10F222 timer

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



Joined: 05 Jul 2018
Posts: 3
Location: U.S.A ca

View user's profile Send private message

PIC10F222 timer
PostPosted: Thu Jul 05, 2018 11:09 pm     Reply with quote

Hi,
I like to make a timer which can adjust 20~40 sec for my motor run.
What is the maximum time with this PIC10F222 can make?
Any example example available how to generate time?
I am learning PIC program.

Thanks,
cmkim
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Fri Jul 06, 2018 12:50 am     Reply with quote

There is never really an 'upper' limit on times that can be generated by any processor. After all '100 seconds', is just 100*1 seconds.
ex_time.c can be used on your chip (using timer0), but it really is down to what else is required to happen at the same time. Because this tries to generate an actual 'clock' time, rather than a simple delay, it is bulky. The simple 'delay' function, can perfectly well be used to just wait for 30 seconds.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 06, 2018 3:05 am     Reply with quote

If you want to do timer based delays, the 10F222 is more difficult because
it has no interrupts. This thread shows one way to do it. If you're just
beginning in PICs, this will probably be too advanced, but it may help.
http://www.ccsinfo.com/forum/viewtopic.php?t=35429
ocmkim



Joined: 05 Jul 2018
Posts: 3
Location: U.S.A ca

View user's profile Send private message

RE:
PostPosted: Fri Jul 06, 2018 6:31 am     Reply with quote

Ttelmah wrote:
There is never really an 'upper' limit on times that can be generated by any processor. After all '100 seconds', is just 100*1 seconds.
ex_time.c can be used on your chip (using timer0), but it really is down to what else is required to happen at the same time. Because this tries to generate an actual 'clock' time, rather than a simple delay, it is bulky. The simple 'delay' function, can perfectly well be used to just wait for 30 seconds.


Thanks for the kind reply. I am a beginner to use CCS.
I like to have sample code to get an idea how it works for longer time.

cmkim
Ttelmah



Joined: 11 Mar 2010
Posts: 19549

View user's profile Send private message

PostPosted: Fri Jul 06, 2018 12:35 pm     Reply with quote

If you just want to delay, then delay_ms(30000); will give you a 30 second delay.

However if your code needs to do anything else, then it starts to get much more complex, and is made worse by the very limited features of the chip.
PCM_programmer has given you a great link to a basic polling code to do other things, but even this may well run out of space on your chip....

Honestly, if you are just starting, forget the little 8 pin PIC. Get yourself one of the basic 28 pin or 40 pin devices, preferably something like the Explorer 16 board with the ICD3, and you then actually have a tool that will give you the ability to see what is actually going on inside the chip. Once you have learnt some basics of how to program the chip, you can then start on it's smaller brother....
ocmkim



Joined: 05 Jul 2018
Posts: 3
Location: U.S.A ca

View user's profile Send private message

Re:
PostPosted: Fri Jul 06, 2018 6:35 pm     Reply with quote

Ttelmah wrote:
If you just want to delay, then delay_ms(30000); will give you a 30 second delay.

However if your code needs to do anything else, then it starts to get much more complex, and is made worse by the very limited features of the chip.
PCM_programmer has given you a great link to a basic polling code to do other things, but even this may well run out of space on your chip....

Honestly, if you are just starting, forget the little 8 pin PIC. Get yourself one of the basic 28 pin or 40 pin devices, preferably something like the Explorer 16 board with the ICD3, and you then actually have a tool that will give you the ability to see what is actually going on inside the chip. Once you have learnt some basics of how to program the chip, you can then start on it's smaller brother....


Thanks for you kind comments. I like to use it for small motor run board for model plane.
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