| ??? 11/25/09 16:25 Read: times |
#171163 - But according to Mazidi... Responding to: ???'s previous message |
Yes, the algorithm is right and I'm programming my controller according to the aforementioned algorithm. But according to "8051 Microcontroller" by Mazidi & Mazidi, there is a delay between changing the values of WR and RD as follows:
WR=0; delay(); WR=1; I thought maybe I've made a mistake by not writing that delay in my code. My code is as follows.I'd really be grateful if you could check it for me.
#include<reg51.h>
#define adc P1
sbit cs=P2^2;
sbit wr=P2^1;
sbit rd=P2^7;
sbit intr=P2^0;
void cnd(unsigned char value); /*function to convert
the HEX o/p to decimal*/
void main()
{unsigned char value;
cs=1;
intr=1;
rd=1;
wr=1;
cs=0;
wr=0;
wr=1;
adc=0x08;
cs=1;
adc=0xFF;
while(intr==1);
cs=0;
wr=1;
rd=0;
rd=1;
cs=1;
value=adc;
cnd(value); //converting and displaying the output.
for(;;); //coverting analog to digital only once.
}
|
| Topic | Author | Date |
| Receiving output from ADC0848. | 01/01/70 00:00 | |
| Don't feed other pins without VCC | 01/01/70 00:00 | |
| CS and RD working. | 01/01/70 00:00 | |
| Wrong understanding of ADC! | 01/01/70 00:00 | |
| But according to Mazidi... | 01/01/70 00:00 | |
| No, you don't! | 01/01/70 00:00 | |
| Sorry! | 01/01/70 00:00 | |
| How do you see that? | 01/01/70 00:00 | |
| The LCD shows a 255. | 01/01/70 00:00 | |
| But this can have zillions of reasons... | 01/01/70 00:00 | |
| Never retype source code when posting | 01/01/70 00:00 | |
| Working! But with errors... | 01/01/70 00:00 | |
| You must convert raw ADC reading into temperature | 01/01/70 00:00 | |
Self-heating? | 01/01/70 00:00 | |
| Configured as push-pull? | 01/01/70 00:00 | |
| It's a P89v51RD2 | 01/01/70 00:00 | |
| Difference only noticeable if contention | 01/01/70 00:00 | |
| then STOP what you are doing | 01/01/70 00:00 |



