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.
By cons, if I do my interval measures 200μS it works.
Can you tell me why or fix this bug.
Frank
2 Conversion AD
Moderator: Benj
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: 2 Conversion AD
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.
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 you could please state your problem again then hopefully I will be able to help you solve the problem.If I put the measure to follow I obtain a term which does not correspond to what I'm waiting.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 36
- Joined: Fri Jan 15, 2010 5:17 pm
- Location: Saint-Nazaire - France
- Has thanked: 1 time
Re: 2 Conversion AD
Hi Benj,
English language is not always easy and i use, sometimes, automatique translation
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
English language is not always easy and i use, sometimes, automatique translation

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
Frank
Electronics teacher
Electronics teacher
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: 2 Conversion AD
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.
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.
- Dan81
- Valued Contributor
- Posts: 268
- Joined: Sun Jan 15, 2006 4:07 pm
- Location: Albi France
- Been thanked: 60 times
- Contact:
Re: 2 Conversion AD
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
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
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: 2 Conversion AD
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.
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.