sema_tufan
Joined: 03 Mar 2020 Posts: 14 Location: turkey
|
I couldn't get the E3 pin to work in PIC18f45k40 |
Posted: Tue May 25, 2021 7:54 am |
|
|
Hello,
A few pins of LEDs were connected in my circuit board. Although I just set the E3 pin as output, I could not see the voltage.
Other leds work, only E3 pin does not work.
My code is as follows:
Code: |
#include <18F45K40.h>
#use delay(internal=16000000)
#FUSES PUT
#FUSES PROTECT
#FUSES NODEBUG
#FUSES NOBROWNOUT
#FUSES NOLVP
#FUSES NOCPD
#FUSES NOWDT
#FUSES NOMCLR
#BYTE TRISA = 0xF88
#BYTE TRISB = 0xF89
#BYTE TRISC = 0xF8A
#BYTE TRISE = 0xF8C
#byte PORTA = 0xF8D
#byte PORTB = 0xF8E
#byte PORTC = 0xF8F
#byte PORTE = 0xF91
void main()
{
setup_oscillator(OSC_HFINTRC_16MHZ);
set_timer0(T1_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED, 0, 1);
setup_ccp1(CCP_OFF);
TRISA = (0B00000000);
TRISB = (0B00000000);
TRISC = (0B00000000);
TRISE = (0B00000000);
PORTA = (0B00000000);
PORTB = (0B00000000);
PORTC = (0B00000000);
PORTE = (0B00000000);
while (true)
{
output_high(PIN_A0);
output_high(PIN_A1);
output_high(PIN_A2);
output_high(PIN_B1);
output_high(PIN_B2);
output_high(PIN_B3);
output_high(PIN_B4);
output_high(PIN_B5);
output_high(PIN_B6);
output_high(PIN_B7);
output_high(PIN_E3);
delay_ms(1000);
output_low(PIN_E3);
output_low(PIN_A0);
output_low(PIN_A1);
output_low(PIN_A2);
output_low(PIN_B1);
output_low(PIN_B2);
output_low(PIN_B3);
output_low(PIN_B4);
output_low(PIN_B5);
output_low(PIN_B6);
output_low(PIN_B7);
delay_ms(1000);
}
}
|
http://remoturk.com/e3.jpg
There is a photo of the circuit in the link. |
|