Look at that simple code:
Code: Select all
//***************************
unsigned short Cont1, Cont2; // Global vars
void main(void);
void Retardo1(void);
void Retardo1()
{
asm {
MOVLW 0xFF
MOVWF _Cont1, 1
MOVWF Cont2, 1 }
}
void main()
{
Retardo1();
}
not found: _Cont1
not found: Cont2
So, where is the error here? Does any body knows?
According to the help explanation a global variable inside the asm code should use a "_" before variable name (_Var) and it should be declared as global in C code.
I think I did that, but it doesn't work.
Another question supporting my interest in embedding assembly code in MickroC code is:
I'm communicating a PC with a raw device through USB port, among functions I had used is one in wich I have to create some time delays. The interesting thing is: If I put on this function more than three instructions " Delays_ms(200);" the Raw device is not recognized by the computer (the communication at start is disrrupted) and with three or less intructions the raw device in recognized by the computer.
Look at the function:
Code: Select all
void PulsedTone()
{ Aux1=CFG2;
Aux1=Aux1 & 0x07;
if (Aux1!=0)
{
Vdelay_ms(2000);
Vdelay_ms(1000);
Vdelay_ms(60);
Vdelay_ms(1000); <--- this is the critical call, no mather if you use Delay_ms or other related (I need to put 6 calls)
}
dBL=0x0; dBR=0x0; // Mute Channels
Set_dB();
}
kind regards
Edited by Administratro: Added Code Tag!