| View previous topic :: View next topic |
| Author |
Message |
Rohit de Sa
Joined: 09 Nov 2007 Posts: 282 Location: India
|
|
Posted: Mon Mar 22, 2010 7:41 pm |
|
|
| 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
|
|
Posted: Tue Mar 23, 2010 1:35 am |
|
|
| 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
|
|
Posted: Tue Mar 23, 2010 4:56 am |
|
|
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
|
|
Posted: Wed Mar 24, 2010 6:43 am |
|
|
| 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
|
|
Posted: Wed Mar 24, 2010 7:09 am |
|
|
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
|
|
Posted: Fri Mar 26, 2010 2:51 pm |
|
|
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. 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
|
|
Posted: Sun Mar 28, 2010 2:29 pm |
|
|
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
|
|
Posted: Sun Mar 28, 2010 2:49 pm |
|
|
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
|
|
Posted: Sun Mar 28, 2010 3:26 pm |
|
|
| 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???? |
|
 |
|