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.
Compiling Error C:141 syntax error near 'void'
Please help me to compile this file. Need to create a Hex code of it finally. Also it seems a bigger fie and cannot be compiled with free versin ??? help me converting to hex code
/* Automated tap n flush system code- */ #include <regx51.h> #define MAXLINE 250 /* ----------------------- led on/off -------------------------------- */ #define l1_on P3_0 = 0 #define l1_off P3_0 = 1 #define l2_on P1_1 = 0 #define l2_off P1_1 = 1 #define IR_on P3_1 = 0; P3_2 = 0 #define IR_off P3_1 = 1; P3_2 = 1 /*-------------------- solenoid on/off ------------------------------*/ #define solenoid_on P3_0 = 0 #define solenoid_off P3_0 = 1 /*------------------- assign pins to switches -----------------------*/ #define sw1 |P1_7 #define sw2 |P1_6 #define sw3 |P1_5 #define sw4 |P1_4 #define sw5 |P1_3 #define sw6 |P1_2 #define sw7 |P3_4 #define sw8 |P3_5 #define sensor |P3_3 /*------------------- global status variables -----------------------*/ volatile char sensor_delay = 0; /* sensor detect hysterisis delay */ volatile char solenoid_delay = 0; /* solenoid start delay */ volatile char solenoid_duration = 0; /* solenoid duration */ volatile char start_mode = 0; /* '0' means solenoid starts after sensor gaining detection, '1' means after sensor losing detection */ volatile char stop_mode= 0; /* '0' means solenoid duration counts from its start, '1' means counts after sensor losing detection */ /* ------------------- delay options in seconds ---------------------- */ volatile char sensor_delay_s[] = {1,3,5,7}; /* sensor detect hysterisis delay */ volatile char solenoid_delay_s[] = {1,2,3,5}; /* solenoid start delay */ volatile char solenoid_duration_s[] = {1,5,8,10}; /* solenoid duration ----------------- 'x'seconds delay function ----------------------- */ void delay_s(char x) { char y; /* temporary variable */
TR0 = 1; /* start the timer */ while(x) /* loops for 'x' seconds */ {y = 0x64; /* loops 100 times */ while(y) /* loops for approx 'x/100' secs */ {if(TF0) /* check timer overflow */ {y--; TF0 = 0; /* reset overflow flag */ } x--; /* reduce number of seconds to go */ } TR0 = 0;TL0 = 0;TH0 = 0;TF0 = 0; /* stop & reset the timer */ } /*---------------- 'x/10'seconds delay function --------------------- */ void delay_ss(char x) { char y; // temporary variable TR0 = 1; // start the timer while(x) // loops for 'x/10' seconds { y = 0x0A; // loops 10 times while(y) /* loops for approx 'x/100' secs */ { if(TF0) /* check timer overflow */ { y--; TF0 = 0; /* reset overflow flag */ } } x--; /* reduce number of seconds to go */ } TR0 = 0;TL0 = 0;TH0 = 0;TF0 = 0; /* stop & reset the timer */ } /*------------------- sensor detect function ------------------------ */ void check_sensor_detect() { char x,y; /* temporary variables */ TMOD = T1_M1; /* set timer mode */ TL1 = 256-12; /* set timer frequency to 76.8kHz making IR led frequency as 38.4kHz at 50% duty cycle */ TR1 = 1; /* start the timer */
x = sensor_delay_s[sensor_delay]; y = 0; while(x+1) /* loops till 'x+1' consecutive detects */ { if(TF1) /* check timer overflow */ { TR1 = 0; /* stop the timer */ TF1 = 0; /* reset overflow flag */ TL1 = 256-12; /* reset timer frequency */ if(y<60) /* run IR led at 38kHz in bursts of 30 cycles once every second */ { TR1 = 1; /* start timer */
if(P3_1) { IR_on; } else { IR_off; } if(y==40) /* check sensor at end of 20 cycles */ { if(P3_3) { l2_on; x--; } else { l2_off; x = sensor_delay_s[sensor_delay]; } } y++; } else { y = 0; if (x == sensor_delay_s[sensor_delay]) {l2_on; delay_ss(1); l2_off; } delay_s(1); TR1=1; } } } TR1 = 0; /* stop the timer */ l2_off; x=3; while(x) /* blinking of led 3 times to denote sensor detect */ { l2_on; delay_ss(1); l2_off; delay_ss(1); x--; } } /* ------------------- sensor release function ------------------------ */ void check_sensor_release() { char x,y; /* temporary variables */ TMOD = T1_M1; /* set timer mode */ TL1 = 256-12; /* set timer frequency to 76.8kHz making IR led frequency as 38.4kHz at 50% duty cycle */ TR1 = 1; /* start the timer */ x = sensor_delay_s[sensor_delay]; y = 0;
while(x+1) /* loops till 'x+1' consecutive detects */ { if(TF1) /* check timer overflow */ { TR1 = 0; /* stop the timer */ TF1 = 0; /* reset overflow flag */ TL1 = 256-12; /* reset timer frequency */
if(y<60) { TR1 = 1; /* start timer */ if(P3_1) { IR_on; } else { IR_off; } if(y==40) { if(sensor) { l2_off; x--; } else { l2_on; x = sensor_delay_s[sensor_delay]; } }
y++; } else { y = 0; if (x == sensor_delay_s[sensor_delay]) {l2_off; delay_ss(1); l2_on; } delay_s(1); TR1=1; } } } TR1 = 0; /* stop the timer */ l2_off;
x=3; while(x) /* blinking of led 3 times to denote sensor release */ { l2_on; delay_ss(1); l2_off; delay_ss(1); x--; } } /* ---------------------- main function ------------------------------ */ void main (void) { char x=4; /* temporary variable */ P1 = 0xFF; /* set all pins of port 1 */ P3 = 0xFF; /* set all pins of port 3 */ delay_s(2); } while(x) /* startup blinking of led x times */ { l2_on; delay_ss(1); l2_off; delay_ss(1); x--; } while(1) /* infinite loop */ { /* setting configuration from switch positions */ if(sw1) sensor_delay = 1; if(sw2) sensor_delay = 1<<1;
if(sw3) solenoid_delay = 1; if(sw4) solenoid_delay = 1<<1;
if(sw5) solenoid_duration = 1; if(sw6) solenoid_duration = 1<<1;
if(sw7) start_mode = 1; else start_mode = 0;
if(sw8) stop_mode = 1; else stop_mode = 0;
delay_s(2); x = 5; } while(x) /* blinking of led 5 times to denote configuration complete */ { l2_on; delay_ss(1); l2_off; delay_ss(1); x--; } delay_s(1); check_sensor_detect(); if(start_mode) check_sensor_release(); delay_s(solenoid_delay_s[solenoid_delay]); solenoid_on; if(stop_mode) check_sensor_release(); delay_s(solenoid_duration_s[solenoid_duration]); solenoid_off; x = 20; sensor_delay = 0; solenoid_delay = 0; solenoid_duration = 0; start_mode = 0; stop_mode = 0; } }
hey chum. some cracking code there. here is some hex code for you.
:020000040000FA :100D0000FFFFFF23FFFFFFFFCRACKINGFFFFFFFFF3 :103F6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF61 :103F7000FFFFFFFF78FFFFFFFFFFFFFFCODEFFFF51 :103F8000FFFFFFFF5FFFFFFFFFFFFFFFFFFFFFFF41 :103F9000FFFFFFFFFFFFFRUBBISHFFFFFFFFFFFF31 :103FA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF21 :00000001FF
@p take,
What's wrong with you man? Give the guy some _real_ binary stuff !
þÿÿêþÿÿêþÿÿê˜.Ÿåª. ãU ã$0 ã.0€å.0 ã.0€å..€å. €å.0.å.;.âüÿÿ..0 ã.0€å..€å. €å\.Ÿå.. ã..€å.. ã..€åL.ŸåÛð!ã.Ð á..@â×ð!ã.Ð á..@âÑð!ã.Ð á..@âÒð!ã.Ð á€.@âÓð!ã.Ð á..@â.ð!ã..Ÿå.ÿ/á€À.à.À.à€..@.....Пå$..ë...@.ð á.. ã...ê..€âp.Ÿå..Páûÿÿº.ÿ/á.à-åÿ. ã\.Ÿå...å...ê.( ã...êH.Ÿå. €åîÿÿë<.Ÿå. €å‚ á..Rã÷ÿÿ:.% ã...ê .Ÿå. €åäÿÿë..Ÿå. €å¢ á..Rã÷ÿÿŠêÿÿê@B...€.à$@Ÿå$PŸå
Interesting word!
Should, of course, be "instructions"
This is only a single compiling need I have !
So you're not interested in being taken seriously, nor making some effort to produce a serious-looking post?
I am really serious, I tried a lot, finally decided to post since it is pending for more than 6 months! I am using Atmel's AT89C2051 microcontroller. I am not a tech saavy, still mad to develop something ... ! Experts support needed to create a hex code.
evidently you can not read the fine print re how to post code
Post source code using PRE tags, otherwise it's unusable, or perhaps you didn't notice how awful the formatting looks?
perhaps you didn't notice how awful the formatting looks? which is why I suggested that he see an optometrist
Not if you persist in ignoring all advice.
Any error you see in this code ?
/*----------- 'x/10'seconds delay function ---------- */ void delay_ss(char x) { char y; TR0 = 1; while(x) { y = 0x0A;
while(y) { if(TF0) {y--; TF0 = 0; } } x--; }
TR0 = 0; TL0 = 0; TH0 = 0; TF0 = 0; }
Before I post, cheked perview, preview looks fine. on posting, it is coming different than preview !!
and note the link, Tips for Posting Messages...
Thank you sir, I am not able to post it within 'pre' as it is exceeding 7000 characters...
And your work-around then is to skip the pre tags and post something that isn't readable?