View previous topic :: View next topic |
Author |
Message |
C0J
Joined: 05 Nov 2008 Posts: 25
|
weak pullups for port B of 16F690 unable to work |
Posted: Wed Nov 05, 2008 9:04 am |
|
|
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
|
Re: weak pullups for port B of 16F690 unable to work |
Posted: Wed Nov 05, 2008 9:33 am |
|
|
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
|
|
Posted: Wed Nov 05, 2008 10:23 am |
|
|
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
|
|
Posted: Wed Nov 05, 2008 11:22 am |
|
|
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
|
|
Posted: Wed Nov 05, 2008 11:30 am |
|
|
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
|
|
Posted: Wed Nov 05, 2008 1:22 pm |
|
|
Why not try the current CCS manual (June 2008) page 201? |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Nov 06, 2008 3:10 am |
|
|
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. |
|
|
|