go_away

Author Topic: using delays.h of c18 compiler  (Read 10603 times)

0 Members and 1 Guest are viewing this topic.

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
using delays.h of c18 compiler
« 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.
       
view my tutorials at


www.myfirstbot.blogspot.com

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
Re: using delays.h of c18 compiler
« Reply #1 on: January 25, 2008, 11:19:26 PM »
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
view my tutorials at


www.myfirstbot.blogspot.com

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: using delays.h of c18 compiler
« Reply #2 on: January 25, 2008, 11:39:30 PM »
-deleted- (replied to a non-relevant post)
« Last Edit: January 26, 2008, 08:13:49 AM by rgcustodio »
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
Re: using delays.h of c18 compiler
« Reply #3 on: January 25, 2008, 11:46:21 PM »
i checked it...
its included in the ADC.H and i did include it
view my tutorials at


www.myfirstbot.blogspot.com

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
Re: using delays.h of c18 compiler
« Reply #4 on: January 25, 2008, 11:51:46 PM »
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
view my tutorials at


www.myfirstbot.blogspot.com

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
Re: using delays.h of c18 compiler
« Reply #5 on: January 25, 2008, 11:53:20 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.
       
view my tutorials at


www.myfirstbot.blogspot.com

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: using delays.h of c18 compiler
« Reply #6 on: January 26, 2008, 04:37:17 AM »
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 -
Code: [Select]
        PORTC=0b11000000;//R7 and R6 bits high
        Delay100TCx(200);   //delay
        PORTC=0b00000000;//R7 and R6 low
        Delay100TCx(200);
Imperial College Robotics Society
www.icrobotics.co.uk

Offline junior000Topic starter

  • Full Member
  • ***
  • Posts: 59
  • Helpful? 0
Re: using delays.h of c18 compiler
« Reply #7 on: January 26, 2008, 06:04:20 AM »
yeah...what a dumb mistake i have made

...thanks anyways
view my tutorials at


www.myfirstbot.blogspot.com

 


Get Your Ad Here

data_list