View previous topic :: View next topic |
Author |
Message |
ocmkim
Joined: 05 Jul 2018 Posts: 3 Location: U.S.A ca
|
PIC10F222 timer |
Posted: Thu Jul 05, 2018 11:09 pm |
|
|
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: 19515
|
|
Posted: Fri Jul 06, 2018 12:50 am |
|
|
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
|
|
Posted: Fri Jul 06, 2018 3:05 am |
|
|
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
|
RE: |
Posted: Fri Jul 06, 2018 6:31 am |
|
|
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: 19515
|
|
Posted: Fri Jul 06, 2018 12:35 pm |
|
|
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
|
Re: |
Posted: Fri Jul 06, 2018 6:35 pm |
|
|
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. |
|
|
|