|
|
| Author |
Message |
drapal
Joined: 24 Jan 2006
Posts: 25
Location: Denver
|
|
Posted: 28 October 2006, 14:54 PM Post subject: Having trouble interfacing LP CMOS to ZX40 |
|
|
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. |
|
| Back to top |
|
 |
GTBecker
Joined: 18 Jan 2006
Posts: 457
Location: Cape Coral
|
|
Posted: 28 October 2006, 16:09 PM Post subject: Having trouble interfacing LP CMOS to ZX40 |
|
|
> ... 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 |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 28 October 2006, 16:46 PM Post subject: |
|
|
| Which output from the chip are you trying to read? What instructions are you using to do so? |
|
| Back to top |
|
 |
drapal
Joined: 24 Jan 2006
Posts: 25
Location: Denver
|
|
Posted: 28 October 2006, 21:22 PM Post subject: Followup |
|
|
| 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). |
|
| Back to top |
|
 |
drapal
Joined: 24 Jan 2006
Posts: 25
Location: Denver
|
|
Posted: 28 October 2006, 21:27 PM Post subject: Eureka! |
|
|
| Just for grins, I changed to use debug.print CStr(GetPin(D.4)) and it works. So what is wrong about using Register.PortD? |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR
|
|
Posted: 28 October 2006, 23:45 PM Post subject: Re: Eureka! |
|
|
| 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: | 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. |
|
| Back to top |
|
 |
|