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

16F819 Header File Defines for ADC

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



Joined: 26 Nov 2004
Posts: 10

View user's profile Send private message Send e-mail MSN Messenger

16F819 Header File Defines for ADC
PostPosted: Fri May 20, 2005 1:02 pm     Reply with quote

Hello,

I am currently using a 16F88, however, our MPLAB ICD2 was damaged. our old programmers do not support 16F88 so I am trying to switch to 16F819 as they are almost exactly PIN compatable, has a PWM, etc..

My problem occurs when I was looking at the header file to determine the constants to use in setup_adc_ports. They look exactly like those for the 16F877 e.g.:
Code:

#define NO_ANALOGS             0x86         // None
#define ALL_ANALOG             0x80         // A0 A1 A2 A3 A5 E0 E1 E2 Ref=Vdd
#define ANALOG_RA3_REF         0x81         // A0 A1 A2 A5 E0 E1 E2 Ref=A3
#define A_ANALOG               0x82         // A0 A1 A2 A3 A5 Ref=Vdd
#define A_ANALOG_RA3_REF       0x83         // A0 A1 A2 A5 Ref=A3
#define RA0_RA1_RA3_ANALOG     0x84         // A0 A1 A3 Ref=Vdd
#define RA0_RA1_ANALOG_RA3_REF 0x85         // A0 A1 Ref=A3
#define ANALOG_RA3_RA2_REF              0x88   // A0 A1 A5 E0 E1 E2 Ref=A2,A3
#define ANALOG_NOT_RE1_RE2              0x89   // A0 A1 A2 A3 A5 E0 Ref=Vdd
#define ANALOG_NOT_RE1_RE2_REF_RA3      0x8A   // A0 A1 A2 A5 E0 Ref=A3
#define ANALOG_NOT_RE1_RE2_REF_RA3_RA2  0x8B   // A0 A1 A5 E0 Ref=A2,A3
#define A_ANALOG_RA3_RA2_REF            0x8C   // A0 A1 A5 Ref=A2,A3
#define RA0_RA1_ANALOG_RA3_RA2_REF      0x8D   // A0 A1 Ref=A2,A3
#define RA0_ANALOG                      0x8E   // A0
#define RA0_ANALOG_RA3_RA2_REF          0x8F   // A0 Ref=A2,A3


Not that the 16F819 only has 4 analog pins. My question is, will these constants still work with the F819? especially considering the F819 doesn't even have a PORT E.

I am using version 3.180 of the CCS Compiler.

Does anyone have any ideas or possibly an updated header file for the 16F819? My other alternative is to set everything manually, but I thought I'd try this as it might be faster to get a solid answer.
_________________
darryl
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 20, 2005 1:17 pm     Reply with quote

You want to use an older version of the compiler for a newer PIC
that it doesn't support.

You need to compare the data sheets. Load both data sheets into
Acrobat and look at the A/D register summary at the end of the A/D
section, and do Tile Horizontal.

What you see, is that the method for setting Analog or Digital pins
is different. The 16F88 uses a bitmask and the 16F819 uses a code.
Basically, you will have to write some (or maybe all) of your own A/D functions.

Also, other built-in CCS functions might not work, and the start-up
initialization code inserted by the compiler will probably not be correct.
djwallace



Joined: 26 Nov 2004
Posts: 10

View user's profile Send private message Send e-mail MSN Messenger

hmm..
PostPosted: Fri May 20, 2005 1:59 pm     Reply with quote

ok.. that's what I was afraid of..

it's not so much that I'm lazy.. it's just that it has to be done sooner than later.

A friend has used the F819 a little more than myself so I'll get his help..

Thanks.
_________________
darryl
djwallace



Joined: 26 Nov 2004
Posts: 10

View user's profile Send private message Send e-mail MSN Messenger

hmm unclear.
PostPosted: Fri May 20, 2005 2:03 pm     Reply with quote

One more thing,

I'm unclear on your comment about
Quote:

You want to use an older version of the compiler for a newer PIC
that it doesn't support.


My compiler version supports all of the PIC's I mentioned (well except for the ADC features of the 16F819, apparently). I'm not sure what you mean by how I would want to use an older version of the compiler for a newer PIC?
_________________
darryl
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri May 20, 2005 2:40 pm     Reply with quote

I think I understand your question now. You're wondering if
the A/D constants in the 16F819.H file are correct or if they're
usable in any way, in PCM vs. 3.180.

Obviously all the REx stuff is wrong. There is no Port E on the 16F819.
It looks like CCS just took the definitions for a previous PIC and
stuffed them into the 16F819.H file without really checking them.
This is common when they add support (so to speak) for a new PIC.

It's also common for the A/D functions to be buggy when CCS adds
a new chip.

So the answer is that you should write a test program that uses
all the A/D functions and then carefully check the .LST file against
the data sheet. If they're not correct, you'll have to write your own
functions.
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