raflab
Newbie level 1
I'm trying to create a delay with N minutes using timer 1 .. I found the following code
So if is it possible I want to replace the 0.5 sec by 2 minutes ( for example )
( I said N minutes because that's related to the user that he will be able to send it through VB interface using Serial port communication )
I won't use the delay_ms because it will be imprecise
I really need some help !! :-|
Thanks
Code:
#include <16F628A.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
//======================
void main()
{
int16 delay = 0;
SET_TIMER1(delay);
SETUP_TIMER_1(T1_INTERNAL | T1_DIV_BY_8);
while(TRUE)
{
if(GET_TIMER1() <32768)
OUTPUT_LOW(PIN_A1);
if(GET_TIMER1() >32768)
OUTPUT_HIGH(PIN_A1);
}
}
So if is it possible I want to replace the 0.5 sec by 2 minutes ( for example )
( I said N minutes because that's related to the user that he will be able to send it through VB interface using Serial port communication )
I won't use the delay_ms because it will be imprecise
I really need some help !! :-|
Thanks