View previous topic :: View next topic |
Author |
Message |
mmanisse Guest
|
a/d configuration |
Posted: Wed Jul 16, 2003 6:10 am |
|
|
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
|
Re: a/d configuration |
Posted: Wed Jul 16, 2003 10:02 am |
|
|
:=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
|
Re: a/d configuration |
Posted: Wed Jul 16, 2003 12:12 pm |
|
|
:=#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 |
Posted: Thu Jul 17, 2003 12:07 am |
|
|
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
|
Re: a/d configuration |
Posted: Thu Jul 17, 2003 2:32 am |
|
|
:=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
|
Re: a/d configuration |
Posted: Thu Jul 17, 2003 5:53 am |
|
|
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 |
|
|
|