Here is how I would go about it: Use CM2:CM0 == 0b011 Then: RA0 and RA1 are your potentiometer inputs RA2 is your reference, driven by the VREF module (VROE == 1) RB1 and RB2 are your USART pins That leaves 9 pins for multiplexing your keyboard. No need to configure/reconfigure at all. Bob Ammerman RAm Systems // TODO: Add your command handler code here ----- Original Message ----- From: "Goring, Steve" To: Sent: Tuesday, April 23, 2002 3:48 AM Subject: [PIC]:16f628 comparators > Hi List ... > > This is my requirement - use a gameboy / playstation hand controller for > controlling 4 lights > 5 dc motors and 2 pan and tilt cameras. > > On the hand controller are 2 analogue pots and 17 switches - my options are > this, keyscan > the switches in a 4x4 matrix and use discrete comparators and just read the > o/ps. > > keyscan the switches and use the internal comparators. > > My question is this - I need the usart to connect to the motors etc via > rs232, there fore to keyscan > the switches I need 8 i/o lines - would it be better to use all of portb > where the usart is located > and keep configuring and unconfiguring it or to use the upper 4 bits of > portb and lower 4 bits of > porta where the comparators are located and keep configuring and > unconfiguring the comparators. > > Or is there another way of doing things - I hope this is clear enough. In > summary I need to know the > state of two analogue pots and 16 switches, the resultant states are then > changed into control > codes and sent to the hardware via rs232. > > Thanks in advance > > > Steve > > > > > ********************************************************************** > Information in this email is confidential and may be privileged. > It is intended for the addressee only. If you have received it in error, > please notify the sender immediately and delete it from your system. > You should not otherwise copy it, retransmit it or use or disclose its > contents to anyone. > Thank you for your co-operation. > ********************************************************************** > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics