C code for PIC16F877A

Thread Starter

teongkia

Joined Apr 9, 2007
1
Hi can anyone provide me a simple code in C for 16F877A microcontroller?
The operation is when pin A0 or pin A1 has 5V input it will produce 5v output at pin B5. I have rs232 cable connected to pin C6(Xmit) and C7(rcv). When pin A0 or pin A1 has an input of 5V, it will PRINTF("ATD0123423539;\n\r"); where my phone which is attached to the rs232 cable will call the destination number. Hope anyone here call help me out.Thanks.
 

bloguetronica

Joined Apr 27, 2007
1,372
Here is goes:

int pin_a0, pin_a1;
int pin_b5 = 0;

...

if (pin_0 || pin_1)
{
PRINTF("ATD0123423539;\n\r");
pin_b5 = 1;
}

...

...read pin_b5 or something...

You don't need to use { or } inside the if statement.
 
Top