View previous topic :: View next topic |
Author |
Message |
hemnath
Joined: 03 Oct 2012 Posts: 242 Location: chennai
|
Issue on PIN 21 - PIC18F2520 |
Posted: Thu Sep 05, 2024 9:48 pm |
|
|
Compiler: v4.114
Issue: Output is not going high on PIN 21 (RB3/CCP2).
I have disabled the CCP2 but still the code doesn't works.
Code: |
#include "18F2520.h"
#fuses HS, NOWDT, NOPROTECT, PUT, CPB
#fuses BROWNOUT
#use delay (clock=12000000)
#use rs232(baud=9600, xmit=pin_c6, rcv=pin_c7, ERRORS)
#define OUT_CNTRL PIN_B3
void main()
{
SETUP_CCP1(CCP_OFF);
SETUP_CCP2(CCP_OFF);
while(1)
{
output_high(OUT_CNTRL);
delay_ms(1000);
output_low(OUT_CNTRL);
delay_ms(1000);
}
}
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19495
|
|
Posted: Fri Sep 06, 2024 3:20 am |
|
|
First, add one fuse:
NOPBADEN
By default on that chip the B0 to B4 pins wake up set for analog.
However that should not affect it being used as an output. I'd really look
five times at your hardware. Set the pin as an input, and try pulling it up
yourself with a resistor. If it does not go up you have a short on your
board. Other possibility a damaged pin.
It might be a fact with your compiler. 4.114, is incredibly old. Over ten
years. I'm trying to remember any issues we had back then, but without
going and looking at my notes, I can't immediately think of any on this
pin. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Sat Sep 07, 2024 6:53 am |
|
|
curious...
RB3 as pin 21 makes it a QFN style ,
so maybe it's not soldered to PCB ?
have a 6th look ,with magnifier to CONFIRM it is soldered or just resolder it.
Now test again..... |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19495
|
|
Posted: Sat Sep 07, 2024 9:13 am |
|
|
One other possibility I didn't want to say, is that he simply has his pin
numbering wrong, and has read 21 for B3, when he is not using the QFN
package chip...... |
|
|
|