please help me...this is what i have done so far...

Status
Not open for further replies.

chesskin

New Member
I want to make a sound gen. connecting with a LCD module and several LEDs. It looks like a "electronic piano".. however, before compiling the program, i am vague in connecting the pins of all the components to the 8051 micro-controller.. please indicate me which parts i did badly..thank you!!

the LCD module, even i have the datasheet.. except Data bit 0~7, VCC and GND.. i dunno which pin(s) i should also connect.. can u teach me? thanks a lot !!!

Schematic Diagram:
**broken link removed**

here is the link of datasheet of the LCD module i m using..
https://www.electro-tech-online.com/custompdfs/2007/02/MSC-C204DYLY-1N.pdf
 
Your LCD controller is the KS0076B which is similar to the very common HD44780 so any program codes for HD44780 will also works OK with it.

Here is a link to some information. On the LCD, besides the data lines, which could be either 4 or 8 depending on which transfer mode you would like to use, one still need to connect RS line, E line and possibly the RW line.

Pay particular attention to pin3 of the LCD as it controls the contrast of the display. A LCD could be displaying some characters but one cannot see them if the contrast is turned down too low.

**broken link removed**
 
thanks eblc1388!!!

oh my god.. 8052.com is so great...!
thanks a lot!

and .. i also have a question on the amplifier.. referring to the datasheet,
for adjusting the gain, the pin7 is required to connect as a bypass..what does it mean of bypass???

i think i've solved the problem about the connection of LCD module to the 89C52... =]
 
chesskin said:
and .. i also have a question on the amplifier.. referring to the datasheet, for adjusting the gain, the pin7 is required to connect as a bypass..what does it mean of bypass???

There are two gain settings available on the LM386. They are 20 and 200. If one wants gain=200, one has to connect between pin1 & pin8 a 10uF capacitor and put another bypass capacitor from pin7 to ground. These extra components are not needed if one wants a gain of only 20.

In your case, a gain of 20 is plenty as LM386 is driven directly by the output of the MCU, in fact you might even need to add a volume control as the existing setup will overdrive the LM386 and causes distortion.

Another point about the keys input of your MCU. In older 8051 families, the ports are not truly bi-directional but one which has weak pull-up if configured as an output pin. Under this configuration, user is allow to pull down the port pin, via a key or external input, so that a read port instruction can read the port pin as LOW.

In your case, therefore you cannot pull high a port pin if it is LOW as you will destroy the port. If you have to pull them high, then you must set the port to output a HIGH, then pull them LOW again using fixed resistors. Pressing a key will force a HIGH to the pin but all this is not necessary if you can arrange the keys to pull low instead. You don't even needs the series resistors.

Please reads up more on this special port I/O requirement on the 8051.
 
here is my new schematic diagram:
**broken link removed**

thank you very much !!

it means the pin 1,7 and 8 of the LM386 needs no connection if i just want the gain = 20!?

could you tell or explain me more about the "bypass"?
is it important in the application of OP AMP?

now i parallel those resistors, which are near the switches, to the ground...
as referring to the 89C52 datasheet, it is found that only P0 is open drain.. so it requires pull-up resistors...i have added 4.7k resistors between the VCC and LEDs............

i m so sorry that i have so many questions... also, i wanna ask the pin of the LCD module... VDD connects +5V while VSS connects to the GND.. so VO connects to the GND too? the LCD module will output voltage?!!!

many thanks =]
 
chesskin said:
i m so sorry that i have so many questions... also, i wanna ask the pin of the LCD module... VDD connects +5V while VSS connects to the GND.. so VO connects to the GND too? the LCD module will output voltage?!!!

Can't help you on 8051, but you can check my PIC LCD tutorial hardware, which will show you how to connect the LCD.
 
chesskin said:
it means the pin 1,7 and 8 of the LM386 needs no connection if i just want the gain = 20!?

Yes.

chesskin said:
could you tell or explain me more about the "bypass"?
is it important in the application of OP AMP?

This is a difficult subject to explain in a few lines. One needs to know current in a particular branch of circuit would affects voltage on every part of the rest of circuit. Without bypassing, these changes will cause/trigger additional changes and eventually build up to oscillations and saturations. Bypassing means methods to reduce/suppress these changes to an acceptable level so they don't cause the circuit to oscillate or mal-function.

chesskin said:
now i parallel those resistors, which are near the switches, to the ground...

Is there a particular reason you want to pull HIGH the port pin instead of pulling them LOW?

chesskin said:
as referring to the 89C52 datasheet, it is found that only P0 is open drain.. so it requires pull-up resistors...i have added 4.7k resistors between the VCC and LEDs............

Watch out for the LED current to give sufficient brightness for the LED. 1mA via the 4K7 is usually too low in most case.

chesskin said:
i m so sorry that i have so many questions... also, i wanna ask the pin of the LCD module... VDD connects +5V while VSS connects to the GND.. so VO connects to the GND too? the LCD module will output voltage?!!!

