Page 1 of 1

Having trouble interfacing LP CMOS to ZX40

Posted: 28 October 2006, 7:54 AM
by drapal
I read the app note, and I think I'm going to need a transistor switch to do this, but I'll ask the question anyway. I'd like to be able to just find the right pull-up value if that's possible.

What I have is an A6821 (http://www.allegromicro.com/datafile/6821.pdf) that I'm trying to read the serial output from. The datasheet doesn't indicate what the source/sink current is for the output (only that is low power CMOS), and with nothing connected to it, the voltmeter indicates that it's working properly. However, when I hook this up to the ZX40, if the pin is set to zxInputPullup, the read alwas reaturns a 1 (and the VM verifies that), so the 6821 clearly can't sink enough current. If I change the pin to zxInputTristate, it always reads 0 (can't source enough tto change the ZX input).

I'm pretty sure that I could put a transistor switch in and get it to work, but the board real estate is asking for only a pull-up resistor if possible. Any suggestions?

BTW, everything on the logic side is running at the std. 5V supply. The "drive" side of the 6821 is driving some 12V relays.

Having trouble interfacing LP CMOS to ZX40

Posted: 28 October 2006, 9:09 AM
by GTBecker
> ... only a pull-up resistor if possible...

The Allegro spec appears to indicate a normal CMOS data output, with
high >2.8v and low <0.3v with a 5v supply @ 200uA, the equivalent of a
~47k load. You should need no pullup on the ZX input pin but one
shouldn't affect the data, either.

I suspect something else is at fault.


Tom

Posted: 28 October 2006, 9:46 AM
by dkinzer
Which output from the chip are you trying to read? What instructions are you using to do so?

Followup

Posted: 28 October 2006, 14:22 PM
by drapal
I've tried both D.4 and a bit on Port C (don't recall exactly which one). To determine what was read, I've always used debug.print CStrHex(Register.PortD) (or PortC when I tried the other pin).

Eureka!

Posted: 28 October 2006, 14:27 PM
by drapal
Just for grins, I changed to use debug.print CStr(GetPin(D.4)) and it works. So what is wrong about using Register.PortD?

Re: Eureka!

Posted: 28 October 2006, 16:45 PM
by dkinzer
drapal wrote:So what is wrong about using Register.PortD?
There is nothing wrong with using Register.PortD for its intended purpose. It just doesn't do what you need.

Each I/O port has 3 associated registers, e.g.

Code: Select all

Register.DDRA
Register.PORTA
Register.PINA
The first is the "data direction register" that defines, for each bit of the I/O port, whether a pin is an input (0) or an output (1).

The second is the output latch. For each bit that is defined to be an output, the corresponding bit in Register.PortX specifies whether the output should be a zero or a one. For each bit that is defined to be an input, the corresponding bit in Register.PortX specifies whether the internal pullup resister should be enabled (1) or not (0). If you read Register.PortX, you get the value that was last written to it.

The third is the input register. Reading this register will give you the logic value that is present on each I/O pin of the port. Note, however, that this is only useful for bits that are defined to be inputs.

The GetPin() function first makes the pin an input (if it isn't already) and then gets the pin's value.