cancel
Showing results for 
Search instead for 
Did you mean: 

How to access STM8 cpu registers

MykolaLevun
Associate III

Hello

How can I access STM8S CPU registers (Cosmic compiler)? When I write this "A = 0xff" (A is a processor register accumulator), then compiler writes this "#error cpstm8 main.c:17(3) A undefined". How to fix it?

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

You need to access internal CPU registers with assembly language. You can insert asm code inside C code.

See https://www.cosmicsoftware.com/pdf/cxstm8_pd.pdf / page 2.

PS: this thread is the duplication of this one: https://community.st.com/t5/stm8-mcus/stm8-cpu-register-cosmic/td-p/614181

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.

View solution in original post

1 REPLY 1
SofLit
ST Employee

Hello,

You need to access internal CPU registers with assembly language. You can insert asm code inside C code.

See https://www.cosmicsoftware.com/pdf/cxstm8_pd.pdf / page 2.

PS: this thread is the duplication of this one: https://community.st.com/t5/stm8-mcus/stm8-cpu-register-cosmic/td-p/614181

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.