cancel
Showing results for 
Search instead for 
Did you mean: 

Is it safe to use LDW with ADC_DR?

steven239955_st
Associate II

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

1 REPLY 1
Philipp Krause
Senior II
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