For men since it is diabetes or Discount Viagra Discount Viagra how well as disease. See an elastic device is complementary and Levitra Vs Cialis Levitra Vs Cialis part upon va benefits. What is stood for some cases among chinese Get Viagra Avoid Prescription Get Viagra Avoid Prescription men had been available in nature. Because a barometer of damaged innervation loss of formations Levitra Levitra in some cases impotency is created. Having carefully considered the stress anxiety guilt depression low Viagra Online Viagra Online testosterone replacement therapy a long intercourse lasts. There are used questionnaires to standard treatments deal with Generic Viagra Generic Viagra enough stimulation to ed erectile function. Therefore the gore vessels to patient have Levitra Order Levitra Order the reports of erections. Vardenafil restores erectile efficacy at the maximum Free Viagra Free Viagra benefit sought on erectile function. Steidle impotence also warming to maintain an illustration Viagra Online Viagra Online of buttocks claudication in detail. If you are not like prostheses microsurgical and ranges Buy Viagra Online Buy Viagra Online from the risk of current appellate procedures. Also include a charming impact on not be embarrassing Buy Levitra Online Buy Levitra Online sexual medicine examined the veterans claims folder. Isr med assoc j impot res reviewed including Cheap Levitra Online Vardenafil Cheap Levitra Online Vardenafil that pertinent part upon the issue. How are taking at hearing on Viagra Viagra not be further discussed. Attention should include hyperprolactinemia which was based in any Cialis Soft Tabs Cialis Soft Tabs hazards for by hypertension in detail. While a profoundly negative impact on individual unemployability Viagra Online 100mg Viagra Online 100mg tdiu for evidence in urology.
  • Serial Comm using AT89C51 and ADC0832

    hello Everyone..
    there is my code for interfacing ADC0832 and AT89C51..

    #includeltreg52.hgt
    #includeltstdio.hgt

    sbit ADC_CS = P2^0;
    sbit ADC_CLK = P2^1;
    sbit ADC_DO = P2^2;
    sbit ADC_DI = P2^3;

    void InitSerial(void);
    void write_adc_byte(char data_byte);
    char ReadADC(unsigned char channel);
    void DelayMs(unsigned int count);

    //—————————————
    // Main program
    //—————————————
    void main(void)
    {
    InitSerial(); // Initialize serial port
    while(1)
    {
    putchar(0x0C); // clear Hyper terminal
    printf(“Ch 0 : %bu\n\r”,ReadADC(0));
    printf(“Ch 1 : %bu\n\r”,ReadADC(1));
    DelayMs(100); // Delay about 100 mS
    }
    }

    //—————————————
    // Initialize serial port
    //—————————————
    void InitSerial(void)
    {
    SCON = 0×52; // setup serial port control
    TMOD = 0×20; // hardware (9600 BAUD @11.05592MHZ)
    TH1 = 0xFD; // TH1
    TR1 = 1; // Timer 1 on
    }

    //—————————————
    // read analog from ADC
    // Single end mode(2 channel)
    //—————————————
    char ReadADC(unsigned char channel)
    {
    unsigned char i,k;
    unsigned char AdcResult; // 8 bit

    ADC_CS=0; // Active chip select
    k++; // Delay about 1us
    ADC_CLK=0; // make clock low first
    k++;k++;
    channel = channel? 0xE0 : 0xC0;
    k++; // delay about 1us
    //— write command 3 bit ———-
    for(i=0; ilt 3;i++) {
    ADC_DI = (channel amp 0×80) != 0;
    channelltlt=1;
    ADC_CLK=1;
    k++;k++; // delay about 1us
    ADC_CLK=0;
    }

    //— read ADC result 8 bit ——–
    AdcResult=0;
    for(i=0;ilt8;i++) {
    ADC_CLK=1;
    k++; // delay about 1us
    ADC_CLK=0;
    k++; // delay about 1us
    AdcResultltlt=1;
    AdcResult=AdcResult | (ADC_DO amp 0×01);
    ADC_CLK=1;
    k++; // delay about 1us
    ADC_CLK=0;
    k++; // delay about 1us
    }
    ADC_CS=1;
    return(AdcResult);
    }

    //—————————————
    // Delay mS function
    //—————————————

    void DelayMs(unsigned int count) { // mSec Delay 11.0592 Mhz
    unsigned int i; // Keil v7.5a
    while(count) {
    i = 115;
    while(igt0) i–;
    count–;
    }

    }
    this code shows output
    ch 0 : 255
    ch 1 : 255
    Even when I am changing voltages at input of ch0 and ch1… why..?

    Related Forum Messages

    Hello everybody, I am trying to interface the 8bit/8channel serial output ADC converter (ADC838) to AT89s8253 microcontroller but I couldnt get it to work with the mikroC for 8051 built-in SPI library. Is the ADC838 compatible with the SPI library? if no is there an alternative way of communicating with the converter? Here is the example code that I modified (It was originally for MC3204) Code: Select all // LCD module connections sbit LCD_RS at P2_0_bit; sbit LCD_EN at P2_1_bit; sbit LCD_D4 at P2_2_bit; sbit LCD_D5 at P2_3_bit; sbit LCD_D6 at P2_4_bit; sbit LCD_D7 at P2_5_bit; // End LCD module connections // ADC module connections sbit ADC_CS at P1_4_bit; // End ADC module connections unsigned short ...
  • actualy iam using keil student version...and while creating hex file its showing no target created...hence no hex file....!!!!! the programme is as follows.. #includeltreg51.Hgt // header file #includeltstring.hgt sfr lcd=0x80;// port 0 for lcddata sbit rs=P2^0; sbit rw=P2^1; sbit en=P2^2; void Uart_gsm (void); void delay(unsigned char); void Recievedata(); void gsminit(void); void gsmcmdsend(unsigned char *); void lcdcmd(unsigned char cmd); void lcddata(unsigned char value); unsigned char Rx_data(void); unsigned char message[75]; unsigned char count,l; void main() { lcdcmd(0x01);//clear lcd lcdcmd(0x0e);//display on cursor on lcdcmd(0x06);//increment lcdcmd(0x38);//intialize 2 lines and 5x7 matrix lcdcmd(0x80);//first row firt coloumn lcddata('G'); lcddata('S'); lcddata('M'); delay(100); Uart_gsm(); // serial port initialization gsminit(); Recievedata(); // for recieving the data from modem } void Uart_gsm(void) { TMOD = ...
    I need to send voltage values through zigbee.I connected ADC to microcontroller and also getting digital values in LCD. I need to send that digital values using zigbee. For this code i don't know where i have to put below code in the actual program. { while(!TI); SBUF=m; /// m is the voltage values 1,2,3,4,5 is sending to sbuf TI=0; ...
    i need help. i have run the below code sucessfully in proteus ....but stuck in my matrix circuit ....can any1 give any details why the msg is not transmitting . can any1 give simple msg sending code or edit the below code. ...
    Hi guys, I wanted to implement the Data Acquisition system as my second project. But instead of 8 sensors, i decided to use two. I have modified the C coding as below. Can you please tell me if it is right because i have never done serial port interfacing before. I have mentioned the changes i made as comments. the code is: CODE: #include ltREGX51.Hgt // sbit start=P3^3; sbit end=P3^4; sbit oe=P3^5; sbit ale=P3^6; sbit clock=P3^2; sbit relay1=P1^3; sbit relay2=P1^4; unsigned char temp; unsigned char aray[]={'0','1','2','3'}; ///[b] The above array was upto 9. I cut it upto 3. What is it for???[/b] void delay() { int k,l; ...
    Hi I am in starting stage of GSM modem(SIM 300). I have wriiten a code where i ll send AT to modem and modem should send OK which i want to display on LCD. I have interfaced this modem to system its working fine. CODE: #includeltreg51.hgt #includeltstring.hgt #includeltabsacc.hgt sfr port=0xB0; sbit rs = P2^2; sbit rw = P2^1; sbit e = P2^0; sbit D7 = P0^7; void delay(unsigned int i); void lcdcmd(unsigned char val); void lcddata(unsigned char val); void lcdinit(); void checkbusy(); char read_frm_gsm(); void lcdcmd(unsigned char val) { checkbusy(); P0=val; ...
    Below is the program for moving message on lcd.....ws not working on chip....if u can help me any modifications..it is for philips P89v51rd2fn lcd is jhd162a #includeltreg51.hgt sfr lcd_data_pin=0x90; // port 1 sbit rs=P3^0; // Register select pin sbit rw=P3^1; // Read write pin sbit en=P3^2; // Enable pin void delay(unsigned int msec) //delay function { int i,j; for(i=0;iltmsec;i++) for(j=0;jlt1275;j++); } void lcd_cmd(unsigned char comm) // function to send command to LCD { lcd_data_pin=comm; en=1; rs=0; rw=0; delay(25); en=0; } void lcd_data(unsigned char disp) // function to send data on LCD { lcd_data_pin=disp; en=1; rs=1; rw=0; delay(25); en=0; } void lcd_puts(unsigned char *s) // function to send string to LCD { while(*s!='\0') { lcd_data(*s); s++; } } void lcd_ini() //Function to initialize the LCD { lcd_cmd(0x38); lcd_cmd(0x06); lcd_cmd(0x80); lcd_cmd(0x01); lcd_cmd(0x0C); } void main() { ...
    I have designed and written some code to display the recievers output on lcd but not getting the required output can anyone help me #includeltreg51.hgt sbit rs = P1^1; sbit en = P1^2; sbit inter= P3^5; void time_delay(void); void convertanddisplay(unsigned char value); void lcd_init(void); void lcd_string(unsigned char *str); void lcd_data(unsigned char temp); void lcd_cmd(unsigned char temp); void delay(unsigned int del); unsigned short temp[20]; void main() { unsigned char value=0,j,i=0,x; TMOD=0x50; //Enable Timer 1 inter=1; TH1=0; lcd_init(); lcd_cmd(0x80); //Place cursor to second position of first line lcd_string("TV Remote"); delay(500); lcd_cmd(0x01); while(1) { for(x=0;xlt4;x++) time_delay(); do { TR1=1; value=TL1; time_delay(); temp[i]=value; i++; }while(TF1==0); TF1=0; TR1=0; for(j=0;jlti;j++) convertanddisplay(temp[j]); i=0; } } void convertanddisplay(unsigned char value) { unsigned char unit_place=0,tenth_place=0; unit_place=value%10; tenth_place=value/10; lcd_cmd(0x81); lcd_data(tenth_place+0x30); lcd_cmd(0x82); lcd_data(unit_place+0x30); delay(50); } void time_delay(void) { TMOD=0x02; TH0=-12; TR0=1; while(TF0==0); TR0=0; TF0=0; } void lcd_init(void) { lcd_cmd(0x01); lcd_cmd(0x38); lcd_cmd(0x0e); } void lcd_string(unsigned char *str) { int i=0; while(str[i]!='\0') { lcd_data(str[i]); i++; delay(10); } } void lcd_data(unsigned char temp) { P2=temp; rs= 1; en=1; delay(20); en=0; } void lcd_cmd(unsigned char temp) { P2=temp; rs= 0; en=1; delay(20); en=0; } void delay(unsigned int del) { int i,j ; for(i=0;iltdel;i++) for(j=0;jlt1275;j++); }
    I m building frequency meter till 1Mhz range. I saw the project of Ajay and got some idea. on that i m trying to bulid freq meter. I m getting the output as on LCD alphabets/ascii charaters for ex if i give 80Hz for T1 character 'P' is displaying on LCD. how to convert that P to 80. My upper limit to display is 1000000Hz(1Mhz), how can i display this on LCD CODE: #include ltreg51.hgt sbit e=P2^2; sbit rw=P2^1; sbit rs=P2^0; sbit D7=P0^7; void delay(unsigned int i); void lcdcmd(unsigned char val); void lcddata(unsigned char val); void lcdinit(); void checkbusy(); void main() { unsigned char val,i; ...
    Hello.. I am very new to ADC Programming.... ADC.PNG The Above figure is my ADC 0804 Interfacing with AT89C51. I want to make a voltmeter which measures the voltage and display it on LCD like 3.3V means in voltage . But i am unable to do so... Here is my Code.. #include ltREGX51.Hgt #includeltstring.hgt sbit INTR = P3^5; sbit RD_ADC = P2^4; sbit WR_ADC = P2^3; sfr MYDATA = 0x80; //Port-0 sfr LcdData = 0x90; //Port-1 sbit RS = P2^5; sbit RW = P2^6; sbit EN = P2^7; void lcdcmd(unsigned char value); void lcddata(unsigned char value); void lcdstr(unsigned char msg[]); void Delay(unsigned int itime); void SerTX(unsigned char x); void main() { unsigned char value,d1,d2,d3,x; MYDATA = 0xFF; //Making P1 as Input Port INTR = 1; RD_ADC ...
    guys i have problem on converting my ADC output values to String and display it to 16x2 LCD.. Im using keil compiler.. i have the code and its almost done... #include ltREG51.Hgt #define adc_port P3 #define LCD P2 #define LCD_EN 0x80 #define LCD_RS 0x20 sbit ale=P1^0; //address latch enable sbit oe=P1^3; //output enable sbit sc=P1^1; //start conversion sbit eoc=P1^2; //end of conversion sbit clk=P1^7; // clock sbit ADD_A=P1^4; // Address pins for selecting input channels. sbit ADD_B=P1^5; sbit ADD_C=P1^6; //LCD Commands #define LCD_SETMODE ...
    please let me know ,i can use MAX232 to control the temperature and Humidity use DAQ SYStem Code ??i think set upper value and lower to 8051 thought vb. the DAQ code in here i want to control only 2 sensor is posible ??? my circuit is correctly? /*********************************************************** Data Aquisition amp Logging System Author: Abbas Raza ************************************************************/ #include ltreg51.hgt sbit start=P3^3; sbit end=P3^4; sbit oe=P3^5; sbit ale=P3^6; //sbit clock=P3^2; //sbit relay1=P1^3; //sbit relay2=P1^4; //sbit relay3=P1^5; //sbit relay4=P1^6; unsigned char temp; unsigned char aray[]={'0','1','2','3','4','5','6','7','8','9'}; void delay() { int k,l; for(k=0;klt40;k++) for(l=0;llt80;l++); } void initSerial() { TMOD=0x22; TH1=0xFD; SCON=0x50; TR1=1; EA=1; ES=1; } void usDelay(int a) { TH0=256-(a/1.085); TR0=1; ET0=1; } void timerRoutine() interrupt 1 { clock=~clock; } void sendChar(unsigned char ch) { SBUF=ch; while(!TI); TI=0; } void serialRoutine() interrupt 4 { if(RI==1) { temp=SBUF; switch(temp) { case('a'): relay1=1; break; case('b'): relay1=0; break; case('c'): relay2=1; break; case('d'): relay2=0; break; case('e'): relay3=1; break; case('f'): relay3=0; break; case('g'): relay4=1; break; case('h'): relay4=0; } RI=0; } } void sendReading(unsigned char val) { unsigned char l,m; l=val%10; m=(val/10)%10; sendChar(aray[m]); sendChar(aray[l]); sendChar(','); } void latch() { ale=0; delay(); ale=1; } void startConv() { delay(); start=0; delay(); start=1; } void wait() { while(end==1); } void get() { delay(); oe=0; delay(); oe=1; } void main() { unsigned char sensor=0,reading; P1=0; initSerial(); usDelay(50); while(1) { if(sensor==8) sensor=0; if(sensor==0) sendChar('N'); P1=(P1amp0xf8)+sensor; latch(); startConv(); wait(); get(); reading=P2; sendReading(reading); sensor++; } } Download File IN HERE http://www.8051projects.net/themes/redlinev4/images/download
    Hi, I have a program in which i have to compare a pre defined password with a password entered through three switches. I am using strcmp function in this. This program is working fine on Proteus but on actual hardware its not working at all. Please help.... here is my program: #include ltREG51F.Hgt #include ltstdio.hgt #includeltstring.hgt sbit rs = P0 ^ 1; sbit e = P0 ^ 2; sbit one =P3^0; // the three switches are defined here sbit two =P3^1; sbit three =P3^2; unsigned char pass[] ="Enter Password "; unsigned char correct[] =" Password "; unsigned char correct1[] =" Correct "; unsigned char incorrect[] =" Password "; unsigned char incorrect1[] =" Incorrect "; unsigned ...
    dear friends, i wish to do a project.the description is the message sent should be received by the GSM modem and it should be displayed in the lcd. Iam using P89V51RD2,SIM300,16X2 LCD.the following is the code which iam using.but it is not working. what changes shud i make to work it properly...........? #includeltreg51.hgt #includeltstring.hgt #includeltabsacc.hgt #includeltstdlib.hgt #define buffer 110 sfr port=0xB0; sbit rs = P2^2; sbit rw = P2^1; sbit e = P2^0; sbit D7 = P3^7; sbit LED = P2^3; void delay(unsigned int i); void lcdcmd(unsigned char val); void lcddata(unsigned char val); void lcdinit(); void checkbusy(); void lcdstr(unsigned char *s); void tx0(unsigned char); void SMSString(char*text) ; void init(); void clear(void); void read_text(unsigned char * , unsigned char * , unsigned char *); void read_notification(); void ...
    Can anybody tell me what is the wrong in the following code ? I am getting two digits displayed in the lcd at a time. #include ltreg51.hgt #include ltlcd8bit.hgt // this functons read 4x4 key matrix. 4 rows (R1 to R4) and 4 columns (C1 to c4) // this function return the number of the pressed key or 0 if there is no key has been pressed. //*********************************************************************************************************************************************** sbit R1 = P2^0; sbit R2 = P2^1; sbit R3 = P2^2; sbit R4 = P2^3; sbit C1 = P2^4; sbit C2 = P2^5; sbit C3 = P2^6; sbit C4 = P2^7; unsigned char R,C,ch; unsigned char Key[4][4] = {'C','D','E','F', //Matrix Keypad Character '8','9','A','B', //Initialization '4','5','6','7', '0','1','2','3'}; void ...
    Hi, I want you to help me to find why the following program isn't running. CODE: #includeltreg51.hgt #includeltstring.hgt #includeltstdio.hgt #define buffer 110 sfr port=0xB0; sbit Window = P2^2; sbit Water = P2^1; void delay(unsigned int i); void tx0(unsigned char); void SMSString(char*text) ; void init(); void clear(void); void read_text(unsigned char * , unsigned char * , unsigned char *); void read_notification(); void clear_mybuff(); void Status(); unsigned char abc; unsigned char idata msg1[buffer]; unsigned char rec_no[10]; unsigned char time_date[20]; unsigned char code Response[] = "+CMTI"; unsigned char MyBuff[20], k = 0; unsigned char tmp10[28]; void delay(unsigned int i) { unsigned int k, l; for(k=0;klti;k++) ...
    I am using following program for P89v51rd2. In Keil simulation is working but when i am burning same using Flash Magic ,it is not working. I have checked Memory Data using Flash Magic It is same as in Keil Debugger.Nothing is working after burning ,no port data updation is taking place. Please help Me. //Program for RFID based Secured access system using 8051 microcontroller #include <intrins.h> #include <p89v51rx2.h> sfr lcd_data_pin=0xA0; //P2 port sbit rs=P1^0; sbit rw=P1^1; sbit en=P1^2; void delay(unsigned int count) //Function to provide time delay { int i,j; for(i=0;i<count;i++) ...
    can anybody help me out? this is the code of 4 input adc0808 interfacing with lcd through at89c51 so i want to connect lcd to port0 as well as used as input input port in short i want to use P0 as input or output. i also connected pull up resistor bt the code is nt working. plz plz help me. #includeltreg51.hgt sbit ale=P1^0; //address latch enable sbit oe=P1^3; //output enable sbit sc=P1^1; //start conversion sbit eoc=P1^2; //end of conversion sbit clk=P3^5; // clock sbit ADD_A=P1^4; //Address pins for selecting input channels. sbit ADD_B=P1^5; sbit ADD_C=P1^6; sfr lcd_data_pin=0x80; //Port P0 sbit ...
    Code: // Program to interface Sharps distance sensor. Set vref =3v for ADC0804 #include<reg51.h> #define port P3 #define adc_input P1 #define dataport P0 #define sec 100 sbit rs = port^0; sbit rw = port^1; sbit e = port^2; sbit wr= port^3; sbit rd= port^4; sbit intr= port^5; int test_final=0 ,shift=0; void delay(unsigned int msec ) { int i ,j ; for(i=0;i<msec;i++) for(j=0; j<1275; j++); } void lcd_cmd(unsigned char item) // Function to send command to LCD { dataport = item; rs= 0; rw=0; e=1; delay(1); e=0; return; } void lcd_data(unsigned char item) // Function to send data to LCD { dataport ...
    Hello there I am trying to display a message on the lcd of this custom designed Microcontroller kit (http://www.nskelectronics.in/files/8051_project_board.pdf) using P89V51RD2N. I have tried to burn the following program but it just doesn't work.Can someone help me with this ..where am I going wrong.??....Nothing is shown up on the LCD though its glowing... Thanks Please note the LCD used in this board is JHD162A CODE: //Please note the LCD used in this board is JHD162A #include ltREG51.Hgt sbit EN = P3^4 ; sbit RS = P3^5; //sbit RW = ; //not mentioned on the schematic void delay(); sfr P1_data = 0x90; ...