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

undefined identifier error(c202)

i write this code for LDR connected with the AT89s52 through the ADC MCP3208.
i write the below code.

#include<at89s52.h>
#include<stdio.h>

sbit CLK=P1^2;
sbit MISO=P1^3;
sbit MOSI=P1^4;
sbit CS=P1^5;

float read_adc(unsigned int channel)
{ { unsigned int adc_val=0; float temp; char i;

cs=1; clk=1; mosi=1; miso=1;

cs=0; mosi=1; clk=0; msdelay(100); clk=1;

mosi=1; clk=1;

mosi=0; clk=0; msdelay(100); clk=1;

mosi=0; clk=0; msdelay(100); clk=1;

mosi=0; clk=0; msdelay(100); clk=1;

for(i=11;i>=0;i-) { clk=0;

if(miso) adc_val|=(1<<i);

clk=1; } cs=1;

temp1=((adc_val*5.0/4095); return temp1; }

{ unsigned int adc_val=0; float temp; char i;

cs=1; clk=1; mosi=1; miso=1;

cs=0; mosi=1; clk=0; msdelay(100); clk=1;

mosi=1; clk=1;

mosi=0; clk=0; msdelay(100); clk=1;

mosi=0; clk=0; msdelay(100); clk=1;

mosi=1; clk=0; msdelay(100); clk=1;

for(i=11;i>=0;i-) { clk=0;

if(miso) adc_val|=(1<<i);

clk=1; } cs=1; temp2=((adc_val*5.0/4095); return temp2; }
}

void init_uart()
{ SCON=0X50; TMOD=0X20; TH1=OXFD; TR1=1; TI=1;
}

still it shows CS,CLK,MISO,MOSI and P1 as undefined identifier. what can i do?