Skip to main content
Visitor II
February 25, 2018
Question

Is it safe to use LDW with ADC_DR?

  • February 25, 2018
  • 1 reply
  • 866 views

Posted on February 25, 2018 at 11:04

Although the STM8 reference manual RM0031 does not seem to mention it, I understand from the AN2658 (section 2.7) that I must read ADC_DRH and ADC_DRL in a specific order, with the actual order depending on my configuration of the ADC.

It seems obvious (at least to me) that the the LDW instruction can be use to read these two consecutive locations is one instruction. AN2658 does not mention this 'obvious' method, so I'm I missing something in my understanding. Is LDW unsafe in this siltation?

Specifically I was intent is to do either:

  LDW x, $0x5344

or

 LDW y, $0x5344

    This topic has been closed for replies.

    1 reply

    Visitor II
    February 27, 2018
    Posted on February 27, 2018 at 10:43

    ldw executes in two cycles and AFAIK always reads/writes the least significant byte first. So if you can use ldw also depends on the configuration.

    Philipp