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