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:
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
Posted: Fri Aug 08, 2003 7:37 am
:=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
Posted: Fri Aug 08, 2003 7:59 am
:=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
Posted: Fri Aug 08, 2003 8:57 am
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
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