Author Topic: Programming Problems ....  (Read 2625 times)

0 Members and 1 Guest are viewing this topic.

Offline jessman275Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Programming Problems ....
« on: February 02, 2010, 12:08:46 PM »
Hey Guys and Gals,

For some reason i keep getting this error.

control.c:7: error: 'value' undeclared (first use in this function)
                 ( Each undeclared identifier is reported only once.
                 for each funtion it appears in.)
then ill get

error: `PORTE` undeclared ( first use in this funtion )

my code is.

int control(void)
{
while(1)
{
value=a2dConvert8bit(0);
if(value > 128)//depends on values you expect
    PORT_ON(PORTE,6);
else
    PORT_OFF(PORTE,6);
delay_ms(10);//prevent crazy fast oscillation
}
}
 .........................

this code is in my control

Offline Trumpkin

  • Supreme Robot
  • *****
  • Posts: 1,176
  • Helpful? 5
Re: Programming Problems ....
« Reply #1 on: February 02, 2010, 12:33:45 PM »
You have to declare "value" before you use it, put "int value = 0;" somewhere before you use it. The other errors and warnings are probably because you do not have SoR_Utils.h included in your code. Try puting "#include <SoR_Utils.h>" at the top of your code.
« Last Edit: February 02, 2010, 12:42:33 PM by Trumpkin »
Robots are awesome!

Offline jessman275Topic starter

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Programming Problems ....
« Reply #2 on: February 19, 2010, 05:51:56 PM »
So i keep getting a error that is puzzling me. Its "control.c:16: warning: implicit declaration of function 'a2dConvert8bit' " the code is
Code: [Select]
#define PORT_ON( port_letter, number )
#define PORT_OFF( port_letter, number )

#define PORT_ON( port_letter, number ) port_letter |= (1<<number)
#define PORT_OFF( port_letter, number ) port_letter &= ~(1<<number)

int control(void)
{
while(1)
{


int se5=0;

se5=a2dConvert8bit(0);
if(se5>100)//depends on values you expect
    PORT_ON(PORTE,7);
else
    PORT_OFF(PORTE,7);




}
}

I have a2d.c and a2d.h added to the source and header files. I have been debugging and cant figure this out. I am trying to take a input from a IR sensor ( on F 5 ) and every time it pulses it will send signal to port E 7 to switch a mosfet. Am i on the right track besides the error that im getting?

Thanks

Jesse

 

SMF spam blocked by CleanTalk