We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello I,m saha working with at89c51.I'm new in the field and dont know much about that.I want to get digitized data from sensor but instesd getting data in the form of digit i get in following formate ðÿüÎþüÿüüüþÿüüøÿüÿðþüà ðÿþÿøþþÿþþ øÿøÿûþÿþþþÿÿ ðþüðüþÿà ÿþþÿæþøüþà øüþüÿþà þþÿlÿüÿøÈþþà þþÿ¬ .can any body tell me what's the matter. is any conversion is required from the hex code?. thanks in advance
You forgot to post the code that retrieves the sensor data, and the code that prints the sensor data.
Note that most sensors produces binary data, so you can't just send the measurements to the serial port. You have to convert them to readable text - for example with printf().
unsigned v = adc_data_register; printf("value = %u\n",v);
Not necessarily - provided whatever is on the other end of the serial link understands the binary data and that the entire link is fully transparent to binary data (eg, no software flow control)...
Correct - M2M communication is normally binary. But presentation requires conversion to ASCII, UTF8 or similar since not too many humans can decode raw binary data, and most presentation systems have gaps in their presentation logic resulting in loss of information.
Thanks for reply and suggesting me.I also make a simple program to get yes word from the controller but it give the same result as in sensor program.my code of this prog. Is
#include<reg51.h> void se(unsigned char) ; void ms(unsigned int value) ; void main(void) { unsigned char z; TMOD=0x20; TH1=0xFA; SCON=0x50; TR1=1; for(z=0;;z++) { se('Y'); ms(255); se('E'); ms(255); se('S'); ms(255); se(' '); } } void se(unsigned char x) { SBUF=x; while(TI==0); TI=0; } void ms(unsigned int value) { unsigned char x,y; for(x=0;x<value;x++); for(y=0;y<255;y++); }
And my code for sensor data is as follows
#include<reg51.h> void con(unsigned char value); void ms(unsigned int value); void se(unsigned char) ; sbit ALE=P3^6; sbit OE=P3^5; sbit SC=P3^3; sbit EOC=P3^4; sbit ADDR_A=P1^0; sbit ADDR_B=P1^1; sbit ADDR_C=P1^2; main() { unsigned char v; TMOD=0x20; TH1=0xFA; SCON=0x50; TR1=1; //MYDATA=0xFF; P2=0xFF; EOC=1; ALE=0; OE=0; SC=0; while(1) { ADDR_C=0; ADDR_B=0; ADDR_A=1; ms(1); SC=1; ms(1); ALE=0; SC=0; while(EOC==1); while(EOC==0); OE=1; ms(1); v=P2; OE=0; con(v); } } void ms(unsigned int value) { unsigned char x,y; for(x=0;x<value;x++); for(y=0;y<255;y++); } void con(unsigned char value) { unsigned char x,d1,d2,d3; x=value/10; d1=value%10; d2=x%10; d3=x/10; se(d1); ms(255); se(d2); ms(255); se(d3); ms(255); } void se(unsigned char x) { SBUF=x; while(TI==0); TI=0; }
can u tell me the problem in my code.again thank u.
"can u tell me the problem in my code.again thank u."
No. I can just barely tell that this looks similar to C - most possibly from the obfuscated-C contest. Didn't you read the posting instructions for source code? Look two lines above the input box where you write your posts.
And for best result, you should indent your source with spaces instead of tab characters.
no i did not read the posting instruction.no problem in my software but the incompatibility of the baurd rate.now it's working well.thanks to give attention to my problem and sorry for late reply.