Discussion in "Project Help" started by    neil03    Feb 6, 2009.
Fri Feb 06 2009, 10:13 pm
#1
Hi I have a problem here about the c code of the program of the tachometer.
I've found a circuit of a tachometer along with a schematic diagram and its C code, etc.
well my problem is on the schematic he used an at89c52 microcontroller, now I want to replace it with a at89c2051. In the C code I want to replace the output pins that he used so that it will be compatible for my at89c2051 but I cant understand the program where he declares the output pins and ports for LCD display, switches etc. please help me to specify where he declares those pins so I can change it for my at89c2051..thank you..

the C code is attached along with the schematic of the circuit..please help me thanks





[ Edited Fri Feb 06 2009, 10:13 pm ]
Fri Feb 06 2009, 10:19 pm
#2
Forgot to attach the C code. this is the C code of the program


Attachment


please help me thanks..


[ Edited Fri Feb 06 2009, 10:21 pm ]
Sat Feb 07 2009, 07:02 pm
#3
ena(){
P2_7 = 1;
delay (5);
P2_7 = 0;
}

ini_lcd(){
P1_1 = 0;	 
P2_7 = 0; //transfering instructions
P2_6 = 0;
P0 = 56;  //function set
ena();
P0 = 56;  //function set
ena();
P0 = 12; // display on, cursor on, blink on
ena();
P0 = 1;	  //clr display
ena(); 
P0 = 6;	//entry mode set
ena();
//enable on 2_6
//RS on 2_7
P2_6 = 1;   // ready to transfere diplay data
}

locate(pos){
P2_6 = 0; //transfering instructions
P0 = pos; // change DDRAM adress
ena(); 	
P2_6 = 1;   // ready to transfere diplay data
}


The 'P0' , 'P2_6' , 'P2_7' etc you find in the code need to be changed to the new pin numbers.Do this for every occurence of the particular pin/port no.

Ports used.............................Replace with
P0......................................... P1
P3.3...................................... P3.3 (remains same)
P3.4...................................... P3.4 (same)
P2.0...................................... P3.0
P2.6...................................... P3.1
P2.7...................................... P3.2
 neil03 like this.
Sun Feb 08 2009, 12:41 pm
#4
ei sashijoseph thank you for the reply.

but im having doubt about the pin1.1 could I place it on pin3.7 of the at89c2051. In that schematic all of the pins 0's are used for the LCD display, now in the C code he didn't mention or declare any P0_1, P0_2 etc. just P0. why is it like that? Does the C code is designed to find the output of the LCD only in P0's??

On your example you didn't mention the P1_1. well if I would not replace it and stay it as it is. dont you think it will not affect the output of the LCD display? because you place P0 to P1. well if im right about what i said above that the c code is designed to find the output of the LCD in P0's, now if I will replace it with P1 on the at89c2051. all of the output for the LCD will be on P1.0 to P1.7 in the at89c2051 and it will affect the P1_1 if i would not replace it and stay it as the same. Now the configurations that I did is like this can anyone tell me if anything is wrong with this configuration.

ports used in at89c52..............replace ports (at89c2051)

P0.0---------------------------------------> P1
P1.1---------------------------------------> P3.7
P2.0---------------------------------------> P3.0
P2.6---------------------------------------> P3.1
P2.7---------------------------------------> P3.2
P3.3---------------------------------------> P3.3
P3.4---------------------------------------> P3.4

thanks you so much for the reply and again please help me thanks..
Sun Feb 08 2009, 02:24 pm
#5
You may use P3.7 in place of P1.1

The P1 of 89c2051 will be used for the lcd's data lines.

In the original code P0 is used in whole as a 8bit port,not as individual lines.That's why you don't see any bitwise use of P0 ie P0_1,P0_2 etc.
 neil03 like this.
Sun Feb 08 2009, 10:53 pm
#6
ahh i see now i understand thank you so much sashijoseph:-)

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

ChrisLub
Tue Apr 23 2024, 05:21 pm
Davidbab
Tue Apr 23 2024, 10:41 am
Richardrit
Tue Apr 23 2024, 09:54 am
HenryLaf
Mon Apr 22 2024, 03:50 pm
bleradrar
Mon Apr 22 2024, 06:38 am
ppu-pro_ka
Sun Apr 21 2024, 07:39 pm
Infewow
Sun Apr 21 2024, 06:30 pm
HumanTak
Sun Apr 21 2024, 12:26 pm