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 CCS Technical Support

Issue on PIN 21 - PIC18F2520

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



Joined: 03 Oct 2012
Posts: 242
Location: chennai

View user's profile Send private message

Issue on PIN 21 - PIC18F2520
PostPosted: Thu Sep 05, 2024 9:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Sep 06, 2024 3:20 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 07, 2024 6:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Sep 07, 2024 9:13 am     Reply with quote

Very Happy

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......
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