|
|
View previous topic :: View next topic |
Author |
Message |
coder Guest
|
help for the Dr |
Posted: Tue Apr 13, 2004 5:01 pm |
|
|
Mr Zackaris what are you doing? equations ok? |
|
|
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
|
Calm down everybody, no need to raise your voices |
Posted: Tue Apr 13, 2004 7:20 pm |
|
|
Just for the sake of completeness, let me add this.
When PCM programmer noted the discrepancy between
and
Quote: | #define PIC16F876 ADC = 10 |
I thought he referred to the PIC16F876 in the line. I say this because I have never been able to use this after already defining the device in the device header file. So when I tried and compile your code, and it compiled I was a bit surprised (to say the least).
In any case, after the second clarification by PCM programmer it became very clear why it did compile. The manual is kind of weak in this respect, so here it goes:
Quote: | Every program must have exactly one #device with a chip |
Now there are a few exceptions
Caveat #1:
This second #device statement must be placed exactly after the #include<device> statement or:
Quote: | *** Error #23: Can not change device type this far into the code |
Caveat #2:
There must be no space before or after the equal sign. This means:
does not equal
or
Quote: | *** Error #23: Can not change device type this far into the code |
I learned this the hard way (as you are probably doing as well). I hope this helps you some (btw, the people on this forum, PCM programmer and few others in particular, are extremely helpful as you will find out). If you have the time, I would try it with the #device ADC=10 and ADRESULT=read_adc(); and see if it works (it should).
Do not become discouraged, there is nothing (absolutely nothing ) wrong with your implementation (with the exception of the #define PIC... -> serves no real purpose - honest mistake though). You implemented the same functions that these two commands provide for you. It is just easier when the compiler does it for you, thats all.
Again, hope it helps. |
|
|
drzxoulis
Joined: 12 Apr 2004 Posts: 14
|
Hi again and big thank you to anyone that helped!!!! |
Posted: Tue Apr 13, 2004 9:34 pm |
|
|
Just to make some things clear.
First of all sorry to PCM programmer if I was mean I have seen his huge help in the forum.
Secondly I ran the progs both approches and they both work perfectly!!
The only difference is that the one i proposed for some reason gives around 5mV(1 step) resolution better which in myapplication is very important as it can actually introduce an error up to 0.5% with max of 1%
so i have to be kind of carefull.
I read through your recommendations and now at list have a couple more ideas in my mind!!!!If you ran the code you will find out that it works perfectly for as many channels as possible (just repeat it) but you probably know better!!
Again thank you all!!
P.S. If anyone knows please give a hand to my friend coder who is doing a massive project,,,,,running out of time and looks a little stuck!!!!! |
|
|
Haplo
Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia
|
|
Posted: Wed Apr 14, 2004 2:23 am |
|
|
He can post his problem here in this forum. We may be able to help him out. |
|
|
drzxoulis
Joined: 12 Apr 2004 Posts: 14
|
|
Posted: Wed Apr 14, 2004 6:51 am |
|
|
The problem my friend has is posted with title:
how to pass 2 dimentional CONST array to a function?
from coder.
Thanks!! |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|