cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use assembly command "mov" to move data from peripheral to peripheral ?

TinLethax
Associate II

I'm currently using the STM8L151F3 and implementing the SUMP open logic analyzer. In one part of my code involving with GPIO reading and send data to SPI1_DR. and to make a lots of the capture samples, I use the F-RAM as a external RAM for sampling memory. Since the F-RAM is really fast and practically almost no delay (SPI running at 8MHz).

My question is can I use "mov" instruction to "copy" data from one peripheral address to another ?

this part taken from my code at line 231.

https://github.com/TiNredmc/stm8l_sdcc_template/blob/master/code/ComeNCapture/main.c#L231

// Notice : SDCC compiler 
do{
__asm___("mov 0x5204, 0x5006");// PB_IDR -> SPI1_DR
while(capture){

1 ACCEPTED SOLUTION

Accepted Solutions
Cristian Gyorgy
Senior III

Hi!

Yes, you can. Just pay attention to what peripheral location you write, not all are writable of directly accessible, and there are also reserved bits.

In your case, pay attention if you want to verify this you cannot do it by reading the value you wrote, because you would actually read the SPI data input register.

Good byte!

View solution in original post

4 REPLIES 4
Cristian Gyorgy
Senior III

Hi!

Yes, you can. Just pay attention to what peripheral location you write, not all are writable of directly accessible, and there are also reserved bits.

In your case, pay attention if you want to verify this you cannot do it by reading the value you wrote, because you would actually read the SPI data input register.

Good byte!

So, using "mov" will actually read the GPIO input (PortB in this case) and copy over to the SPI data register and the the SPI hardware do their own tx job. Is that correct ?

Cristian Gyorgy
Senior III

Yes.

Oh great, thank you.