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!
I'm not going to make comments on the overall functionality, but breaks in the switch statement are surely going to be necessary.
You'll get an interrupt when a single character is received, but you will potentially read SBUF into six variables. Are you expecting to receive up to six successive characters? or are you expecting to set all six variables to the same value?
I'll leave you to consider it.