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