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 CCS Technical Support

weak pullups for port B of 16F690 unable to work

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



Joined: 05 Nov 2008
Posts: 25

View user's profile Send private message

weak pullups for port B of 16F690 unable to work
PostPosted: Wed Nov 05, 2008 9:04 am     Reply with quote

Hi,

Have try to engage weak pullups for port B of 16F690
but unable to get it work.

The following is the code:
Code:

#include <16F690.h>

#FUSES NOWDT,INTRC_IO,NOPROTECT,NOBROWNOUT,NOMCLR,NOCPD,NOPUT,NOIESO,NOFCMEN

void main()
{

port_b_pullups(TRUE);
setup_adc_ports(NO_ANALOGS);

while(1)
{
if(input(PIN_B4)==1)
output_low(PIN_C1);
else
output_high(PIN_C1);
}

}

Port B is not connected to anything & the statement
" output_high(PIN_C1); " is executed instead of
" output_low(PIN_C1);" which shows that port B is still low.

Any advice ?

Thanks,
CJ
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: weak pullups for port B of 16F690 unable to work
PostPosted: Wed Nov 05, 2008 9:33 am     Reply with quote

Have you tried to put a voltmeter on RB4 to read what voltage is there? Divide and conquer!
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 10:23 am     Reply with quote

From the help

Syntax:
port_a_pullups (value)

port_b_pullups (value)

port_d_pullups (value)

port_e_pullups (value)

port_j_pullups (value)

port_x_pullups (upmask)

port_x_pullups (upmask, downmask)



Parameters:
value is TRUE or FALSE on most parts, some parts that allow pullups to be specified on individual pins permit an 8 bit int here, one bit for each port pin.

upmask for ports that permit pullups to be specified on a pin basis. This mask indicates what pins should have pullups activated. A 1 indicates the pullups is on.

downmask for ports that permit pulldowns to be specified on a pin basis. This mask indicates what pins should have pulldowns activated. A 1 indicates the pulldowns is on.


Your device allows for individual pins to be pulled up.
try using
port_b_pullups(0b11110000); // A 1 turns it on
Guest








PostPosted: Wed Nov 05, 2008 11:22 am     Reply with quote

Hi RLScott & Wayne_

Thanks for your advises

Hi Wayne_,

have try your method of "port_b_pullups(0b11110000);", it works


Hi RLScott,

have also measured the voltage of RB4 & the following is the result:
using "port_b_pullups(0b11110000);" RB4=4.62v

the odd part is, when i use back "port_b_pullups(TRUE);" RB4 initally is ~2v then slowly decreases

Thanks again,
CJ
C0J



Joined: 05 Nov 2008
Posts: 25

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 11:30 am     Reply with quote

i have previously forgotten to login,

Hi, Wayne_,

you mentioned about "From the help", mind telling me where is the help so that i can access it next time if i encounter other problems

Thanks,
CJ
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Nov 05, 2008 1:22 pm     Reply with quote

Why not try the current CCS manual (June 2008) page 201?
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Thu Nov 06, 2008 3:10 am     Reply with quote

I use the CCS PCW Compiler, I press F1 to bring up context sensitive help or if nothing is highlighted it just opens up help. You can also access it from the ? in the top right corner.
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