hi sir i need one help now iam doing project on 89c51 using C51 Evaluation Software i converted 0-5 analog volatge to 0-5 digital voltage . now i want convert digital data to pressure my output should be like this 0v 1.1E-1 3v 4.1E-4 0.1 1.2E-1 4v 5.1E-5 1v 2.1E-2 5v 6.1E-6 2v 3.1E-3 i want 500 values in between 0 to 5 volts how to calibrate the voltage interms of preesure what logic i want use to convert Voltage to pressure my C51 not taking floting oparations please help regards chandra sri
thank you sir i tried this program but iam getting one error #include<stdio.h> #include<reg51.h> #include <string.h> void main() { unsigned int voltage; char pressure_string[2] ={"1.1E-1","1.2E-1","1.3E-1"}; voltage=0x0A; /*10mv*/ SCON = 0x50; TMOD |= 0x20; TH1 = 221; TR1 = 1; TI = 1; printf( "Voltage %u mV = Pressuse %s", voltage*10, pressure_string[voltage] ); } iam getting this error compiling forum.c... MAIN\FORUM.C(8): error C243: 'array[]': string out of bounds main\forum.c - 1 Error(s), 0 Warning(s). sir how much memory well take for 500 values of the look up table regards chandu
sir char pressure_string[] ={"1.1E-1","1.2E-1","1.3E-1"};
"how much memory well take for 500 values of the look up table" Keil C51 does not add any extra space for padding or alignment; therefore the size of an array is simply the size of one element multiplied by the number of elements in the array. The sizes of the data types used by C51 are listed in the Manual: http://www.keil.com/support/man/docs/c51/c51_ap_datastorage.htm You need to become familiar with the Manual - that doesn't mean you have to learn it by heart, but you need to be familiar with what's in it, and how to find stuff in it... You probably also need a good 'C' textbook...