Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RA4 as an input on PIC16F688

Status
Not open for further replies.

Stellarcore

New Member
Hello,

I'm trying to use PIN_A4 as the receive pin for a software UART with the ccs compilter. This was not working for me, so I'm trying to get PIN_A4 to work as an input of any kind.

The pin is normally floating high, but the MAX232 that is connected to it cannot seem to pull it low. I know the max232 is configured correctly, because if I simply move the input from A4 to C3, it works perfectly fine, however this is a last resort option, because I dont want to cut traces and splice wires on my PCB unless absolutely neccessary.

I've written a very basic application that just reads A4 and outputs the value to C2, which is a status LED on my board. This sort of works; if I short A4 directly to ground, the input is correctly read and my status LED goes out. I've tested it, and if the pin is pulled low with anything greater than about 300 ohms, it is not read correctly.

I've also made sure that the pullups on PORTA are disabled, but this doesnt seem to have an effect.

Here is my code for the test application:

Code:
#include <16F688.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, NOMCLR, NOBROWNOUT, NOCPD, PUT, NOIESO, NOFCNEN
#device adc=10

void main() {
     set_tris_a(0xFF);
     port_a_pullups(false);
     while (true) { output_bit(PIN_C2,input(PIN_A4)); }
}
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top