This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ADC simulation module problems with screenshot

I am having an unusual issue with the simulation of the ADC's using a P89LPC935 IC. My program is fully functional, but when I use the simulator for some work, when I plug in a voltage value it should be converting and dumping the conversion data into the AD0DAT2 and AD1DAT2 registers, it should only be a few milliseconds for conversion with some result present.

With 1V it should be a 4D and with 2 volts a 9B, but looking at the screenshot even after 9 seconds there is still no conversion taking place. Under random situations it will sometimes put the correct values in the register and other times it won't (coming in and out of a debug session). It happens to both ADC simulators for ADC0 and 1.

I've tried verifying if something was wrong with my pin assignments (using P0.0 and P0.3) to see if I messed up their I/O status (tried them as bidirectional and inputs) but neither configuration seems to make the difference.

I'm also seeing that one of the ADC's (ADC0) in hardware is not working either but ADC1 is working, so I'm thinking that I'm missing something major here.

Here is the ADC setup:


ADCON0=0x07;    // enable ADC channel 0 with immediate start
ADCON1=0x07;    // enable ADC channel 1 with immediate start
ADMODA=0x44;    // ADC0 & ADC1 auto scan continous conversion
ADMODB=0xE0;    // Set ADC clock divisor 7.3728MHz/8
ADINS=0x44;     // (AD12--P0.3) (AD02--P2.1)

Here is the port masks:


    P0M1=0x09;      // (0.7-0.0)  B  B  B  B  I  B  B  I
    P0M2=0x00;
    P1M1=0x80;      // (1.7-1.0)  OD B  B  B  O  B  B  B
    P1M2=0x88;
    P2M1=0x00;      // (2.7-2.0)  B  B  B  B  B  B  B  B
    P2M2=0x00;
    P3M1=0x00;      // (3.1-3.0)  B  B  B  B  B  B  B  B
    P3M2=0x00;

If it didn't work at all then I'd be concerned, but since the hardware (ADC1) does work while (ADC0) in hardware does not, the simulation is telling me something isn't quite right.

I've read the user manual from philips and followed a few examples on the net......thought I had it licked but I can't seem to find it.

Any ideas what could be going on here?

www.kittmaster.com/.../PS1018.png

I'm posting here and on another forum since I need help as soon as possible. Thank you

Chris

Parents Reply Children
  • But its the same message, I guess most bounce between 8052 and Keil and some do not?

    But thanks for posting link.

    Chris

  • So you think it is ok if one person writes an answer in one forum, and another person - who doesn't know about the first answer - spends time to write the same answer?

    It that efficient or polite?

  • OR, you expect people to check all possible "other forums" to see if the answer has already been given?

  • well I really don't know how to answer that, since:

    Keil<----------------------->8052.com !=

    Since I'm aware that some post here and some there, I just am covering both bases before someone before it was brought up.

    It seems more time is spent on posting form than the original question at hand. Any particular reason for that? Six posts and not one directed at an area to look at.

    Its not that I'm ungrateful that people take the time to read these posts, but what exactly do you expect......a question is asked, why can't a simple "I don't know" instead of all this rambling about why the other link wasn't posted.

    Either way, I found it was a software port config issue, problem has been solved. thanks anyway.

  • You cover both bases, by adding the link from thread A to thread B, and from thread B to thread A.

    Then a Keil reader can follow a link and read any answers sent to the other site, and people who spend their time only there can follow the Keil link and notice what people have been asking or suggesting here.