View previous topic :: View next topic |
Author |
Message |
geoff99
Joined: 03 Jan 2004 Posts: 2
|
12F675 and pullups |
Posted: Sat Jan 03, 2004 8:05 pm |
|
|
I used the PIC wizard to create a new project for a 12F675 (asking for the weak pullups to be enabled) and got the following source code:
#include "junk.h"
void main()
{
port_b_pullups(TRUE);
setup_adc_ports(0);
setup_adc(ADC_OFF);
setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
}
where junk.h contains
#include <12F675.h>
#device adc=8
#use delay(clock=4000000)
#fuses INTRC, BROWNOUT
If I try and compile (using v3.168), I get an error "undefined identifier port_b_pullups". If I comment out the port_b_pullups line, it compiles fine.
Anyone know why the compiler is choking on this statement? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Jan 03, 2004 11:13 pm |
|
|
Quote: | If I try and compile (using v3.168), I get an error "undefined identifier
port_b_pullups". If I comment out the port_b_pullups line, it compiles
fine. |
The device has no Port B. Use port_a_pullups() with this device.
http://www.ccsinfo.com/ccscmanual.zip |
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Tue Jan 06, 2004 9:33 pm |
|
|
Also bear in mind that using port_a_pullups(TRUE) will result in only GP0 having its WPU enabled. The argument passed to port_a_pullups() should be the WPU register value you want.
Dale |
|
|
geoff99
Joined: 03 Jan 2004 Posts: 2
|
|
Posted: Wed Jan 07, 2004 4:10 am |
|
|
Well I guess my mistake was to only consult the online help (not the manual) which has no mention of port_a_pullups. Still curious why the wizard chose port_b by default.
Thanks for the tip about the TRUE argument. I didn't quite pick up on this, but sure enough the help for port_b_pullups mentions:
"Parameters:
value is TRUE or FALSE on most parts, some parts that allow pullups to be specified on individual pins permit a 8 bit int here, one bit for each port pin." |
|
|
|