--- David Knaack wrote: > The basic stamps have an option for reading analog inputs, how would > I go about that with a PIC? The Basic Stamps rely on measuring the time it takes to charge or discharge a cap. It allows you to measure an analog signal with a standard port. It's not too accurate though. If you wanted to stick with Basic you can do the same thing the Stamps do or you can use the PICs actual A/D ports by using one of the PicBasic compilers. You have two choices of compiler. This first example is with PBC, the standard PicBasic compiler($89.95). The second example is with PicBasic Pro which offers direct access to all the PIC registers without the PEEK and POKE commands amongst other features ($239.95). EXAMPLE 1 *********************************************************** * Access PIC16C71 A/D using Peek and Poke commands in PBC. * Using Peek and Poke allows access to all PIC registers. *********************************************************** Symbol ADCON0 = 8 ' A/D Configuration Register 0 Symbol ADRES = 9 ' A/D Result Symbol ADCON1 = $88 ' A/D Configuration Register 1 Symbol SO = 0 ' Serial Output poke ADCON1, 0 ' Set PortA 0-3 to analog inputs poke ADCON0, $41 ' Set A/D to Fosc/8, Channel 0, On pause 1 ' Wait for channel setup Loop: poke ADCON0, $45 ' Start A/D Conversion pause 1 ' Wait 1ms for conversion peek ADRES, B0 ' Get A/D Result to variable B0 serout SO,N9600,(#B0,10) ' Send result to serial ' display or PC goto Loop EXAMPLE 2 *********************************************************** * Access PIC16C71 A/D using PBPro and send the result * serially out a standard I/O pin. *********************************************************** SO con 0 ' Define serial output pin ADCON1 = 0 ' Set PortA 0-3 to analog inputs ADCON0 = $41 ' Set A/D to Fosc/8, Channel 0, On Pause 1 ' Wait for channel to setup loop: ADCON0 = $45 ' Start A/D conversion Pause 1 ' Wait for conversion Serout SO,6,[#ADRES,10] ' Send result serially at 9600 baud Goto loop === Chuck Hellebuyck Electronic Products chuck@elproducts.com *****Program PICs in BASIC Special!********* Complete 16F84 package for only $115.95 Includes: Compiler, EPIC Programmer, 16F84 PIC, Cable & Batteries http://www.elproducts.com _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com