CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RS485 Transmitter sending extra data

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
arloedx



Joined: 21 Aug 2009
Posts: 15
Location: Texas

View user's profile Send private message

RS485 Transmitter sending extra data
PostPosted: Wed Aug 26, 2009 10:30 am     Reply with quote

Hello,

I am using the rs485.c library to send data. I have two PIC18f252 and two MAX485 chips. I can send data but additional data is being sent. For example if I send the character 'A', the characters 'AH' are sent. Does anyone have an Idea how to correct this? My code is below. Thanks in advance.
Code:

#include <18f252.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use    delay(clock=10000000)

//#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7)

#define LCD_RS_PIN      PIN_B0
#define LCD_RW_PIN      PIN_B1
#define LCD_ENABLE_PIN  PIN_B2
#define LCD_DATA0       PIN_B4
#define LCD_DATA1       PIN_B5
#define LCD_DATA2       PIN_B6
#define LCD_DATA3       PIN_B7   

#include <lcd2.h>

#define RS485_RX_BUFFER_SIZE 64
#define RS485_USE_EXT_INT FALSE

#define  RS485_ID           0x01
#define RS485_ENABLE_PIN      PIN_C5
#define RS485_TX_PIN       PIN_C6
#define RS485_RX_PIN       PIN_C7

#include <rs485.c>
#include <stdlib.h>

void LCD_CHECK();
void state(unsigned char s);
void frequency(unsigned char frc);

int RS485_DEST_ID;

void LCD_CHECK()
{
   lcd_gotoxy(1,1);
   printf(lcd_putc, "System Ready");
   delay_ms(500);
   printf(lcd_putc,"\f");
}
int8 size=1;
int i, max = 5 ;
int8 bufsend[5] = {'A','B','C','D','E'};
int *pointer;

void main()
{
   output_high(RS485_ENABLE_PIN);
      rs485_init();
   lcd_init();
   LCD_CHECK();
   while(true)
      {
      RS485_DEST_ID = 0x09;
      for(i=0; i<3; i++)
      {
         pointer = &bufsend[i];   
               rs485_send_message(RS485_DEST_ID, size, pointer);       
          printf(lcd_putc,"\fSent: %c", bufsend[i]);
          delay_ms(400);
      }
      RS485_DEST_ID = 0x07;
      for(i=3; i<max; i++)
      {
         pointer = &bufsend[i];   
               rs485_send_message(RS485_DEST_ID, size, pointer);       
          printf(lcd_putc,"\fSent: %c", bufsend[i]);
          delay_ms(400);
      }
      delay_ms(1000); 
   }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Aug 26, 2009 11:47 am     Reply with quote

You shouldn't start a new thread on the same topic. You have an
existing thread here:
http://www.ccsinfo.com/forum/viewtopic.php?t=39964
You can "bump" that thread to the top of the list by adding a post to it.
Everyone will see it.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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