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

Read BCD Value on MSB of Port B

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







Read BCD Value on MSB of Port B
PostPosted: Fri Aug 08, 2003 7:17 am     Reply with quote

I have connected a 10 position BCD rotary switch to B4-B7 and
need to be able to place the value into a variable. When I
programmed in PIC Basic Pro this was pretty straight forward:

BCD_In = PORTB & \%11110000 ' Read BCD switch on ports B4-B7

I haven't been able to find anything simular in PIC-C.
Thanks in advance..
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516813
Cinko
Guest







Re: Read BCD Value on MSB of Port B
PostPosted: Fri Aug 08, 2003 7:37 am     Reply with quote

:=I have connected a 10 position BCD rotary switch to B4-B7 and
:=need to be able to place the value into a variable. When I
:=programmed in PIC Basic Pro this was pretty straight forward:
:=
:=BCD_In = PORTB & \%11110000 ' Read BCD switch on ports B4-B7
:=
:=I haven't been able to find anything simular in PIC-C.
:=Thanks in advance..

Everything you have to do is:
1 - First declare PORTB
#byte PORTB = the actual portb addr
2 - Read the port to the variable
BCD_In = PORTB & 0xf0

That's it.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516815
Cinko
Guest







Re: Read BCD Value on MSB of Port B
PostPosted: Fri Aug 08, 2003 7:59 am     Reply with quote

:=I have connected a 10 position BCD rotary switch to B4-B7 and
:=need to be able to place the value into a variable. When I
:=programmed in PIC Basic Pro this was pretty straight forward:
:=
:=BCD_In = PORTB & \%11110000 ' Read BCD switch on ports B4-B7
:=
:=I haven't been able to find anything simular in PIC-C.
:=Thanks in advance..

Willian.

Everything you have to do is:
1 - First declare PORTB
#byte PORTB = the actual portb addr
2 - Read the port to the variable
BCD_In = PORTB & 0xf0

That's it.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516818
whmeade10
Guest







Re: Read BCD Value on MSB of Port B
PostPosted: Fri Aug 08, 2003 8:57 am     Reply with quote

Thanks for the quick response. It is easy.

I wuld also like to appoligize for all the multiple posts on this subject. I kept getting server error pages when submitting my question. I guess they went through even though I got an error. I also noticed that I can't view some of the replies to my questions.

:=:=I have connected a 10 position BCD rotary switch to B4-B7 and
:=:=need to be able to place the value into a variable. When I
:=:=programmed in PIC Basic Pro this was pretty straight forward:
:=:=
:=:=BCD_In = PORTB & \%11110000 ' Read BCD switch on ports B4-B7
:=:=
:=:=I haven't been able to find anything simular in PIC-C.
:=:=Thanks in advance..
:=
:=Everything you have to do is:
:=1 - First declare PORTB
:= #byte PORTB = the actual portb addr
:=2 - Read the port to the variable
:= BCD_In = PORTB & 0xf0
:=
:=That's it.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516821
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