We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I am trying to input analog data at port3 analog input pins (p3.2,p3.3,p3.4). When the program is run in the IDE it works fine taking all the analog inputs supplied through A/D converter peripheral window. but when the program is downloaded onto the PHYTEC board it doesn't accept the input applied, but takes some default values. What could be the possible reason? Here are some lines from my code
void main(void) { ADM = 1; /*continuous conversion mode to perfrom multiple A/D conversions*/ SYSCON |= 0x10; /*setting RMAP (bit 4) of SYSCON for accessing the SFRs located in mapped SFR area*/ P3ANA &= 0xE3; /*clearing bit location (here P1.0,P1.1,P1.2) makes the port line to operate as analog port */ SYSCON &= 0xEF; for(i=4;i<7;i++) readADC(i); } unsigned int readADC(unsigned char channel) { ADCON1 &= ~0x0F; //Clears Channel for selection ADCON1 |= 0x0F & channel; //Selects received Channel ADDATL |= ~ADDATL; //Write to ADDATL starts execution of ADC while( BSY); //Wait until A to D is complete //IADC = 0; return( ( ( (unsigned) ADDATH << 8) | ADDATL ) >> 6 ); }
What Phytec Board? How do you run the code on target hardware? Are you using the Monitor for debugging?
What Phytec Board? and which '51 derivative is on it/ Erik
I am sorry not to mention the specifics of the board. It is microMODUL-8051 SBC. It uses Infineon - C504L.
I am not using Monitor-51 for debugging. I have used simulator to test it on PC. After downloading the code to SBC, I have run the application in which this SBC is a part of. The application has a temperature sensor which sends out voltages between 0-5V. These voltages are applied to 8051 at pin P3.2 (analog port pin). The resultant digital value is send out through TXD pin and displayed on an LCD. I am testing the application at room temperature but the values displayed are extreme. Any help is highly appreciated. Thanks in advance Ramya
hai iam also new to 8051 programming in keil buut i will work are u correctly shifting the SFR Page register before using ADC Register .Tell me what is ur target board
are u .. what is ur target board If you want to know what micro (u) is doing, e-mail him. what is a microresistor (ur) board?
Erik
Hi, I am sorry I couldn't check your reply as I didn't receive any email which I usually get when there is a reply to my post. I never came across SFR page registers. I have programmed the ADC using the instructions from "8051 Siemens" book. I guess the code works fine as it runs well when tested with simulator. I think that I am missing something on hardware side to make the port pins to act as analog port pins. The microcontroller am using is Infineon-c504L. Target board is a microMODUL-8051 SBC from Phytec. Thank you Ramya
I never came across SFR page registers I suspect the one that want to discuss with 'micro' assume you are using a SILabs chip or stupidly assumes that all chips are like some SILabs derivatives.
I doubt there is one in your chip.