Page 1 of 1

2 Conversion AD

Posted: Tue Jun 01, 2010 10:51 am
by Frank123
Hello

I have a problem with the AD conversion. I work with a 18F4331. I made a little macro that occurs every 200μS. It should generate a square wave of period 2 ms with a duty cycle of 80%.
In addition to 1.8 ms I measure 2 channel with AD converter.
If I put the measure to follow I obtain a term which does not correspond to what I'm waiting.
buh-hs.png
(12.49 KiB) Downloaded 3056 times
chrono-hs.png
(2.05 KiB) Downloaded 3056 times
By cons, if I do my interval measures 200μS it works.
bug-ok.png
(17.05 KiB) Downloaded 3055 times
Can you tell me why or fix this bug.

Frank

Re: 2 Conversion AD

Posted: Fri Jun 04, 2010 1:11 pm
by Frank123
What about this bug ?

Re: 2 Conversion AD

Posted: Mon Jun 07, 2010 9:34 am
by Benj
Hi Frank,

Sorry I may be being a bit thick here, (its monday morning after all) but is the problem that the delays are not coming out ok? or that the analogue readings are incorrect?

I think its this sentance that is throwing me off.
If I put the measure to follow I obtain a term which does not correspond to what I'm waiting.
If you could please state your problem again then hopefully I will be able to help you solve the problem.

Re: 2 Conversion AD

Posted: Tue Jun 08, 2010 6:53 am
by Frank123
Hi Benj,

English language is not always easy and i use, sometimes, automatique translation :oops:

It's the delay that is not ok. I want a 2 ms period (like second example with just on conversion) but i have 35.52 ms (like first example) if i make two successivex conversions.

The result of ADC it's ok.

Frank

Re: 2 Conversion AD

Posted: Tue Jun 08, 2010 8:26 am
by Steve
Hi Frank,

We have many French users, and if you prefer you can post in French (or any other language) instead of English - or perhaps post in French and include a translation into English as well. We can always use the online translators anyway.

Re: 2 Conversion AD

Posted: Tue Jun 08, 2010 11:26 am
by Frank123
Merci,

Ca c'est une bonne nouvelle.

Frank

Re: 2 Conversion AD

Posted: Sat Jun 12, 2010 9:41 am
by Dan81
Salut Frank

As tu résolu ton problème ?
il semblerait que la durée des 2 acquisitions soient supérieures aux 200us de ta base de temps. Surprenant !
Envoie moi ton prog si tu veux.

Daniel

Re: 2 Conversion AD

Posted: Wed Jun 16, 2010 7:09 am
by Steve
The "Lire comme Octet" ("read as byte") ADC macro does take a certain amount of time, so your 200us interrupt is probably not firing properly.

In your "=9" branch, you could put some additional debugging statements (such as i/o transitions) around and between the ADC macro calls to determine how long each is taking.