Electronics-Related.com
Forums

Help required with 22V10 - Using a pin as Input an Output

Started by Dave Hitchins March 17, 2021
I'm having problems with the SDA part of an IIC implementation in a AMD 22V=
10C (not from China!). I can Output data, to the SDA output, but I'm not ab=
le to read the SDA input! My CUPL equations, as a whole, compile OK using W=
INCUPL and the .JED file programs OK.

These are the intermediate declarations:
FCD7=C2=A0=C2=A0=3D !nPFC & A7 & A6 & !A5 & A4 & !A3 &  A2 &  A1 &  A0;
SCLH=C2=A0=C2=A0=3D  FCD7 & !BnWR &  D6 ;=20
SCLL   =3D  FCD7 & !BnWR & !D6 ;=20
SDAH  =3D  FCD7 & !BnWR &  D7 ;
SDAL   =3D  FCD7 & !BnWR & !D7 ;=20

These are the outputs associated with SDA I/O:
PIN 15=C2=A0=C2=A0=3D  D7=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0/* Data line 7 */
PIN 18=C2=A0=C2=A0=3D  SDAOE=C2=A0=C2=A0=C2=A0/* SDA output control latch *=
/
PIN 19=C2=A0=C2=A0=3D  SDA=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/=
* SDA I/O pin */

This is the equation for the SDA output control latch and sets the SDA outp=
ut Low when needed. This sections works just fine.
SDAOE=C2=A0=C2=A0=3D=C2=A0=C2=A0SDAH=C2=A0=C2=A0=C2=A0=C2=A0/* Set high - w=
rite FCD7 with D7=3DH */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0# !SDAH & !SDAL & SDAOE =C2=A0=C2=A0=C2=A0=C2=A0/* Set low - write=
 FCD7 with D7=3D0 */
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0# !nRST ;=C2=A0=C2=A0=C2=A0=C2=A0/* Set high - on reset */

This is the SDA output pin. Pulled high, externally, with a 4K7 resistor. W=
orks as an output just fine.
SDA.OE=C2=A0=C2=A0=3D !SDAOE ;=C2=A0=C2=A0=C2=A0=C2=A0/* Only on when 'LOW'=
 output required */
SDA      =C2=A0=C2=A0=3D  SDAOE ;=C2=A0=C2=A0=C2=A0=C2=A0/* Always low when=
 output enabled */

This is the problem pin.
D7       =C2=A0=3D  SDA ;=C2=A0=C2=A0=C2=A0=C2=A0/* SDA input transferred t=
o D7 output on read of FCD7 */
D7.OE=C2=A0=C2=A0=3D  FCD7 & BnWR ;

If I toggle the SDAOE latch I can read its state through D7 e.g. I can read=
 SDA output, however, if I set the SDAOE latch High, ready for  read of the=
 SDA INPUT, I can't then read the input - I just read a High value on D7. I=
t seems that the path from the SDA pin through to the & array isn't there!

Anybody have any clues to what's going wrong? Thanks . . . Dave H.
 Dave Hitchins wrote:
-------------------------------------

Hi Dave,=20

WTF makes you think your  is a  *basic*  question about  * electronics *  ?=
?????????????=20

You DID even read the NG name  ??=20
-------------------------------------------------------



> I'm having problems with the SDA part of an IIC implementation in a AMD 2=
2V10C (not from China!). I can Output data, to the SDA output, but I'm not = able to read the SDA input! My CUPL equations, as a whole, compile OK using= WINCUPL and the .JED file programs OK.=20
>=20 > These are the intermediate declarations:=20 > FCD7 =3D !nPFC & A7 & A6 & !A5 & A4 & !A3 & A2 & A1 & A0;=20 > SCLH =3D FCD7 & !BnWR & D6 ;=20 > SCLL =3D FCD7 & !BnWR & !D6 ;=20 > SDAH =3D FCD7 & !BnWR & D7 ;=20 > SDAL =3D FCD7 & !BnWR & !D7 ;=20 >=20 > These are the outputs associated with SDA I/O:=20 > PIN 15 =3D D7 /* Data line 7 */=20 > PIN 18 =3D SDAOE /* SDA output control latch */=20 > PIN 19 =3D SDA /* SDA I/O pin */=20 >=20 > This is the equation for the SDA output control latch and sets the SDA ou=
tput Low when needed. This sections works just fine.=20
> SDAOE =3D SDAH /* Set high - write FCD7 with D7=3DH */=20 > # !SDAH & !SDAL & SDAOE /* Set low - write FCD7 with D7=3D0 */=20 > # !nRST ; /* Set high - on reset */=20 >=20 > This is the SDA output pin. Pulled high, externally, with a 4K7 resistor.=
Works as an output just fine.=20
> SDA.OE =3D !SDAOE ; /* Only on when 'LOW' output required */=20 > SDA =3D SDAOE ; /* Always low when output enabled */=20 >=20 > This is the problem pin.=20 > D7 =3D SDA ; /* SDA input transferred to D7 output on read of FCD7 */=20 > D7.OE =3D FCD7 & BnWR ;=20 >=20 > If I toggle the SDAOE latch I can read its state through D7 e.g. I can re=
ad SDA output, however, if I set the SDAOE latch High, ready for read of th= e SDA INPUT, I can't then read the input - I just read a High value on D7. = It seems that the path from the SDA pin through to the & array isn't there!= =20
>=20 > Anybody have any clues to what's going wrong? Thanks . . . Dave H.