tysie
Joined: 14 Nov 2017 Posts: 7
|
pin B3 on 18f45k22 |
Posted: Thu Jan 04, 2018 2:20 pm |
|
|
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
|
|
|