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

16f877 rs232 interesting problem??
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Mon Mar 22, 2010 7:41 pm     Reply with quote

capella wrote:
But I did not get any result...
Which is the part that is not working? Is it the serial part? Are the LEDs not lighting up?

Are you using the code that PCM gave?

Rohit
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

PostPosted: Tue Mar 23, 2010 1:35 am     Reply with quote

all of the pin b of 16f877 isnot working. it means that serial port is working because it shows text from 16f877 comes.
Ttelmah



Joined: 11 Mar 2010
Posts: 20159

View user's profile Send private message

PostPosted: Tue Mar 23, 2010 4:56 am     Reply with quote

Can't read it in the posted image, but what is the resistor value being used to drive the LED's?.
One possibility (though one LED at a time, should still work), is that you have the 'RMW' problem. The value on the resistor, looks like 22R. Now, a green LED, typically has a Vf, of about 2v. The PIC outputs can source a maximum of 25mA. 0.025*22=0.55v. So the output pin would be clamped at around 2.5v. Now, this should be high enough to be seen as 'high' by the processor, but it is tighter than I'd like.
If the resistors being used are 22R, change them to 220R.

Best Wishes
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

PostPosted: Wed Mar 24, 2010 6:43 am     Reply with quote

I changed as 220 R. But the problem still continues. So I try to work...
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Wed Mar 24, 2010 7:09 am     Reply with quote

How do you know that your PIC is actually running? Do you have access to an oscilloscope? Put the scope on the output (instead of the LED) and see if you get a waveform. If not, try a simple LED blinking program.

Rohit
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

PostPosted: Fri Mar 26, 2010 2:51 pm     Reply with quote

I solved problem but I don't understand how I solved my problem. I write reverse code. This mean that I wrote code for example:
Code:

output_bit(pin_b0,0);

This code means that led is on on my circuit. Very Happy But it is interesting, normally this code means that must be led off. It is very interesting really.
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

PostPosted: Sun Mar 28, 2010 2:29 pm     Reply with quote

does anybody know why my circuit or my program so worked?

Last edited by capella on Sun Mar 28, 2010 3:37 pm; edited 2 times in total
Ttelmah



Joined: 11 Mar 2010
Posts: 20159

View user's profile Send private message

PostPosted: Sun Mar 28, 2010 2:49 pm     Reply with quote

The obvious answer, is that you have to have made an incorrect connection, and got the end of the LED away from the PIC, connected to 5v (or no current will flow), and the LED reversed.

Best Wishes
capella



Joined: 07 Feb 2009
Posts: 38

View user's profile Send private message

PostPosted: Sun Mar 28, 2010 3:26 pm     Reply with quote

Maybe, but if I have made incorrect connections, all of the leds would not work. I mean that it just not working pin_b0, all of the pins are working normally. output_bit(pin_b0,0), output_bit(pin_b1,0), output_bit(pin_b2,0), output_bit(pin_b3,0), output_bit(pin_b4,0), output_bit(pin_b5,0), output_bit(pin_b6,0), output_bit(pin_b7,0) and all of the pind are working as leds on. I dont think so, because behaviour of each pinb and pind are same. So problem is different than your answer Ttelmah. But what is wrong????
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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