Help on tachometer C code
Discussion in "Project Help" started by neil03 Feb 6, 2009.
Fri Feb 06 2009, 10:13 pm
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
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
Forgot to attach the C code. this is the C code of the program
please help me thanks..
please help me thanks..
[ Edited Fri Feb 06 2009, 10:21 pm ]
Sat Feb 07 2009, 07:02 pm
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
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..
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..
Powered by e107 Forum System