This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADC for IR sensor ..error C67:DP5 Undefined identifier

Hi there,

Just went through discussions, but could not get any satisfactory thread.

I want to control 3 IR sensors and a Ultrasonics.

For IR, I tried to configure port 5, but, it gives error "C67:DP5 Undefined identifier "

the code was:
----------------------------------------------------

#include <reg167.h>

sbit DP5_0 = DP5^0;
sbit DP5_1 = DP5^1;
sbit DP5_2 = DP5^2;
sbit DP5_3 = DP5^3;

unsigned int GetReading (unsigned char channel)
{ ADCON = 0xB000;
ADCON |= channel & 0x000F; /* Select channel to
ADST = 1; /* Begin conversion
while (ADBSY == 1); /* Wait while the
return (ADDAT & 0x03FF)
}

void Get_Signal (void)

{ unsigned char i; unsigned int result;

DP5 = 0x000F;
P5_1 = 0;

while(1) { for (i = 0; i < 16; i++) { result = GetReading (i); } }

void main(void)
{ Get_Signal ();
for(;;)
; }

-------------------------------------------------------
I am using uVision 3.

I would really appreciate if I get an expert's opinion.

Thank you.

Amit

Parents
  • "How my uC is supposed to know that I've connected some sensors"

    In general, it doesn't "know" - you just write the code on the assumption that the sensors will be there, as specified in your design requirements...

    If there is a possibility that the sensors may not be there, then you will need to design-in facilities to detect them - that will certainly require additional software, and probably also additional hardware.

    If there is the further possibility that different types of sensors may be connected, then you will need to design-in further facilities to identify them and select the appropriate handling...

Reply
  • "How my uC is supposed to know that I've connected some sensors"

    In general, it doesn't "know" - you just write the code on the assumption that the sensors will be there, as specified in your design requirements...

    If there is a possibility that the sensors may not be there, then you will need to design-in facilities to detect them - that will certainly require additional software, and probably also additional hardware.

    If there is the further possibility that different types of sensors may be connected, then you will need to design-in further facilities to identify them and select the appropriate handling...

Children
No data