السلام عليكم
عندي كود أستخدمته لمايكرو 18F45k22 ولكن اثناء build تظهر لي داله غريبه رغم كود صحيح
الكود
كود:
char dat[10]; // buffer for receving/sending messages
char kk[10];
sbit rs485_rxtx_pin at RC0_bit; // set transcieve pin
sbit rs485_rxtx_pin_direction at TRISC0_bit; // set transcieve pin direction
// Interrupt routine
void interrupt()
{
char temp=0;
if(RC1IF_bit==1)RS485Master_Receive(kk);
}
void main()
{
TRISC.f1=0;
ansela=0;
anselb=0;
anselc=0;
anseld=0;
RS485Master_Init(); // initialize MCU as Master
dat[4] = 0; // ensure that message received flag is 0
dat[5] = 0; // ensure that error flag is 0
dat[6] = 0;
RC1IE_bit=1; // enable interrupt on UART1 receive
TX1IE_bit = 0; // disable interrupt on UART1 transmit
PEIE_bit = 1; // enable peripheral interrupts
GIE_bit = 1; // enable all interrupts
UART1_Init(9600); // initialize UART1 module
Delay_ms(100);
while(1)
{
if(kk[4]){
RC1_bit=~RC1_bit;
kk[4]=0;
dat[0]=0;
dat[1]=0;
dat[2]=2;
UART_Set_Active(&UART1_Read, &UART1_Write, &UART1_Data_Ready, &UART1_Tx_Idle); // set UART1 active
RS485Master_Send(dat,3,1); // send message through UART1
}
delay_ms(10);
}
}
حيث تبين مشكله في كود بلون أحمر ولكن اذا أستخدمت العائله 16F لايظهر لي اي أخطاء
http://up.top4top.net/downloadf-top4...c3ee1-rar.html