View previous topic :: View next topic |
Author |
Message |
duchonic
Joined: 14 Jul 2010 Posts: 9 Location: Switzerland
|
Pullups with 16F182x |
Posted: Thu Jul 15, 2010 8:14 am |
|
|
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
|
|
Posted: Thu Jul 15, 2010 12:23 pm |
|
|
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
|
|
Posted: Tue Mar 08, 2011 1:49 pm |
|
|
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
|
|
Posted: Fri May 31, 2013 9:40 am |
|
|
Fram_fr thanks your code is working great!
I am using 5.003 and there is still no port_c_pullups() |
|
|
|