In: Computer Science
I am using MIPS assembly with MARS. My question is about I/O Devices.
1) Research and read about SFRs. Explain the differences between TRISx, PORTx, LATx and ODCx ports. Specify the special function registers (SFRs) for the I/O device(s)
All port pins have ten registers straightly linked with their function as input-output The data direction register (TRISx) decide whether the pin is an input or an output. If the bit is a ‘1’ (one), then the pin is an input. After Reset operation, all port pins are defined as inputs by default. (LATx) define whether reads from the latch with the latch or Writes to the latch write the latch. Reads from the port PORTx read the port pins, while writes operations write the latch. ODCx, associated with each of the port. Setting any of the design of the bit the equivalent pin to act as an open-drain output.
Peripheral pin chooses characteristics are controlled through two sets of SFRs: First one is to map peripheral inputs, and the second one is to map outputs. Because they are independently controlled, a particular peripheral’s input and output (if the peripheral has both) can be placed on any selectable function pin without constraint.
I/O Port Control Registers All I/O ports have three registers straightly connected with the function of the port, where ‘x’ is a letter that denotes the particular I/O port:
1.TRISx: The TRISx register control bits choose whether each pin associated with the I/O port is an input or an output. If the TRIS bit for an I/O pin is a ‘1’, then the pin is an input. If the TRIS bit for an I/O pin is a ‘0’, then the pin is configured for output.
2. PORTx: Data on an input-output (I/O) pin is accessed via a PORTx register. A read of the PORTx register reads the value of the input-output (I/O) pin, while a write to the PORTx register writes the value to the port data latch.
3. LATx: I/O The LATx register connected with an I/O pin removes the difficulties that could arise with read-modify-write instructions. A read of the LATx register returns the values held in the port output latches, on the contrary, the values on the I/O pins.
4. ODCx, associated with each of the port. Setting any of the design of the bit the equivalent pin to act as an open-drain output.