No problem with questions. Usually the contrast pin of the LCD is connected to the wiper of a variable resistor trimmer VR of 10K to 20K. The other two ends of the variable resistor connect to +5V and GND. This way, one can adjust the contrast by varying the voltage between +5V and GND. Most often a direct 0V connection on contrast pin results in too dark a display.
 
thanks nigel goodwin and eblc1388

oops..! how to calculate the value of current through the LED?

V=IR
5V=(required mA)*(R)?

In order to maintain a sufficient birghtness for the LEDs.. often use 1k ohm resistor??

oh...it seems more flexible to connect VO by following your methods...!!

in this connection... if no one presses the key(s), P2 = 0H and once one presses all the keys, P2 = 0FFH?
 
Furthermore.. my friends' project is to make a mp3 player, they use PIC processor.. before i asked them why they dun use 8051, they told me that 8051 is much slower than PIC (really?!).. then i asked if i should use PIC in my project, they told that PIC is more complex.. they said 8051 is actually great as an instruction does many functions such as MOVX............

however, when i was still studying 8051... my friends said that nowadays, most electronic engineers use PIC and nearly no one would like to use 8051(REALLY?) my tutor also said 8051 is just built with a good structure and therefore they taught this processor in the lessons...
 

As a RISC processor the PIC is probably the easiest to learn?, hence it's huge popularity (only 35 instructions for a mid-range device) - but they are very fast and have plenty of extras built-in. The instruction set is optimised for low level operations, whereas the 8051 is really a micro-processor pretending to be a micro-controller - the PIC is fairly unusual, as it has bit-wise operators, where you can test or change individual bits without 'complex' logical operations.


They probably teach 8051 because they already have the old hardware for it, and the tutor knows how to teach it - moving to PIC's would require them buying new hardware and the tutor having to go out and learn something!.

It's fairly common in education to learn something old that you probably won't ever see again - but the point isn't to teach you something of specific use, but just to teach you an example that you can use to move to more modern devices.

If you're learning 8051 though, I would suggest moving to the Atmel AVR series, which are more like the 8051 - the PIC would be a move bigger 'jump' for you.
 
To calculate resistor for LED, one first need to know the voltage drops across a LED under a certain current. This current can not be larger than the current that the port pin on 89C51 can handle. Referring to the datasheet, max. current per port pin is 10mA but I would just go up to 8mA instead.

A common red LED would drops about 1.8V across itself at this current so the correct resistor to use is (5V - 1.8V)/8mA = 400 ohm and I will use 390 ohm or 420 ohm as 400 ohm is difficult to find. A blue LED or white LED would requires a drop of nearly 3V across itself so the resistor calculation will be different.

If you consider my method of pulling LOW a port pin using keys, then you can also connect the LEDs to the same port pin and they will lights if key is pressed. In your existing arrangement, you have to read the key, then control the LEDs by controlling the port while my suggestion enable you to "kill two birds with one stone".

Do tell us whether you have the MCU 89C51 chip available and programming hardware for you to use. 8051 family is still on the menu of many academic courses and if one can fully grasp the essence of programming, switching over to any other more modern MCUs would be easy.

Your friends are not kind to you by not explaining fully to you clearly about the differences of different MCU families.
 
Pulling low means a pin connects to the ground through a key?!
Since connecting to the GND, once pressed a key, the pin turns LOW, however, my question is here that I am afraid the value of the pin is unknown(or i dunno)when one relaxes the key...

what will the value be?

I phoned a friend and he doubted me whether 5V is enough to my circuit since i connect so many components..... he mentioned that 8051 sense a 1(high) by detecting if there is a 5V.....

He also had your question that why i dun connect both LEDs and switches together... ^__^" because i want to provide different modes and let the player select themselves.. for example, the LEDs will flash in a squence when they are pressing the keys.

Just i asked my friends... he said the 7805 regulator is not necessary.. as there are some rechargeable batteries which are near 1.25V... and then he asked me to put them in series to become a +5V supply... he said that regulator wastes power....should i hear him?

My English is very bad... there might be some misunderstanding....=]

THANKS!
 

The logic level is well defined.

The port pin level is normally high when no key is pressed. If a key is pressed it will connect the port pin to GND via the key, then the port pin level becomes LOW. When one releases the key, it will goes high again.

Check the 89C51 datasheet for the supply voltage range that the MCU is happy (5V+/-20%) and confirm that your batteries can meet the requirement.
 
**broken link removed**

my new design ... the 220 ohm resistor can protect the chip...will this be better than before one?
 
It's normal to do it the other way round, with the resistor to Vdd and the switch to Vss - then you don't need the 220 ohm (which is rather small in any case). The resistor pulls the pin normally high, and the switch makes it go low when pressed.
 
Thanks a lot!
**broken link removed**
i m now start to solder...if there is no more big problem in the circuit...
and start programming! =]
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…