At 13:43 24/03/97 -0500, you wrote: >Hello >I would like to simplify a four bit d/a that I'm using portb 4-7 to >emulate I have each pin connected to a diode then a resistor this in >turn draws current from the noninverting side of a voltage follower >configured opamp this in turn causes the output to swing + to compensate >and the inverting output is connected to a pot to provide the initial >offset simple right? only I figure if I change the port pins from low to >high impedance I can dispense with the diodes right? What sort of morass >am I wading into firmware wise I mean the port is allready working hard >but is configured as an output and I have no experience changing >individual pin configurations. Generally I configure b out a in and >leave it at that but...anyway.oh yeah 16c84 xt mode 100khz line powered >.R2R increases the part count (discrete's) and space is as usual at a >premium.can I toggle a configuration bit without creating artifacts on >the other pins of that or any other port?The data book explains how I >suppose but is not to clear on the downside . respects Tony M. The biggest problem with this scheme is the usual BSF/BCF nuisance. If the bits configured as inputs are 'low' when a BCF or BSF is issued they will be cleared. Thus you will need to write 0xf? to the port before you change the ADC value. The code will probably look something like this... Update_ADC movf PORTB,W ; Assumes no pins forced high/low iorlw 0xF0 ; Set B7..B4 movwf PORTB swapf Adc_value,W ; Get new value in high bits bsf STATUS,RP0 ; Go to page 1 movwf TRISB bcf STATUS,RP0 ; Back to page 0 I've assumed that none of the port B pins are being forced high/low, otherwise you will have to mirror the port in RAM and write that value instead. I've also assumed that your ADC value is stored in the low nibble of a byte with zeroes in the high nibble. Hope this helps, Keith. ========================================================== Keith Dowsett "Variables won't; constants aren't." E-mail: kdowsett@rpms.ac.uk WWW: http://kd.rpms.ac.uk/index.html