Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
pdelprat
PostPosted: Feb 17, 2012 - 09:57 PM
Rookie


Joined: Jan 08, 2010
Posts: 40
Location: France

Hello,

Sometime my projet works and sometime not. After a low search, I'm facing with a strange behavior, and I don't know how it can happen.

Look at my screenshop, after two simple instructions :

Code:

mov r0, lo(0x78)
orh r0, hi(0x78)


My register r0 value is 0x00010078 and not 0x00000078. It doesn't happen all times, but when it happen, my program crash due to a overflow later.
How it can be possible ?

Thanks for your help,
Pascal
 
 View user's profile Send private message  
Reply with quote Back to top
Heihopp
PostPosted: Feb 17, 2012 - 11:27 PM
Hangaround


Joined: Jun 04, 2007
Posts: 496
Location: Norway

If you want to put a 32bit constant to a register:

mov r0, LWRD(0x12345678)
orh r0, HWRD(0x12345678)
 
 View user's profile Send private message  
Reply with quote Back to top
pdelprat
PostPosted: Feb 17, 2012 - 11:41 PM
Rookie


Joined: Jan 08, 2010
Posts: 40
Location: France

Heihopp wrote:
If you want to put a 32bit constant to a register:

mov r0, LWRD(0x12345678)
orh r0, HWRD(0x12345678)


thanks for your reply, but it seems that not a syntax issue, the disassembly show correct values :

Code:

mov r0, lo(0x78) -> mov r0, 120
orh r0, hi(0x78) -> orh r0, 0x0000


Kind regards,
Pascal
 
 View user's profile Send private message  
Reply with quote Back to top
pdelprat
PostPosted: Feb 18, 2012 - 11:42 AM
Rookie


Joined: Jan 08, 2010
Posts: 40
Location: France

I need to check my clock configuration, because when I switch to 12 Mhz instead of 66 Mhz, all woks fine in any times. It probably comes from a instability due to a wrong clock configuration,

Make sense ?
Kind regards,
Pascal
 
 View user's profile Send private message  
Reply with quote Back to top
digitalDan
PostPosted: Feb 18, 2012 - 11:53 AM
Hangaround


Joined: Nov 01, 2008
Posts: 253


Did you set the flash for 1 wait state when operating above 33 Mhz? Neglecting to do so can cause all sorts of weird issues.

_________________
Letting the smoke out since 1978
 
 View user's profile Send private message  
Reply with quote Back to top
pdelprat
PostPosted: Feb 18, 2012 - 01:11 PM
Rookie


Joined: Jan 08, 2010
Posts: 40
Location: France

digitalDan wrote:
Did you set the flash for 1 wait state when operating above 33 Mhz? Neglecting to do so can cause all sorts of weird issues.


Many thanks, it seems that you right ...
I forgot this point,
Kind regards,
Pascal
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits