c0de
Joined: 14 May 2007 Posts: 14
|
Help reading from multiplexer |
Posted: Tue Nov 20, 2007 12:41 pm |
|
|
Hello.
I'm beginner with PIC and ccs. I need some help/advices in reading data from a multiplexer.
I'm using a PIC16f876 for reading 9 digital inputs. Initially I've set portB (all 8 pins) and pin RC5. Now I intend to use a 4x16 LCD display and to read data from a sonar. portA is used to control 3 motors.
I can group the 9 digital inputs into 3 groups of 3 (because they are different types) and use 3 multiplexers (my ideea is to use 3 multiplexers 8-to-1 in order to have signals of 8 bits and use only 3 input ports). What I do not know is how can I read these bits from the multiplexer. (using ccs PCM compiler version 4.032 under Linux)
EDITED:
The sensors are actually acting like switches (I'm reading only the On or Off state).
Any help/advice would be appreciated.
P.S: I saw an example of reading digital inputs (but from sonars) using multiple serial lines. Example:
#use rs232(baud=9600, INVERT, BITS = 8, PARITY = N, rcv=SONAR_1_XMIT, stream=sonar1)
#use rs232(baud=9600, INVERT, BITS = 8, PARITY = N, rcv=SONAR_2_XMIT, stream=sonar2)
... Where SONAR_1(and 2)_XMIT were defined as PIN_A3 and PIN_A2
I wonder if I could apply this to multiplexer output.
Thanks
Last edited by c0de on Tue Nov 20, 2007 12:59 pm; edited 1 time in total |
|