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

12F675 and pullups

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



Joined: 03 Jan 2004
Posts: 2

View user's profile Send private message

12F675 and pullups
PostPosted: Sat Jan 03, 2004 8:05 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Jan 03, 2004 11:13 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Tue Jan 06, 2004 9:33 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jan 07, 2004 4:10 am     Reply with quote

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."
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