Problems getting SCI Module on a S08PT60 to work ASM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problems getting SCI Module on a S08PT60 to work ASM

跳至解决方案
953 次查看
Ingo_Michael
Contributor II

Hello,

 

I have Problems with the following code:

 

128452_128452.pngpastedImage_0.png

I always get warnings like

 

"A13003 Value is truncated to one byte main.asm /TWR-S08PT60/Sources line 119 C/C++ Problem" and

"A1415 Cutting constant: Value 12428 ($308C) is not in range [0..255] main.asm /TWR-S08PT60/Sources line 119 C/C++ Problem

in my code. I can not understand why. I think that´s also the reason why I am not able to reset the "TDRE" Flag in the SCI1_S1 Register.

So my complete code is not working and I am not able to send some chars out to my terminal program on my PC.

 

Can anyone help?

 

 

BR

-Ingo

标签 (1)
0 项奖励
1 解答
741 次查看
tonyp
Senior Contributor II

All bit instructions (BSET, BCLR, BRSET, BRCLR) expect a zero-page operand (i.e., a variable mapped somewhere in page 0, RAM address 0 through 255).

Apparently, in your case, SCI1_S1 is located outside this range.  So, you need to emulate the bit instructions.  Example:

BCLR 7,XXX

is (practically) equivalent to

LDA XXX

AND #$7F

STA XXX

while a BRCLR 7,XXX,Address can be emulated with

LDA XXX

BIT #$80

BEQ Address

(Similarly for the rest, except that you need ORA for BSET and inverted mask, and BNE for BRSET.)

Hope this helps.

在原帖中查看解决方案

3 回复数
742 次查看
tonyp
Senior Contributor II

All bit instructions (BSET, BCLR, BRSET, BRCLR) expect a zero-page operand (i.e., a variable mapped somewhere in page 0, RAM address 0 through 255).

Apparently, in your case, SCI1_S1 is located outside this range.  So, you need to emulate the bit instructions.  Example:

BCLR 7,XXX

is (practically) equivalent to

LDA XXX

AND #$7F

STA XXX

while a BRCLR 7,XXX,Address can be emulated with

LDA XXX

BIT #$80

BEQ Address

(Similarly for the rest, except that you need ORA for BSET and inverted mask, and BNE for BRSET.)

Hope this helps.

741 次查看
Ingo_Michael
Contributor II

Thank you, but in CW 6.3 it was possible. Now I use CW 10.6.4 and it does not. Is there another way?

BR

-Ingo

0 项奖励
741 次查看
Encoder1
Contributor III

Dear Ingo,

CW10 is much more cumbersome than old good CW6.3 but in that case the result would be the same.

You simply cannot do bit instruction outside of page zero.

In the case of PT60 this include all SCI, SPI, FTM2 timer registry, Port i/o enable and pullup.

For these you are forced to translate bit instruction as Tony suggested: there are no short codes.

Regards,

Salvatore