??? 03/07/04 20:50 Read: times |
#66199 - RE: Is this okay Responding to: ???'s previous message |
Deepak Kash wrote:
------------------------------- One thing I needed to ask is if putting all chars I need to transmit in a 'db ' and using movc @A+DPTR is a good idea ? calling a buffer or a table a database is a bit "over the top" and will probably lead to confusion... I would also like to make a proper knowledge base especially on serial comm and making frontend. No problem in doing so, but make sure whatever you write is correct. And, for heavens' sake, make sure you actually _know_ what you are talking about. I am not convinced that this info is not already available at multiple web sites... Better point to existing and correct sites. No need to duplicate existing info. but most beginners are too afraid to jump into it due to lack of facilities and proper guidance . Jumping in without knowing how deep the water is , is only OK if you can swim, and even then make sure it is deep enough or you could still have an unpleasant surprise. I think you should take it step by step and start by running a simple serial comms program and build on the knowledge you get doing this. Try your own serial comms program (reading a char from a buffer and transmitting it) and once it runs, try and convert it to an ISR. Do not try to run before being able to walk. MOV R0,#0FFH ;Counter mov 40h,#'R' mov 41h,#0DH mov 42h,#0AH mov r0,#40h mov sbuf,@r0 LOOP:SJMP LOOP ;-----------------END OF MAIN------------------------ ORG 200H SERIAL: JB TI,CLEAR CLEAR: CLR TI inc r0 cjne r0,#43h,next sjmp out next:mov sbuf,@r0 out:RETI END Looking at the above code, you still got some way to go. Clean up your code, make sure you fully understand what you are doing, and why you are doing it. Follow the flow of the program, either by using a simulator or lacking this, do it manually, keeping track of the important registers manually (that's how I did it 25 years ago, there were no simulaors, at least not for students..). Again looking at the above program, there are superfluous statements and not enough comments. Trying to follow the program flow should indicate what's good and what's not. Also study existing programs and techniques. Do not just read the programs, but make sure you understand them as well... regards Patrick |