|
|
View previous topic :: View next topic |
Author |
Message |
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
rs485 help |
Posted: Mon Jan 29, 2007 3:29 pm |
|
|
hi all;
i try to communicate using rs485 .
Code: |
#define RS485_USE_EXT_INT FALSE
| ,,this line
supposed to use #int_rda (as i understand!!)
when i add this interrupt,,compiler returne this error message
duplicate interrupt function
i dont know whats wrong!
sorry for my bad language |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jan 29, 2007 3:34 pm |
|
|
The #int_rda function is already in the RS485.C driver file.
You don't need to add it.
Here is the location of the file:
c:\program files\picc\drivers\rs485.c |
|
|
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
|
Posted: Tue Jan 30, 2007 1:22 am |
|
|
thank you PCM programmer
this is my test code [/code]
#include <16f877.h>
#include <string.h>
#fuses HS,NOWDT,NOLVP
#use delay(clock=20000000) //one instruction=1us
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,stream=pc)
/*
PIN_C7 // Data receive pin
PIN_C6 // Data transmit pin
PIN_B4 // Controls DE pin. RX low, TX high.
PIN_B5 // Controls RE pin. Should keep low.
*/
#define RS485_RX_BUFFER_SIZE 40
#define RS485_USE_EXT_INT FALSE
#define RS485_ID 0x01
#include "RS485.c"
#include "lcd_kbd1.c"
#define bkbhit (next_in != next_out)
int8 i, msg[RS485_RX_BUFFER_SIZE];
int8 next_in = 0;
int8 next_out = 0;
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
rs485_init();
LCD_Init ( );
while(TRUE)
{
// Purpose: Get a message from the RS485 bus and store it in a buffer
// Inputs: 1) A pointer to a buffer to store a message
// 2) TRUE - wait for a message
// FALSE - only check if a message is available
// Outputs: TRUE if a message was received
// FALSE if wait is FALSE and no message is available
// Note: Data will be filled in at the pointer as follows:
// FROM_ID DATALENGTH DATA...
if(rs485_get_message(* msg, TRUE))
{
LCD_PutCmd ( CLEAR_DISP );
LCD_SetPosition ( LINE_16_1);
printf(LCD_PutChar," MSG IS:");
LCD_SetPosition (LINE_16_2);
printf(LCD_PutChar,"%s",msg );
delay_ms(1000);
}//if
}//while
}//MAIN
Code: |
will this print msg on lcd?without using #int_rda??
|
|
|
|
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
|
Posted: Tue Jan 30, 2007 1:25 am |
|
|
sorry,this is my message agian:
thank you PCM programmer
this is my test code
Code: |
#include <16f877.h>
#include <string.h>
#fuses HS,NOWDT,NOLVP
#use delay(clock=20000000) //one instruction=1us
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7,stream=pc)
/*
PIN_C7 // Data receive pin
PIN_C6 // Data transmit pin
PIN_B4 // Controls DE pin. RX low, TX high.
PIN_B5 // Controls RE pin. Should keep low.
*/
#define RS485_RX_BUFFER_SIZE 40
#define RS485_USE_EXT_INT FALSE
#define RS485_ID 0x01
#include "RS485.c"
#include "lcd_kbd1.c"
#define bkbhit (next_in != next_out)
int8 i, msg[RS485_RX_BUFFER_SIZE];
int8 next_in = 0;
int8 next_out = 0;
void main()
{
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
rs485_init();
LCD_Init ( );
while(TRUE)
{
// Purpose: Get a message from the RS485 bus and store it in a buffer
// Inputs: 1) A pointer to a buffer to store a message
// 2) TRUE - wait for a message
// FALSE - only check if a message is available
// Outputs: TRUE if a message was received
// FALSE if wait is FALSE and no message is available
// Note: Data will be filled in at the pointer as follows:
// FROM_ID DATALENGTH DATA...
if(rs485_get_message(* msg, TRUE))
{
/*
for(i=0; bkbhit && i<sizeof(msg); ++i)
msg[i] = bgetc();
*/
LCD_PutCmd ( CLEAR_DISP );
LCD_SetPosition ( LINE_16_1);
printf(LCD_PutChar," MSG IS:");
LCD_SetPosition (LINE_16_2);
printf(LCD_PutChar,"%s",msg );
delay_ms(1000);
}//if
}//while
}//MAIN |
will this print msg on lcd?without using #int_rda?? |
|
|
hadeelqasaimeh
Joined: 05 Jan 2006 Posts: 105
|
|
Posted: Wed Jan 31, 2007 11:22 am |
|
|
no one can help??!!plz |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|