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

PIN_A4 and PIN_B3 no output

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



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PIN_A4 and PIN_B3 no output
PostPosted: Fri Jun 25, 2004 8:40 am     Reply with quote

Hi Guys:
I wrote a program to blink all led (A, B, C, D, E port) in my easy2 board, all others was blinking except these two pins what might be wrong?
in output_high(PIN_A4);
delay_ms(20);
output_low(PIN_A4);
delay_ms(20);


output_high(PIN_B3);
delay_ms(20);
output_low(PIN_B3);
delay_ms(20);

or what might affect the output result?
young



Joined: 24 Jun 2004
Posts: 285

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 8:47 am     Reply with quote

When I push the RA4 reset button, RA4 did turn light on, and it did not affect other leds however, when I push the RB3 button, it turned on and program start running frm the beginning it works as a red reset button for all the leds. why?
Laurent Chouinard



Joined: 12 Sep 2003
Posts: 43

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 9:51 am     Reply with quote

Depending on which PIC you use, the RA4 pin might be sink-only. So you have to wire your led to VCC, and sink through RA4 to ground.

<pre>
VCC ----|>------/\/\/\/\/------PIC's RA4
led resistor
</pre>

As for pin B3, depending on which PIC you use, it might be source-only. So you have to wire your led the other way around:

<pre>
GROUND ----<|------/\/\/\/\/------PIC's RB3
led resistor
</pre>
Guest








PostPosted: Fri Jun 25, 2004 11:34 am     Reply with quote

Thank you laurent!
The PIC I am using is easy2 PIC16F877A. I did connected PIN_A4 with the circuit you provided, it works, however for the other one PIN_B3 it did not work. what do you think happened to Pin_B3
Laurent Chouinard



Joined: 12 Sep 2003
Posts: 43

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 11:37 am     Reply with quote

Might be many things... could you post your sample code? Maybe your port B isn't defined correctly, or something else uses it, or maybe it's defective.
Guest








PostPosted: Fri Jun 25, 2004 11:45 am     Reply with quote

By the way, when I measure votages on these two bins, there is not signals changes anyway if I do not connect the circuits you provided.

when I push the reset button on PIN-B3, it did turns on.

my program is as simple as the code I just posted in my just post
Laurent Chouinard



Joined: 12 Sep 2003
Posts: 43

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 11:47 am     Reply with quote

There must be something before that code. You should typically initialise your ports, set them as input/ouput or automatic, etc. If you're doing anything else, it might be interfering with your port later in your code and that might be the reason why it's not working properly.

As for the reset button, how is it connected to your circuit?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 25, 2004 1:06 pm     Reply with quote

Pin A4 and pin B3 are the two biggest "gotcha's" in the PIC world,
in terms of pin problems with the 16F87x series PICs.
This information is in the data sheet. You should read it.
Link to 16F877A data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/39582b.pdf

Pin A4 is open-collector, and thus it can't put out a high level voltage.

Pin B3 is the PGM pin, and it comes from the manufacturer setup for
use with LVP mode (low voltage programming). You have to add
NOLVP to the #fuses statement in your CCS program, so that pin B3
can be used as a normal i/o pin.
Guest








PostPosted: Fri Jun 25, 2004 2:02 pm     Reply with quote

hi laurent and PCM programmer:

Thank you for your help. The following is my whole programm, please help correct it. thanks again!

#if defined(__PCM__)
#include <16f877A.h>
#fuses HS,NOWDT,PUT
#use delay(clock=20000000)
#endif

#define PAUSE 200
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12

//#device PIC16F877A


main()
{
while (TRUE) {
// printf("Port A/E Blink\n\r");
output_high(PIN_A0);
delay_ms(20);
output_low(PIN_A0);
delay_ms(20);
output_high(PIN_A1);
delay_ms(20);
output_low(PIN_A1);
delay_ms(20);
output_high(PIN_A2);
delay_ms(20);
output_low(PIN_A2);
delay_ms(20);
output_high(PIN_A3);
delay_ms(20);
output_low(PIN_A3);
delay_ms(20);
output_high(PIN_A4);
delay_ms(20);
output_low(PIN_A4);
delay_ms(20);
output_high(PIN_A5);
delay_ms(20);
output_low(PIN_A5);
delay_ms(20);
output_high(PIN_E0);
delay_ms(20);
output_low(PIN_E0);
delay_ms(20);
output_high(PIN_E1);
delay_ms(20);
output_low(PIN_E1);
delay_ms(20);



output_high(PIN_B0);
delay_ms(20);
output_low(PIN_B0);
delay_ms(20);
output_high(PIN_B1);
delay_ms(20);
output_low(PIN_B1);
delay_ms(20);
output_high(PIN_B2);
delay_ms(20);
output_low(PIN_B2);
delay_ms(20);
output_high(PIN_B3);
delay_ms(20);
output_low(PIN_B3);
delay_ms(20);
output_high(PIN_B4);
delay_ms(20);
output_low(PIN_B4);
delay_ms(20);
output_high(PIN_B5);
delay_ms(20);
output_low(PIN_B5);
delay_ms(20);
output_high(PIN_B6);
delay_ms(20);
output_low(PIN_B6);
delay_ms(20);
output_high(PIN_B7);
delay_ms(20);
output_low(PIN_B7);
delay_ms(20);}
}
Laurent Chouinard



Joined: 12 Sep 2003
Posts: 43

View user's profile Send private message

PostPosted: Mon Jun 28, 2004 6:44 am     Reply with quote

Could you explain how pin B3 is connected electrically? You talk about some RESET button that may be connected somewhere. Where is it connected?

I've been using 16Fxx chips without the NOLVP fuse and pin_b3 has always been accessible, so i don't think that this is the cause. You may try it though, just for kicks.
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