Hi,
CLASSB 认证中有 RAM_TEST文件是asm文件,
问题:1》里面的_Ramtest 函数请问如何在主程序C语言中调用?
2》 Start address ,End address 参数如何传入?
谢谢!
_Ramtest:
/* Tested RAM area:0090H~047FH,use checkboard arithmetic which write alternate "0" and
"1" to memory, verify if the write data is right by reading back the data written
Start address -> IX
End address -> EP */
L_Next: MOV A, #0X55
MOV @IX, A
CMP @IX, #0X55
BNZ ram_error
MOV A, #0XAA
MOV @IX, A
CMP @IX, #0XAA
BNZ ram_error
MOV A, #0X00
MOV @IX, A
CMP @IX, #0X00 // clear the tested ram area
BNZ ram_error
INCW IX
MOVW A, IX
MOVW A, #0X0000 // MOV IX value to T register
MOVW A, EP
CMPW A // check if the address is equal to the end address
BNZ L_Next // if the address is not equal to the end address, it will jump to test next byte
// if the address is equal to the end address, it will clear all tested RAM area
RET
/*once RAM test error is detected, program will run into an infinite loop.*/
ram_error:
JMP ram_error
RET
已解决! 转到解答。
Hi,
C中调用汇编部分程序你可以参考下面这样使用
unsigned int address;
void test(unsigned int Address)
{
address = Address;
#pragma asm
PUSHW IX
PUSHW A
MOVW A, EP
PUSHW A
MOVW A, _address
MOVW EP,A
CALL _RAMTEST
POPW A
POPW IX
#pragma endasm
}
汇编这边需要存地址
_RAMTEST:
MOVW A,EP
PUSHW A
Hi,
Please refer to the Softune compiler manual - https://www.cypress.com/file/250876/download
Hi,
C中调用汇编部分程序你可以参考下面这样使用
unsigned int address;
void test(unsigned int Address)
{
address = Address;
#pragma asm
PUSHW IX
PUSHW A
MOVW A, EP
PUSHW A
MOVW A, _address
MOVW EP,A
CALL _RAMTEST
POPW A
POPW IX
#pragma endasm
}
汇编这边需要存地址
_RAMTEST:
MOVW A,EP
PUSHW A