Dear All, following is the code is not working..can any please guide me where is the problem.. #include<reg51.h> 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; sfr input_port=0x80; sfr output_port=0xA0;
void timer0() interrupt 1 // Function to generate clock of frequency 500KHZ using Timer 0 interrupt. { clk=~clk; }
void delay(unsigned int count) // Function to provide time delay in msec. { int i,j; for(i=0;i<count;i++) for(j=0;j<1275;j++); }
void main() { eoc=1; input_port=0xFF; ale=0; oe=0; sc=0; TMOD=0x22; //timer0 setting for generating clock of 500KHz using interrupt enable mode. TH0=0xFD; IE=0x82; TR0=1; while(1) { ADD_C=0; // Selecting input channel 2 using address lines ADD_B=0; ADD_A=1; delay(2); ale=1; delay(2); sc=1; delay(1); ale=0; delay(1); sc=0; while(eoc==1); while(eoc==0); oe=1; output_port=input_port; delay(2); oe=0; } }
Did you even READ the comments above? Do you really understand what your code does? Do you understand that this is a MUST in order for _your_ code to work? Now, take a deep breath and explain, SLOWLY and clearly, exactly what the problem is and what you have done so far.
Yes, i read but i have data sheet for adc, and the first link i did not understand what was that? As per code: there is no problem in that code? is there any way to generate 500KHz pulses from MCU AT89s8253? or pls suggest me any code to achieve this stuff...pls. pls. pls
Are you saying that you haven't even checked if you do get a 500kHz signal generated from your ISR? You are not doing any debugging at all - just moving the responsibility for thinking to "the net"?
Why haven't you bothered to return with real responses to my initial post?
By the way - some 8051 timers can be used to directly toggle an external pin, allowing programmable square wave output without any ISR that performs the toggling.
what r that toggle routine of timers can u guide me ?
No, I can not guide you.
I did say _some_ 8051 timers can toggle pins.
I don't know if you have any timers that do support this. But you should be able to figure this out since you can read datasheets and knows what chip you have.
"what r that toggle routine of timers can u guide me ?"
Study the Datasheet for your 8051 chip!
what r that toggle routine of timers can u guide me ? maybe micro (u) can guide you as to what resist (r) that toggle routine
my requirment is simple
LOL, how did YOU determine that?
"maybe micro (u) can guide you as to what resist (r) that toggle routine" pls explain..i didnot get u.
'u' is the symbol for "micro"
Why do you keep putting "micro" in your sentences?
Is it really too hard for you to write "you" ?