I have written a switch state program that uses the Renesas M16C Microcontroller, the switch case program works fine however I now have to link the microcontroller with the PC via RS232. This works fine i have written the uart and I can enter pin number and change speed, time and date by sending command from PC. However When i want to change Direcation Forward or Reverse the program crashes as I think it is getting stuck in the state. Also if I send $cs# to the microcontroller is should send the Speed to the computer, however i only need to recive it once but it sends over and over again. Please can you give my any suggestions to my problems, Code is shown below. Apolgies I the code is formatted on my post however in preview it is not formatted not sure how to format it.
break;Code:case 'd': if (str[2]=='f') { RAMP_DOWN(direction); direction=FORWARD; TA4=65000; TABSR_4=0; reload=15000; TA4=reload; TABSR_4=1; } break; if (str[2]=='r') { RAMP_DOWN(direction); direction=REVERSE; TA3=65000; TABSR_3=0; reload=15000; TA3=reload; TABSR_3=1; } break; case 'c': if (str[2]=='s') { RS232PutString(str_RPM); RS232PutChar('\n'); RS232PutChar('\r'); }



LinkBack URL
About LinkBacks



