CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

10 bit a/d
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
coder
Guest







help for the Dr
PostPosted: Tue Apr 13, 2004 5:01 pm     Reply with quote

Mr Zackaris what are you doing? equations ok?
languer



Joined: 09 Jan 2004
Posts: 144
Location: USA

View user's profile Send private message

Calm down everybody, no need to raise your voices
PostPosted: Tue Apr 13, 2004 7:20 pm     Reply with quote

Idea Just for the sake of completeness, let me add this.

When PCM programmer noted the discrepancy between
Quote:
#device adc=10

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
    *=number
    ADC=x
    ICD=TRUE

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:
Code:
#device ADC=10
does not equal
Code:
#device ADC = 10

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 Exclamation ) 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. Smile
drzxoulis



Joined: 12 Apr 2004
Posts: 14

View user's profile Send private message

Hi again and big thank you to anyone that helped!!!!
PostPosted: Tue Apr 13, 2004 9:34 pm     Reply with quote

Exclamation 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. Shocked
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!! Very Happy


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

View user's profile Send private message

PostPosted: Wed Apr 14, 2004 2:23 am     Reply with quote

He can post his problem here in this forum. We may be able to help him out.
drzxoulis



Joined: 12 Apr 2004
Posts: 14

View user's profile Send private message

PostPosted: Wed Apr 14, 2004 6:51 am     Reply with quote

The problem my friend has is posted with title:

how to pass 2 dimentional CONST array to a function?

from coder.

Thanks!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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