bestrider14
Member level 1
- Joined
- Feb 27, 2015
- Messages
- 39
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 300
void ini()
{
Unlock_IOLOCK();
RPOR7 = 0b0000001100000000; //OUTPUT TX UART 1 PIN RB15
RPINR18 = 0b0000000000001110; //INPUT RX UART 1 PIN RB14
lock_IOLOCK();
//UART1
TRISB.B15 = 0; //OUTPUT RX UART 1
TRISB.B14 = 1; //INPUT TX UART 1
UART1_Init(300);
}
void Main()
{
double doub;
char txt[23];
init();
//MPU6050_Init();
//Calibrate_Gyros();
//Zero_Sensors();
UART1_Write_Text("hi");
doub = sin(2);
UART1_Write_text(""); //resovle my probleme but WHY ?????? What the hell
//UART1_Write(0x00); // NO
FloatToStr(doub, txt);
UART1_Write_Text(txt);
UART1_Write_Text("bey");
}
ACCEL_YANGLE = 57.295*atan((float)-ACCEL_XOUT/ sqrt(pow((float)ACCEL_ZOUT,2)+pow((float)ACCEL_YOUT,2)));
If you are referring to the "UART1_write_text" function, then it most certainly does involve a pointer. I suggest that you read up on how (by convention) C compilers interpret strings as arrays of characters with a null terminating character, and also on the equivalence of array addressed and pointers.The function dont need a pointer so i dont know why it crash.
Simulators do not always simulate the hardware correctly. The ONLY true guide to what is correct is how the hardware behaves.So what it can cause that on my hardware.
void Main()
{
AD1PCFGL = 0xFFFF; // digital not analog
CMCON = 7;
TRISA.B0 = 0;
PORTA.B0 = 1;
cos(2); //just this will crash in hardware
do
{
PORTA.B0 = 1;
delay_ms(100);
PORTA.B0 = 0;
delay_ms(100);
}while(1);
}
cos
Prototype double cos(double f);
Description Function returns the cosine of f in radians. The return value is from -1 to 1.
Example doub = cos(PI/3.); // doub = 0.500008
for 16f/18f pic it work well if i sim on proteus. but for dspic it crash in proteus and in hardward.
but is realy a function in the math lib that make the crash if a delete the line my code will work
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?