> -----Original Message----- > From: Sharon Brady [SMTP:s.m.brady@DURHAM.AC.UK] > Sent: Wednesday, November 15, 2000 9:24 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: [PIC] :How do I read and write to Port A, using pic 17c44 > > Hi, > > I am trying to access PortA and use one of the lines as an output to a > relay. > Using MPLAb simulation the value appears on the w reg but not on Port A. I > have tried using assembler and C and have not been successful > > void main () > { > PORTA = 0x05; > } > > Is there a command to set up the direction of PORTA? as there is no DDR > for > it. > Could someone please tell me what I am missing? > > thank you > > Sharon > The Data Direction Register on the PIC is actually called the TRIS register. It is mapped to the same location as the port register, but in the adjacent bank (bank 1). Bits set to 1 are inputs, bits set to 0 are outputs. With HiTech you don't need to worry about bank switching, simply use TRISA = 0x00; to make all bits on PORTA outputs. Hope that helps Mike -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.