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 support@ccsinfo.com

PORTB direction problem!!

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







PORTB direction problem!!
PostPosted: Fri Jul 18, 2003 12:16 am     Reply with quote

I have a silly problem with CCS picc compiler. When I send to the port b, 0xFF, portb bit 4 doesnt turn to logical 1. Would you help me please..My sample code is below.

Note: Eight LEDs are connected portb. All of LEDs are lighted except bit4 later the code below.

#if defined(__PCM__)
#include <16f877.h>
#fuses HS,NOWDT,NOPROTECT
#use delay(clock=16000000)
#use standard_io(B)
#endif

void main(void)
{

output_b(0xFF);

while(1);

}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516126
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: PORTB direction problem!!
PostPosted: Fri Jul 18, 2003 1:19 am     Reply with quote

:=I have a silly problem with CCS picc compiler. When I send to the port b, 0xFF, portb bit 4 doesnt turn to logical 1. Would you help me please..My sample code is below.
:=
:=Note: Eight LEDs are connected portb. All of LEDs are lighted except bit4 later the code below.
:=
:=#if defined(__PCM__)
:=#include <16f877.h>
:=#fuses HS,NOWDT,NOPROTECT
:=#use delay(clock=16000000)
:=#use standard_io(B)
:=#endif
:=
:=void main(void)
:={
:=
:=output_b(0xFF);
:=
:=while(1);
:=
:=}
:=
:=
:=
Perhaps you mean the 4th led, bit 3?
If so, change line to
#fuses HS,NOWDT,NOPROTECT,NOLVP

Regards
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516129
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: PORTB direction problem!!
PostPosted: Fri Jul 18, 2003 9:54 am     Reply with quote

<font face="Courier New" size=-1>:=I have a silly problem with CCS picc compiler. When I send to the port b, 0xFF, portb bit 4 doesnt turn to logical 1. Would you help me please..My sample code is below.
:=
:=Note: Eight LEDs are connected portb. All of LEDs are lighted except bit4 later the code below.
:=
:=#if defined(__PCM__)
:=#include <16f877.h>
:=#fuses HS,NOWDT,NOPROTECT
:=#use delay(clock=16000000)
:=#use standard_io(B)
:=#endif
:=
:=void main(void)
:={
:=
:=output_b(0xFF);
:=
:=while(1);
:=
:=}
:=
:=
:=

That pin is not able to output high. Only float and output low. Try wiring the LED's to +5 instead of ground. Then you pull the pins low to turn them on.</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516149
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: PORTB direction problem!!
PostPosted: Sat Jul 19, 2003 4:26 pm     Reply with quote

:=I have a silly problem with CCS picc compiler. When I send to the port b, 0xFF, portb bit 4 doesnt turn to logical 1. Would you help me please..My sample code is below.
:=
:=Note: Eight LEDs are connected portb. All of LEDs are lighted except bit4 later the code below.
:=
:=#if defined(__PCM__)
:=#include <16f877.h>
:=#fuses HS,NOWDT,NOPROTECT
:=#use delay(clock=16000000)
:=#use standard_io(B)
:=#endif
:=
:=void main(void)
:={
:=
:=output_b(0xFF);
:=
:=while(1);
:=
:=}
:=
:=
:=

Did you mean port a? Bit 4 of port a is the one that needs the pullup.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516186
johnq
Guest







Re: PORTB direction problem!!
PostPosted: Mon Jul 21, 2003 1:30 am     Reply with quote

:=:=I have a silly problem with CCS picc compiler. When I send to the port b, 0xFF, portb bit 4 doesnt turn to logical 1. Would you help me please..My sample code is below.
:=:=
:=:=Note: Eight LEDs are connected portb. All of LEDs are lighted except bit4 later the code below.
:=:=
:=:=#if defined(__PCM__)
:=:=#include <16f877.h>
:=:=#fuses HS,NOWDT,NOPROTECT
:=:=#use delay(clock=16000000)
:=:=#use standard_io(B)
:=:=#endif
:=:=
:=:=void main(void)
:=:={
:=:=
:=:=output_b(0xFF);
:=:=
:=:=while(1);
:=:=
:=:=}
:=:=
:=:=
:=:=
:=
:=Did you mean port a? Bit 4 of port a is the one that needs the pullup.

No I mean the PORTB and I solved my problem with your help. Thank you...See you..
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516215
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