| Author |
Message |
|
|
Posted: Feb 17, 2012 - 09:57 PM |
|

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 |
|
|
| |
|
|
|
|
|
Posted: Feb 17, 2012 - 11:27 PM |
|

Joined: Jun 04, 2007
Posts: 490
Location: Norway
|
|
If you want to put a 32bit constant to a register:
mov r0, LWRD(0x12345678)
orh r0, HWRD(0x12345678) |
|
|
| |
|
|
|
|
|
Posted: Feb 17, 2012 - 11:41 PM |
|

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 |
|
|
| |
|
|
|
|
|
Posted: Feb 18, 2012 - 11:42 AM |
|

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 |
|
|
| |
|
|
|
|
|
Posted: Feb 18, 2012 - 11:53 AM |
|

Joined: Nov 01, 2008
Posts: 191
|
|
| 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
|
| |
|
|
|
|
|
Posted: Feb 18, 2012 - 01:11 PM |
|

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 |
|
|
| |
|
|
|
|
|