Digital Alarm Clock in C
Wed Feb 21 2007, 11:16 pm
Rickey.
I have some good news and some not so good news; I have found out that the LCD is not fried and does work just fine, also that the program included in the HEX file is functioning because I am able to hear the buzzer go on/off and can be set with the switches. The downside I found out is that on my 8951 there are apparently predefined pins for each function, so what I was able to figure out is how to match the corrected pins up to the LCD.
[/html]
I have some good news and some not so good news; I have found out that the LCD is not fried and does work just fine, also that the program included in the HEX file is functioning because I am able to hear the buzzer go on/off and can be set with the switches. The downside I found out is that on my 8951 there are apparently predefined pins for each function, so what I was able to figure out is how to match the corrected pins up to the LCD.
I took your advice and created a simple display code and ran it, I think you’ll like the outcome , and found that the pin corrections worked. Now my question to you is in the HEX file can I reset the LCD pin connections to the following changes:
ÂLCD | 8051 |
Vss | Vee |
VDD | VCC |
VD | Ground |
RS | P0.0 |
R/W | P0.1 |
E | P0.2 |
DB4 | P0.4 |
DB5 | P0.5 |
DB6 | P0.6 |
DB7 | P0.7 |
-JoshG
[/html]
Thu Feb 22 2007, 12:24 am
Yes it is possible to do that.. but! its hard!
you need to change the opcodes wherever LCD is using P2
change it to P0. thats why i said.. hard
as the program is in C so.. that makes it more hard why don't you use P2?
And also you have to change the D7 from P2.7 to P0.7 lot of changes.. and hard to find in big hex file..
you need to change the opcodes wherever LCD is using P2
change it to P0. thats why i said.. hard
as the program is in C so.. that makes it more hard why don't you use P2?
And also you have to change the D7 from P2.7 to P0.7 lot of changes.. and hard to find in big hex file..
Thu Feb 22 2007, 01:46 am
Ok so how about if I were to rewire it so that if follows this pattern to try to follow the existing code in the HEX file?
LCD | 8051 | P2 |
Vss | Vee | Same |
VDD | VCC | Same |
VD | Ground | Same |
RS | P0.0 | P3.7 |
R/W | P0.1 | P3.6 |
E | P0.2 | P3.5 |
DB4 | P0.4 | P2.4 |
DB5 | P0.5 | P2.5 |
DB6 | P0.6 | P2.6 |
DB7 | P0.7 | P2.7 |
-JoshG
Thu Feb 22 2007, 01:59 am
I told you this way or that way! its the same. Its as hard as the previous one.
you need to interchange the address where the data is suppose to move.. i mean!
like 0xA0(P2) to 0x80(P1) as you wanted. but the thing is what if 0x80 comes in data so you gonna ruin the program.. and moreover if you are directly editing the .hex file then you need to calculate the checksum of each line and then put a new one. its a tough job. but its easy if you edit in a buffer or uploader program.
Still i wont recommend you do this rest is your wish!
your previous idea of changing P2 to P0 is much simpler than the one you just gave
you need to interchange the address where the data is suppose to move.. i mean!
like 0xA0(P2) to 0x80(P1) as you wanted. but the thing is what if 0x80 comes in data so you gonna ruin the program.. and moreover if you are directly editing the .hex file then you need to calculate the checksum of each line and then put a new one. its a tough job. but its easy if you edit in a buffer or uploader program.
Still i wont recommend you do this rest is your wish!
your previous idea of changing P2 to P0 is much simpler than the one you just gave
Thu Feb 22 2007, 08:08 am
Well ok if it is that complicated then I'll just try and stick with your original pin assignments; however could you tell me if I’m going in the right direction for these pin assignments and if possible where would I be able to attach Pin 4 on my LCD?
Mine | |||
LCD | 8051 | ||
Pin 1 | Vss | 0V | Ground |
Pin 2 | VDD | +5V | 5V |
Pin 3 | VD | - | 1K Resistor |
Pin 4 | RS | Low: Instruction code input | ? |
High: Data input | ? | ||
Pin 5 | R/W | Low: Data Write | P3.6 |
High: Data Read | P3.7 | ||
Pin 6 | E | Enable signal | P3.5 |
Pin 7 | DB0 | Data bus lines When interface is 4bits long Data is on DB4-DB7 When interface is 8bits longData is on DB0-DB7 | P2.0 |
Pin 8 | DB1 | P2.1 | |
Pin 9 | DB2 | P2.2 | |
Pin 10 | DB3 | P2.3 | |
Pin 11 | DB4 | P2.4 | |
Pin 12 | DB5 | P2.5 | |
Pin 13 | DB6 | P2.6 | |
Pin 14 | DB7 | P2.7 |
Yours | |
LCD | 8051 |
Pin 1 | Ground |
Pin 2 | 5V |
Pin 3 | 1K Resistor |
Pin 4 | P3.7/RD |
Pin 5 | P3.6/WR |
Pin 6 | P3.5/T1 |
Pin 7 | P2.0/A8 |
Pin 8 | P2.1/A9 |
Pin 9 | P2.2/A10 |
Pin 10 | P2.3/A11 |
Pin 11 | P2.4/A12 |
Pin 12 | P2.5/A13 |
Pin 13 | P2.6/A14 |
Pin 14 | P2.7/A15 |
Pin 15 | 5V |
Pin 16 | Ground |
-JoshG
Thu Feb 22 2007, 08:12 am
Sorry about the format issues above
In a text document put in a zip because .rtf not allowed
In a text document put in a zip because .rtf not allowed
Thu Feb 22 2007, 12:41 pm
Please dont use your configuration. I am controlling RS and RW pins of LCD with P3.7 and P3.6 there is no different pin for reading and writing.
Do not confuse yourself. Simply follow the schematic as described. and make the connections. It will work.
You cannot use your configuration, because you cannot edit the hex file!! Hope you understood..
Do not confuse yourself. Simply follow the schematic as described. and make the connections. It will work.
You cannot use your configuration, because you cannot edit the hex file!! Hope you understood..
Thu Feb 22 2007, 06:25 pm
Oh ok that was where I was confused because when I was reading my 8951 manual and looking at P3.6 and P3.7 their used for External data memory write/read strobe so I figured that since apparently on my LCD the write/read functions were just on pin 5 that both pins on the 8951 must be tied together I’ll change my circuit as shown in the attached ZIP
-JoshG
Thu Feb 22 2007, 07:56 pm
Please don't take me wrong.. I am little short tempered
so.. please accept this.. you don't know what you are talking about..
Do you really know about LCD?
Please consult a book and study LCD properly.
i tell you about LCD in brief
----------------------------------
LCD has three portion of hardware connectivity
First:
Power and Contrast
Second:
Control Pins
Third:
Data Pins
Power and Contrast Pins: For powering the LCD and changing contrast. Contrast pin sometimes work with -ve voltage for some of the LCDs.
Data Pins: For sending Data to the LCD. The seventh data pin of LCD i.e. D7 is used as busy flag for checking the status of LCD.
Control Pins: There are three control pins in an LCD.
a) Register Select (RS)
b) Read/Write (RW)
c) Enable (EN)
a) RS: the pin RS is used to select register. either data or command register.
if RS = 1 » Data Register
RS = 0 » Command Register
b) RW: This pin is used for selecting the operation of LCD, either read/write.
if RW = 0 » Write
RW = 1 » Read
c) EN: To enable the LCD. usually a high means enable.
-----------------------------
So now we conclude that.. there is only one pin needed for RW and one pin for RS.. not two pins.. i hope you understood.
so.. please accept this.. you don't know what you are talking about..
Do you really know about LCD?
Please consult a book and study LCD properly.
i tell you about LCD in brief
----------------------------------
LCD has three portion of hardware connectivity
First:
Power and Contrast
Second:
Control Pins
Third:
Data Pins
Power and Contrast Pins: For powering the LCD and changing contrast. Contrast pin sometimes work with -ve voltage for some of the LCDs.
Data Pins: For sending Data to the LCD. The seventh data pin of LCD i.e. D7 is used as busy flag for checking the status of LCD.
Control Pins: There are three control pins in an LCD.
a) Register Select (RS)
b) Read/Write (RW)
c) Enable (EN)
a) RS: the pin RS is used to select register. either data or command register.
if RS = 1 » Data Register
RS = 0 » Command Register
b) RW: This pin is used for selecting the operation of LCD, either read/write.
if RW = 0 » Write
RW = 1 » Read
c) EN: To enable the LCD. usually a high means enable.
-----------------------------
So now we conclude that.. there is only one pin needed for RW and one pin for RS.. not two pins.. i hope you understood.
Fri Feb 23 2007, 10:33 am
Don’t worry about it I’m not the best tempered individual myself I’m just trying to figure this out but this is the first time I’ve added an LCD display myself I usually use a driver board and not my 8051. So getting back I have re-read my LCD and 8051 manual trying to best match the pins up and I believe I have finally got the correct configuration:
Â
LCD | Function | Explained | 8051 Connection | Explained |
Pin 1 | Vss | 0V | Ground | Ground! |
Pin 2 | VDD | +5V | 5V | Power |
Pin 3 | VD | - | 1K Resistor | 1k to GND |
Pin 4 | RS | Low: Instruction code input | P3.7 | RD |
Pin 4 | RS | High: Data input | P3.7 | RD |
Pin 5 | R/W | Low: Data Write | P3.6 | WR |
Pin 5 | R/W | High: Data Read | P3.6 | WR |
Pin 6 | E | Enable signal | P3.5 | T1(timer) |
Pin 7 | DB0 | Data Bus Line* | P2.0 | Data 1 |
Pin 8 | DB1 | Data Bus Line* | P2.1 | Data 2 |
Pin 9 | DB2 | Data Bus Line* | P2.2 | Data 3 |
Pin 10 | DB3 | Data Bus Line* | P2.3 | Data 4 |
Pin 11 | DB4 | Data Bus Line** | P2.4 | Data 5 |
Pin 12 | DB5 | Data Bus Line** | P2.5 | Data 6 |
Pin 13 | DB6 | Data Bus Line** | P2.6 | Data 7 |
Pin 14 | DB7 | Data Bus Line** | P2.7 | Data 8 |
**When interface is 4bits long Data is on DB4-DB7
*When interface is 8bits long Data is on DB0-DB7
ÂWhat do you think?
Â-JoshG
Powered by e107 Forum System