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

PIC16F1827 Wrong header file?

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



Joined: 12 Jul 2011
Posts: 18
Location: El Salvador

View user's profile Send private message

PIC16F1827 Wrong header file?
PostPosted: Tue Jul 12, 2011 11:59 pm     Reply with quote

This is my first post so first of all I'd like to say Hello to everybody.

Said this, I've found a problem while using PIC16F1827.

I want to use 6 of its AN channels (from AN2 to AN7, both included) for my application.

In the Microchip's Datasheet for the product we can see the following graph:

http://imageshack.us/photo/my-images/6/pic16f1827pinconfig.jpg

In which we can see that AN channels are, in order from AN0 to AN11, mapped on ports: A0, A1, A2, A3, A4, B6, B7, B5, B4, B3, B2, B1.

However, in the compiler header file PIC16F1827.h we can see the following code:

Code:
// Constants used in SETUP_ADC_PORTS() are:
#define ALL_ANALOG  0xffff0007     // A0 A1 A2 A3 A5 E0 E1 E2 B0 B1 B2 B3 B4 B5 
#define sAN13         0x20000000    // B5
#define sAN12         0x01000000    // B0
#define sAN11         0x10000000    // B4
#define sAN10         0x02000000    // B1
#define sAN9          0x08000000    // B3
#define sAN8          0x04000000    // B2
#define sAN7             0x40000    // E2 
#define sAN6             0x20000    // E1 
#define sAN5             0x10000    // E0 
#define sAN4                0x20    // A5
#define sAN3                 0x8    // A3
#define sAN2                 0x4    // A2
#define sAN1                 0x2    // A1
#define sAN0                 0x1    // A0
#define NO_ANALOGS       0x00000    // None


In which we observe 13 AN channels (instead of 11), some of them mapped in non existent ports and what is worst, PORT A4 is not configured as an available AN channel (it should be AN channel #4).

I'd rather use exactly AN2 to AN7 because I need to read them sequentially and it's easier for me to do that if they're next to each other, but also because I need the other ports to configure 2 SPIs to control an external SRAM serial memory and a RF module.

Does anyone know if I'm correct with my supposition of the wrong header? If I'm, does anyone know how could/should I proceed to modify PIC16F1827.h?

Thank you all in advance for your time and help and sorry for any mistake concerning my english.

Pablo
Ttelmah



Joined: 11 Mar 2010
Posts: 7115

View user's profile Send private message

PostPosted: Wed Jul 13, 2011 2:28 am     Reply with quote

Always post the compiler version for a compiler problem.
The table is like you show, up to about 4.112, but is correct in 4.114. The actual numbers used also change, so your best bet is to moan at CCS, they may give you an upgrade to a version with this fixed (should....).
I doubt if just changing the table would work, since the numeric format is also changed, suggesting the coding for the setup is probably wrong as well.

Best Wishes
krugger



Joined: 12 Jul 2011
Posts: 18
Location: El Salvador

View user's profile Send private message

PostPosted: Wed Jul 13, 2011 8:44 am     Reply with quote

Thank you very much Ttelmah!
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