??? 01/11/07 18:02 Read: times |
#130675 - Which ports you use doesn't matter ... Responding to: ???'s previous message |
Ralph Sac said:
Richard Erlacher said:
Ralph,
Whether you use an external memory interface, as was done on the 8031 in your schematic, or create the signals with port-mapped I/O, which is your only option with the MCU you've chosen, the only thing you have to do with any sort of care at all, is to ensure that the 'E' strobe is long enough to satisfy the requirement of your LCD's controller IC (consult the datasheet for this information). With port I/O, you set the bits into the state that your action requires, set the data on the port on a write, raise 'E' for the appropriate period of time, then lower it, or, on a read, set the bits into the state that your action requires, raise 'E', read the data port, then lower 'E' after the appropriate amount of time, including, of course, the time consumed by the data read. The memory-mapped version made this seem simple because it was on a relatively slow 12-clocker, the external bus cycle of which was always adequately long to cause a sufficiently long 'E' strobe. An access to the external LCD was simply a MOVX instruction. Communicating with an LCD is not "rocket science." I've never seen anything on "Circuit Cellar" (not that I've looked much in the last 20 years) that qualifies as rocket science. Of the few things I've seen there, not all of them work as advertised. This one is so simple, it probably does, however. One thing you might want to do differently, however, is take the upper and lower terminals of the 20K-ohm potentiometer to Vcc and the V- terminal of the MAX-232 through a 1 k-ohm resistor, in order to ensure you have a negative contrast control voltage (LCD pin 3) available if your LCD needs it. Those resistors will prevent damage, however unlikely it may be. Not all LCD's are "happy" with a bias voltage at GND or higher. As for using the code that you acquired from Circuit Cellar, or wherever, if you write a simple routine for Read, that does what I described, and, likewise, one for a Write, then you can substitute a call to each (or drop them in as a macro if you like) for the MOVX instructions that the indicated circuit probably uses. RE Hi Richard: So you want me subsitute Calls for Movx instructions where they come up in Tims program. Don't I have also change the port assignments because I use ports 1 and port 3 on the 89c4051 mcu. And the 80c31 does not in tester? Best regards, Ralph Sac P.S. As far as the schematic I read the correct way post it on the 8052.com website. Ralph, I don't care how you do this, but, you do have to recognize that you have to comprehend what the external-memory-based (memory mapped) circuit does, and then do that in port-mapped mode. In the memory-mapped application, you use external circuitry to generate the strobes, e.g. the 'E' strobe that was subject of your original query. In port-mapped mode, for example, you set the RS bit as needed, you set the R/W bit as needed, and then you do what makes the I/O happen, as I prefiously indicated. Which ports you use doesn't matter at all. If you use port 0, you'll need pullup resistors in order to meet the LCD's input voltage requirements. The point of my earlier post was that you have to know what the purportedly working circuit you're copying does, regardless of how you emulate its functions. If you fail to do that, you're on your own and in uncharted waters. RE |