??? 08/13/07 01:34 Read: times |
#143137 - ADC lowbyte Responding to: ???'s previous message |
Bernd Nollmeyer said:
value = ADC0H;
Is it just a code snipet or is this your real adc code ? At least you should read the adc a couple of times and build an average value. However, post your complete code. That's the code that I program... Building an average value meaning? I had already posted my code in my first code... Nvm i will post again my complete code: //------------------------------------------------------------------------------------ // CONFIG ROUTINE //------------------------------------------------------------------------------------ void config(void) { // Configure the PRTnMX Registers PRT0MX = 0x00; // PRT0MX: Initial Reset Value PRT1MX = 0x00; // PRT1MX: Initial Reset Value PRT2MX = 0x00; // PRT2MX: Initial Reset Value // Port configuration (1 = Push Pull Output) PRT0CF = 0xFF; // Output configuration for P0 PRT1CF = 0xFF; // Output configuration for P1 PRT2CF = 0xFF;// Output configuration for P2 PRT3CF = 0xFF; // Output configuration for P3 P0MODE = 0x00; // Input configuration for P0 P1MODE = 0x00; // Input configuration for P1 P2MODE = 0xFF; //Input configuration for P2 P3MODE = 0xFF; // Input configuration for P3 CPT0CN = 0x00; // Comparator 0 Control Register CPT1CN = 0x00; // Comparator 1 Control Register OSCXCN = 0x30; // EXTERNAL Oscillator Control Register OSCICN = 0x14; // Internal Oscillator Control Register REF0CN = 0x03; // Reference Control Register /*---------------- ADC Configuration -----------------*/ AMX0SL = 0xE0; // AMUX Channel Select Register ADC0CF = 0x78; // ADC Configuration Register ADC0CN = 0x40; // ADC Control Register ADC0LTH = 0xFF; // ADC Less-Than High Byte Register ADC0GTH = 0xFF; // ADC Greater-Than High Byte Register void adcdata(void) { signed char value; value=0x00; ADCINT = 0; ADBUSY = 1; while(ADCINT == 0); value = ADC0H; ADCEN=0; } void main() { config(); ADCEN = 1; //enable ADC delay(500000); adcdata(); delay(500000); } |
Topic | Author | Date |
ADC Problem | 01/01/70 00:00 | |
Circuit ? | 01/01/70 00:00 | |
Clarify? | 01/01/70 00:00 | |
Crosspost | 01/01/70 00:00 | |
Clarification | 01/01/70 00:00 | |
Still no circuit | 01/01/70 00:00 | |
Power supply | 01/01/70 00:00 | |
What about the adc lowbyte ? | 01/01/70 00:00 | |
Power Supply | 01/01/70 00:00 | |
Power supply | 01/01/70 00:00 | |
Power Supply | 01/01/70 00:00 | |
ADC lowbyte | 01/01/70 00:00 | |
sorry for confusing you but | 01/01/70 00:00 | |
Thanks for the time | 01/01/70 00:00 | |
mmmhhh one more time | 01/01/70 00:00 | |
LCD code | 01/01/70 00:00 | |
No majic | 01/01/70 00:00 | |
delay | 01/01/70 00:00 | |
Writing Timing Loops in C | 01/01/70 00:00 | |
Lucky | 01/01/70 00:00 | |
Very true! | 01/01/70 00:00 | |
Your adc value must be 123. { | 01/01/70 00:00 | |
Power Supply Problem | 01/01/70 00:00 | |
We can not see what you are looking at | 01/01/70 00:00 | |
current limiting power supply? | 01/01/70 00:00 | |
Power Supply | 01/01/70 00:00 | |
Power Supply | 01/01/70 00:00 | |
ADC0804 with 8051 | 01/01/70 00:00 | |
Start a new thread! | 01/01/70 00:00 | |
Sorry Dude!!!![]() | 01/01/70 00:00 |