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

Pullups with 16F182x

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



Joined: 14 Jul 2010
Posts: 9
Location: Switzerland

View user's profile Send private message

Pullups with 16F182x
PostPosted: Thu Jul 15, 2010 8:14 am     Reply with quote

The ccs compiler (i use 4.109) has some problems, setting pullups with port_x_pullups() on the 16F182x devices:

#ifdef DEVICE_16F1823
PORT_A_PULLUPS(HEAD_E_PIN_IN_TASTER); /* PIN_A2 --> works fine! */
PORT_C_PULLUPS(HEAD_E_PIN_IN_LADE_STAT); /* PIN_C5 --> *** Error 12 "head.c" Line 169(18,19): Undefined identifier -- PORT_C_PULLUPS */
#endif

#ifdef DEVICE_16F1827
PORT_B_PULLUPS(HEAD_E_PIN_IN_TASTER); /* PIN_B5 --> works fine! */
PORT_A_PULLUPS(HEAD_E_PIN_IN_LADE_STAT); /* PIN_A3 --> *** Error 12 "head.c" Line 172(18,19): Undefined identifier -- PORT_A_PULLUPS */
#endif

Does anybody knows a solution to this problem?
Anybody tried the workaround with #byte WPUA 0x20D; set_bit(WPUA,bit5)?[/b]
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jul 15, 2010 12:23 pm     Reply with quote

Create your own function as a work-around. Example:
Code:

#include <16F1823.h>
#fuses INTRC_IO, NOWDT, PUT
#use delay(clock=4000000)

void port_c_pullups(int8 value)
{
#byte WPUC = 0x20E
WPUC = value;
}

//===========================================
void main()
{

port_c_pullups(0x3F);

while(1);
}

Also, report these bugs to CCS support. Give them the error message
for each PIC, and tell them your compiler version. If you don't want to
do it, let me know and I'll email them.
Fram_fr



Joined: 29 Oct 2008
Posts: 13

View user's profile Send private message

PostPosted: Tue Mar 08, 2011 1:49 pm     Reply with quote

Hi all,

PCM Programmer, your code don't work for me.
Quote:
From 16F/1823 datasheet: Global WPUEN bit of the OPTION register must be cleared for individual pull-ups to be enabled.

need to change it like this:
Code:

include <16F1823.h>
#fuses INTRC_IO, NOWDT, PUT
#use delay(clock=4000000)

void port_c_pullups(int8 value)
{
#byte OPTION_REG = 0x095
#bit WPUEN = OPTION_REG.7
#byte WPUC = 0x20E

WPUEN = 0;
WPUC = value;
}

//===========================================
void main()
{

port_c_pullups(0x3F);

while(1);
}
Plater



Joined: 21 Feb 2013
Posts: 8

View user's profile Send private message

PostPosted: Fri May 31, 2013 9:40 am     Reply with quote

Fram_fr thanks your code is working great!
I am using 5.003 and there is still no port_c_pullups()
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