PLP_C question
Can I use PLP_C to hold an input high when floating until GND is present on a switch?
I want to use a 4 spst dip switch to set an address, but don't have room to add pullup resistors and was hoping this would do the job.
TRIS_C = %11110000 'RC.0, 1, 2 ,3 to inputs
PLP_C = %00001111 'hold inputs RC.0 - RC.3 high, but can be forced low with switch
I want to use a 4 spst dip switch to set an address, but don't have room to add pullup resistors and was hoping this would do the job.
TRIS_C = %11110000 'RC.0, 1, 2 ,3 to inputs
PLP_C = %00001111 'hold inputs RC.0 - RC.3 high, but can be forced low with switch
Comments
PLP_C = %00001111 will hold RC.7,6,5,4 high
Aside from having the wrong bits shown, the code WILL do what you want.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·
Here is the plan:
4 pin dip switch on both Tx and Rx side. In cases where user has more than one system, they can put each system on it's own "channel" by setting the dip switches to the same settings. 16 options for channels.
On boot up, a VAR named ChanId loads in i/o bank C somehow. ChanId = RC? dips are connected to RC.0 - RC.3 ( trying to arrive at 11110000 if 0-3 are high.)
If all 4 switches are in "high" position, the byte is recorded into ChanId as %11110000
Then, serByte gets the bytes as the come in, which will be either %00000001 or %00000011 + whatever the Tx ChanId is set to.
serByte = RecByte 'goes sub and gets byte
FinalByte = serByte - ChanId 'Deducts its ID back out
If FinalByte = %00000001 Then
'move motor up
IF FinalByte = %00000011 Then
'move motor down
Is this a decent idea?
%11110000 <- Value
· ·76543210 <- Bit number
So 11110000 has 0-3 low, and 4-7 high.
Other than that, your method should work.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cheap used 4-digit LED display with driver IC·www.hc4led.com
Low power SD Data Logger www.sddatalogger.com
SX-Video Display Modules www.sxvm.com
There are only two guaranteed ways to become weathy.
Spend less than you make.
Make more than you spend.
·