Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/07/04 10:14
Read: times


 
#82690 - Do you want to be helped?
Responding to: ???'s previous message
You still haven't legibly posted your code!
If you want people to read it for you, you can at least present it legibly!

Oleg Sergeev said:

but why, why, why, do you manipulate with registers directly from C-language???
ACC = DPL;
SPDR = ACC;


I have used C language, obviously!! I am compiling my program using Keil software and it takes care of all the registers.

You missed Oleg's point: it is precisely because 'C' does take care of all the registers that you cannot just go fiddling with them as you have done!

Moreover I had made the above instruction like so because in instruction set I found that I can't load SPDR (SPI data register) unsig other registers exept accumulater.

How did you find that? Can you provide a reference in the Datasheet or other Atmel documents?
Sounds most unlikely to me - SPDR is just another SFR, and SFRs are directly-addressable!

Anyhow, the 'C' compiler knows how to deal with SFRs - just make it a normal assignment. The compiler will go via whatever intermediate registers it requires.

However, if it really is the case, you have no choice but to do this bit in assembler.

I won't bother you with the basic points of how to write assembler callable from 'C' - it's all in the Manual.


List of 20 messages in thread
TopicAuthorDate
has anybody used SPI            01/01/70 00:00      
   more details please            01/01/70 00:00      
      details            01/01/70 00:00      
         missing code?            01/01/70 00:00      
         How to post code            01/01/70 00:00      
   The story so far?            01/01/70 00:00      
   no solution            01/01/70 00:00      
      all is replied above            01/01/70 00:00      
      So you want a solution?            01/01/70 00:00      
         code and schematic            01/01/70 00:00      
            unconnected reset?            01/01/70 00:00      
            How about some clocking ??            01/01/70 00:00      
            Code still illegible!            01/01/70 00:00      
            is it C-language?            01/01/70 00:00      
               reply of queries            01/01/70 00:00      
                  complaining            01/01/70 00:00      
                  Do you want to be helped?            01/01/70 00:00      
                     Watch window in Keil            01/01/70 00:00      
                        Registers window in Keil            01/01/70 00:00      
   EA            01/01/70 00:00      

Back to Subject List