Register issue

6 posts / 0 new
Last post
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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 :

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

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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 :

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

Kind regards,
Pascal

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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