Search the web
Sign In
New User? Sign Up
jallist · JAL mailing list
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Analog inputs as digital inputs   Message List  
Reply | Forward Message #27025 of 27398 |
Re: [jallist] Analog inputs as digital inputs


Hi Rik,

What specifically doesn't work? Did you remember to declare the proper pin
directions? Try this very simple program:

include 16f877_bert

adc_off

pin_a1_direction = input

pin_b7_direction = output

var bit LED

LED = off

forever loop
if pin_a1 then
LED = off
pin_b7 = LED
delay_1ms(50)
else
LED = on
pin_b7 = LED
end if
end loop

The hardware setup is really simple as well:

1) Connect a 10K resistor from +5V to Pin A1.
2) Connect a 330 ohm resistor between the Cathode (flat side) of an LED and
ground.
3) Connect the Anode of the LED to pin B7.
4) Make proper Power, GND, oscillator, and MCLR Pull-up connections
5) Connect a bare wire to GND and leave the other end loose.

An ASCII schematic of what I am talking about is as follows:

+5V----/\/\10Kohm/\/\----X-----Pin A1

Pin B7---|>|---/\/\330Ohm/\/\----GND

Power up the circuit and touch the bare wire to pin A1 (the X above). When the
pin is shorted to ground, the LED should come on. When the pin is not shorted,
the LED will be off. If this doesn't work for pin A1, try moving to a different
pin/port until it does work. If it doesn't work on any pin, check your hardware
config. and make sure everything is connected properly.

Shawn

--- On Fri, 7/10/09, rik.slosse <slr@...> wrote:


From: rik.slosse <slr@...>
Subject: [jallist] Analog inputs as digital inputs
To: jallist@yahoogroups.com
Date: Friday, July 10, 2009, 4:46 AM


Hello,

I'm a beginner on JAL and have a problem. How can I use the Analog inputs
(A0..A5, E1..E3) as digital. I'm working with a PIC16F877 and the 16f877_bert
library. When the "ADC_off" command it doesn't work.

thanks,

Rik





















Tue Jul 14, 2009 6:24 am

sstandfast
Offline Offline
Send Email Send Email

Forward
Message #27025 of 27398 |
Expand Messages Author Sort by Date

Hello, I'm a beginner on JAL and have a problem. How can I use the Analog inputs (A0..A5, E1..E3) as digital. I'm working with a PIC16F877 and the 16f877_bert...
rik.slosse
Offline Send Email
Jul 10, 2009
9:52 am

Hi Rik, What specifically doesn't work? Did you remember to declare the proper pin directions? Try this very simple program: include 16f877_bert adc_off ...
Shawn Standfast
sstandfast
Offline Send Email
Jul 14, 2009
6:24 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help