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 support@ccsinfo.com

a/d configuration

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mmanisse
Guest







a/d configuration
PostPosted: Wed Jul 16, 2003 6:10 am     Reply with quote

Hi,
In this days i'm using for the first time the 16f877.
I have done a firmware build correctly on the pic 16f876.
Now i have to import this firmware on 877 family.
The compiler show me an error on a/d converter string:

#device adc=10 "unknown device type"

whi on the 876 it's work?
Where is my mistake?

CCS 2.660
Thank you
Mario
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516057
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: a/d configuration
PostPosted: Wed Jul 16, 2003 10:02 am     Reply with quote

:=Hi,
:=In this days i'm using for the first time the 16f877.
:=I have done a firmware build correctly on the pic 16f876.
:=Now i have to import this firmware on 877 family.
:=The compiler show me an error on a/d converter string:
:=
:=#device adc=10 "unknown device type"
:=
:=whi on the 876 it's work?
:=Where is my mistake?
:=
:=CCS 2.660
:=Thank you
:=Mario

It makes a difference where you place that in your code. The #device adc=10 statement has to be placed after the statement specifing the chip type.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516070
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: a/d configuration
PostPosted: Wed Jul 16, 2003 12:12 pm     Reply with quote

:=#device adc=10 "unknown device type"
:=
:=Where is my mistake?
:=
:=CCS 2.660
-------------------------------------------------------------

Your version of the compiler does not support that statement.
It was not added until (approximately) vs. 2.732.

In this post, I was able to get 10-bit output with vs. 2.668.
<a href="http://www.pic-c.com/forum/general/posts/8403.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/8403.html</a>

This was someone else's program, that I made work.
If I was writing it, I would have used 0x80 (hex notation)
instead of 128. Using hex notation makes it easier to
visualize the bitmask value.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516073
mmanisse
Guest







Re: a/d configuration
PostPosted: Thu Jul 17, 2003 12:07 am     Reply with quote

tnks for your suggest,
I have found the mistake, it's a editor error, i rewrote the line and the compiler working ok.
Phantom character?

Good job to all
Mario
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516089
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: a/d configuration
PostPosted: Thu Jul 17, 2003 2:32 am     Reply with quote

:=tnks for your suggest,
:=I have found the mistake, it's a editor error, i rewrote the line and the compiler working ok.
-------------------------------------------------------
I still think that version of the compiler doesn't support
the #device adc=10 statement. If it's working, it's because
the read_adc() code always returns 10 bits.

The compiler will accept #device statements that are
meaningless, and not give any error. For example, I can
type in:

#device hello=10

It compiles with no problem. But it doesn't do anything.

You can confirm if #device adc=10 is changing the compiler's
output by looking at the .LST file. Compile it with, and
without that statement and compare the results.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516092
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

Re: a/d configuration
PostPosted: Thu Jul 17, 2003 5:53 am     Reply with quote

Hello all

Here's what I found in my readme.txt (2.732):

The #DEVICE directive may be used to set the range of the
A/D converter. For example on a 16F877 part the A/D converter
is 10 bits, so you have the following options:
#DEVICE ADC=8 // Works just like a 16C71 chip
#DEIVCE ADC=10 // Returns a long 0-3FF
#DEICCE ADC=16 // Returns a long 0-FFC0
Put the above directive just after your #INCLUDE <16F877.h>


mfg
Felix
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516096
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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