Skip to main content
Visitor II
December 12, 2005
Question

PORT B as General Port Input

  • December 12, 2005
  • 2 replies
  • 709 views
Posted on December 12, 2005 at 07:04

PORT B as General Port Input

    This topic has been closed for replies.

    2 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:08

    Hello!

    I am very new to the upsd33xx and I am at the moment trying out the funcionalities of the PLD. To give any logical level to Port B from the MCU as a GPIO is no problem, but to receive a value from a Port pin as GPIO does not work.

    But it might be, that i make some mistake in memory addressing.

    Here is my configuration:

    .abl-file:

    jtagsel = !_reset;

    rs0 = ((address >= ^h0000) & (address <= ^h1FFF));

    csiop = ((address >= ^h2000) & (address <= ^h20FF));

    fs0 = ((address >= ^h0000) & (address <= ^h7FFF));

    fs1 = ((page == 0) & (address >= ^h8000) & (address <= ^hFFFF));

    fs2 = ((page == 1) & (address >= ^h8000) & (address <= ^hFFFF));

    fs3 = ((page == 2) & (address >= ^h8000) & (address <= ^hFFFF));

    fs4 = ((page == 3) & (address >= ^h8000) & (address <= ^hFFFF));

    fs5 = ((page == 4) & (address >= ^h8000) & (address <= ^hFFFF));

    fs6 = ((page == 5) & (address >= ^h8000) & (address <= ^hFFFF));

    fs7 = ((page == 6) & (address >= ^h8000) & (address <= ^hFFFF));

    csboot0 = ((address >= ^h8000) & (address <= ^h9FFF));

    csboot1 = ((address >= ^hA000) & (address <= ^hBFFF));

    csboot2 = ((address >= ^hC000) & (address <= ^hDFFF));

    csboot3 = ((address >= ^hE000) & (address <= ^hFFFF));

    Code for configuration and data transfers:

    ;configuration of the direction of Port B GPIO

    MOV A,#00011111b

    MOV DPTR,#DIRECTION_B

    MOVX @DPTR,A

    ;OUTPUT ENABLE for the output pins

    MOV A,#00011111b

    MOV DPTR,#OUTENABLE_B

    MOVX @DPTR,A

    ;send data to PORT B

    MOV A,#00011111b

    MOV DPTR,#DATAOUT_B

    MOVX @DPTR,A

    receive data from Port B

    MOV DPTR,#DATAIN_B

    MOVX A,@DPTR

    PSD_REGISTER_CONFIGURATION:

    DATAIN_A data 2000H; // PSD_REG_BASE +0x00

    DATAIN_B data 2001H; // +0x01

    CONTROL_A data 2002H; // +0x02

    CONTROL_B data 2003H; // +0x03

    DATAOUT_A data 2004H; // +0x04

    DATAOUT_B data 2005H; // +0x05

    DIRECTION_A data 2006H; // +0x06

    DIRECTION_B data 2007H; // +0x07

    DRIVE_A data 2008H; // +0x08

    DRIVE_B data 2009H; // +0x09

    IMC_A data 200AH; // +0x0A

    IMC_B data 200BH; // +0x0B

    OUTENABLE_A data 200CH; // +0x0C

    OUTENABLE_B data 200DH; // +0x0D

    Thanks for your help!

    kind regards harryplotter4

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 12:08

    Hello!

    I'm sorry for not answering for such a long time. but, i also fixed the problem. It was just some configuration missmatch between the MCU memory description and the PSD memory description.

    Thanks!