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.
i'm using c51. i get an error"not in formal parameter list" and cannot find a way to solve it,so i'm here to ask for ur help,please. Here is my code: #include <stdio.h> #include <absacc.h> #include <reg51.h> #define uchar unsigned char void serial() interrupt 4 using 1 uchar time[6],date[6]; uchar latitude[9],longitude[9]; uchar semisphere_f,semisphere_s; uchar input_data="GPRMC"; uchar data_in; int numbercomma; bit flag; if(SBUF==0x24) { if(SBUF==input_data) { flag=1; numbercomma=0; } else flag=0; } if(flag==1) { if(SBUF==0x2c) { numbercomma++; } }
if(numbercomma==2) { data_in=SBUF; } if (data_in=A) { swith(numbercomma) { case 1:time[6]=SBUF; case 3:latitude[9]=SBUF; case 4:semisphere_f=SBUF; case 5:longitude[9]=BUF; case 6:semisphere_s=SBUF; case 9:date[6]=SBUF; default:;break; } }
main() { TMOD=0x21; TH1=0xfa; TL1=0xfa; SCON=0x50; ES=1; EA=1; } Thank you!
Thanks for ur help,it is so important.it's my first time posting message here, i didn't notice that note,sorry for the inconvenience.i will remember it the next time.
"case 1:time[6]=SBUF;"
Note that besides the missing breaks, SBUF contains a single character. It loos from your code like you think that you are assigning six characters to time array. You are not. You are only assigning to the index 6 (the seven'th position in the array).
But time[] only contains 6 entries, accessible as index 0 to 5.
And who assigns values to time[0], time[1], time[2], time[3], time[4] and time[5]? Are you happy with having these positions constantly zero-filled from the memory clear on startup?