I am trying to simulate the ADC of the C5051F120 on keil and i just cant seem to make it work. i dont know what i am missing. I have set my vref1 and vref0 voltage to 3V and and am not toucing the ADCOCF and ADC0CN regs and my AIN1 voltage i set between 1-3V and tried using it in AD0BUSY mode and timer2 overflow mode.I also execute a delay.please help and it would be great if someone could give me the code.
// I have tried all kinds of things in vain and am using the UV2 evaluation version #include<c8051f120.h> #include<intrins.h> /*void wait(unsigned int i) { unsigned int j; for(j==0;j<i;j++) _nop_(); }*/ void main() { char x=0; WDTCN=0xDE; WDTCN=0xAD; ADC0CN=0x9C; ADC0H=0x01; ADC0L=0x01; //EA=1; //EIE2=0x02; //EIP2=0x02; //ET2=1; //TR2=1; while(1) { //AD0EN=1; //AD0BUSY=1; //wait(10005); //AD0BUSY=0; //AD0INT=0; //EA=1; //EIE2=0x02; x=x++; // i just want the microcontoller to be busy } }
How, then, do you plan to program the chip? Erik
"How, then, do you plan to program the chip?" On a simulator, there is no need to program a chip...! ;-)
ok at this point its all in the imagination.i am trying to learn and would like to simulate and eventually let my imagination materialise into reality. and let me restate the fact that at this point i dont have the resources and in the future i should and lets just say its all decided by my imaginative ADC prog ;).