Thanks for the replay
I try the  program but i get an error that the RA1 And RA2 are not defined.I include the header files #include <pic14regs.h> and also #include"pic/pic16f84.h" i got an error the error is  Undefined identifier 'RA1'.i am usind sdcc and os is  linux debian h

On 12/20/06, Raphael Neider <> wrote:

>       i am using sdcc for programing pic16f84a .i am fresher in
> sdcc .now i had aproblem .i want to read data from a single pin in the
> porta and also i want to sent other pin as output(pa0 as input and
> pa1-pa3 as output).plz send me a code to do this ,help me in solving
> this problem.

Ever bothered to skim through include/pic/pic16f84a.h and/or the
pic16f84a datasheet?

<code name=" ports.c">
#include <pic14regs.h> // may also use pic16f84a.h directly

typedef unsigned char u8;

u8 foo(u8 val) {
  TRISA = 0x01; // RA0 is input, RA1-RA4 are outputs
  PORTA = val;
  RA1 = 1;
  RA2 = 0;
  return (RA0):

sdcc -mpic14 -p16f84a -c ports.c


Take Surveys. Earn Cash. Influence the Future of IT
Join's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
Sdcc-user mailing list