| ??? 12/06/01 10:53 Read: times |
#17315 - RE: Help needed for this program - Erik |
ORG 0000H
JMP START ORG 2000H START: MOV R1, #04 ;you can choose whatever ORG you would like for Start label MOV DPTR,#2500H MOV R2,#00H START1: CALL Measure DJNZ R1, START1 ;get 4 succesive samples CALL Delay10min ;either wait or do something else CALL Display ;either display or process your input samples from 2500H-2504H RAM AJMP START Measure: MOV ADCON,R2 ;select input channel CLR ADM ;the converter stops after one conversion MOV DAPR,#00 ;start of conversion JB BSY,$ ;wait until end of conversion (13 machine cycle BSY bit is cleared hardware at EOC) MOV A,ADDAT MOVX @DPTR,A ;save the result of conversion in memory INC DPTR INC R2 ;prepare the next input channel RET Due to the fact that the conversion time takes 13 machine cycle you can avoid using interrupts at EOC. At least now until you get used with conversion. You can't do too much during 13 machine cycle. Otherwise you have to keep interrupt pending until you finished actual routine. What is your real problem ? Can you share with us the hardware part of what you have in mind ? Usualy the ADC problems comes from other ways. Much more hardware than software. Well, if you look at measure routine you will notice even my mistake. The ADCON is loaded direct. It will be wise to modify it by mask, since it contains Baud Rate Enable, System Clock Enable, Conversion Mode bits which maybe we don't want to modify them when changing the input channel. But for test purpose now works as it is. Regards, Silviu |
| Topic | Author | Date |
| Help needed for this program | 01/01/70 00:00 | |
| RE: Help needed for this program | 01/01/70 00:00 | |
| RE: Help needed for this program | 01/01/70 00:00 | |
| RE: Help needed for this program - Erik | 01/01/70 00:00 | |
| RE: Help needed for this program - Erik | 01/01/70 00:00 | |
RE:Help needed for this program - Silviu | 01/01/70 00:00 |



