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;
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;
mosi=1; clk=0; msdelay(100); clk=1;
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?
http://www.keil.com/forum/tips.asp
"still it shows CS,CLK,MISO,MOSI and P1 as undefined identifier. what can i do?"
remember that the 'C' programming language is case-sensitive, perhaps?