Can I use assembly command "mov" to move data from peripheral to peripheral ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-06 06:26 AM
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){
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-06 09:27 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-06 09:27 AM
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-06 09:40 AM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-06 09:42 AM
Yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-08-06 09:42 AM
Oh great, thank you.