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

pin B3 on 18f45k22

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



Joined: 14 Nov 2017
Posts: 7

View user's profile Send private message

pin B3 on 18f45k22
PostPosted: Thu Jan 04, 2018 2:20 pm     Reply with quote

Hi,

I try to use B3 as an input.
Everything works fine as an output, but now I connected a 10k pull-up resistor and a hall switch to the port, but the port is always low.
If i use only a pull-up and the hallswitch i can measure the signal going down when a magnet is present.
Why can't i use it as an input?

The header:
Code:

#include <18F45K22.h>
#device ADC=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)

#use delay(internal=16MHz)
#use FIXED_IO( A_outputs=PIN_A7,PIN_A6,PIN_A5,PIN_A4,PIN_A0 )
#use FIXED_IO( B_outputs=PIN_B2,PIN_B1,PIN_B0 )
#use FIXED_IO( C_outputs=PIN_C7,PIN_C6,PIN_C5,PIN_C4,PIN_C3,PIN_C2,PIN_C1,PIN_C0 )
#use FIXED_IO( D_outputs=PIN_D7,PIN_D6,PIN_D5,PIN_D4,PIN_D3,PIN_D2,PIN_D1,PIN_D0 )
#use FIXED_IO( E_outputs=PIN_E2,PIN_E1,PIN_E0 )
#define LED   PIN_A0
#define S1   PIN_A1
#define DISPLAY2C   PIN_A4
#define DISPLAY2B   PIN_A5
#define DISPLAY2D   PIN_A6
#define DISPLAY2E   PIN_A7
#define DISPLAY3C   PIN_B0
#define DISPLAY3B   PIN_B1
#define DISPLAY3A   PIN_B2
#define S4   PIN_B5
#define S3   PIN_B6
#define S2   PIN_B7
#define DISPLAYCOM1   PIN_C0
#define DISPLAYCOM2   PIN_C1
#define DISPLAY3F2   PIN_C2
#define DISPLAY3G2   PIN_C3
#define POWERENABLE   PIN_C4
#define DISPLAY3B2   PIN_C5
#define DISPLAY3A2   PIN_C6
#define DISPLAY1BC   PIN_C7
#define DISPLAY3E2   PIN_D0
#define BUZZER   PIN_D1
#define DISPLAY3D2   PIN_D2
#define DISPLAY3C2   PIN_D3
#define DISPLAY3F   PIN_D4
#define DISPLAY3G   PIN_D5
#define DISPLAY3E   PIN_D6
#define DISPLAY3D   PIN_D7
#define DISPLAY2A   PIN_E0
#define DISPLAY2F   PIN_E1
#define DISPLAY2G   PIN_E2

tysie



Joined: 14 Nov 2017
Posts: 7

View user's profile Send private message

PostPosted: Thu Jan 04, 2018 2:34 pm     Reply with quote

When i tie the pin directly to VCC a current of 50mA flows through it
tysie



Joined: 14 Nov 2017
Posts: 7

View user's profile Send private message

PostPosted: Thu Jan 04, 2018 2:38 pm     Reply with quote

Solved,

It is a copied project in mplab,
But it looks like it takes the header file of the old project.
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