Society of Robots - Robot Forum
Software => Software => Topic started by: junior000 on January 25, 2008, 10:37:03 PM
-
i have a problem using the delays.h
my code goes as follows for blinking an led
void main()
{
TRISC=0b00111111;
while(1)
{
PORTC=0b11000000;//R7 and R6 bits high
Delay100TCx(200); //delay
Delay100TCx(200);
PORTC=0b00000000;//R7 and R6 low
}
}
the problem is
1)the program is being executed but the led outputs are alwasys HIGH.
-
it converts the analog input from port a to digital input for comparision.
the problem in the above program is the statement
OpenADC(ADC_FOSC_2 & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF);//setup adc
the error its showing is "Error [1105] symbol 'ADC_1ANA_0REF' has not been defined"
the output is stored in the registers
ADRES
ADRESH
-
-deleted- (replied to a non-relevant post)
-
i checked it...
its included in the ADC.H and i did include it
-
it converts the analog input from port a to digital input for comparision.
the problem in the above program is the statement
OpenADC(ADC_FOSC_2 & ADC_LEFT_JUST & ADC_1ANA_0REF, ADC_CH0 & ADC_INT_OFF);//setup adc
the error its showing is "Error [1105] symbol 'ADC_1ANA_0REF' has not been defined"
the output is stored in the registers
ADRES
ADRESH
sorry this has nothing to do with the post.i have posted it in the wrong topic.
my apologies
-
i have a problem using the delays.h
my code goes as follows for blinking an led
void main()
{
TRISC=0b00111111;
while(1)
{
PORTC=0b11000000;//R7 and R6 bits high
Delay100TCx(200); //delay
Delay100TCx(200);
PORTC=0b00000000;//R7 and R6 low
}
}
the problem is
1)the program is being executed but the led outputs are alwasys HIGH.
-
They will seem to be high because you have 2 delays after they have been set high, then no delay when they are set low.
use this code instead -
PORTC=0b11000000;//R7 and R6 bits high
Delay100TCx(200); //delay
PORTC=0b00000000;//R7 and R6 low
Delay100TCx(200);
-
yeah...what a dumb mistake i have made
...thanks anyways