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

Need Help with RS232 Rx code in 18F4550 with Int_rda running

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



Joined: 18 Apr 2006
Posts: 66

View user's profile Send private message Yahoo Messenger

Need Help with RS232 Rx code in 18F4550 with Int_rda running
PostPosted: Sun Nov 26, 2006 6:53 pm     Reply with quote

I am a C Newbie and need to get my 18f4550 to receive wireless data on rc7 using the internal UART. I need to accumulate this data (about 54 bytes) in a buffer. Most of the code I see online is using fancy functions that unfortunately I dont yet understand (I dont mind the extra typing). I have all the electrical stuff working just fine. I am working at 9600N81 with no flow control. Can anyone help with the irq routine that will simply allow the data to be captured to a buffer? Thanks
BOB_SANTANA



Joined: 16 Oct 2006
Posts: 110
Location: HOVE, EAST SUSSEX

View user's profile Send private message

PostPosted: Sun Nov 26, 2006 7:16 pm     Reply with quote

There is an example which comes with your complier SISR.c
it does exactly what you want
you would have to change the buffer size
_________________
BOB_Santana Smile
foodwatch



Joined: 18 Apr 2006
Posts: 66

View user's profile Send private message Yahoo Messenger

PostPosted: Sun Nov 26, 2006 7:33 pm     Reply with quote

Thanks Bob,This is the code I have been using but my lack of C experience is giving me fits with the irq functions and how they work.

I am trying to output the data to my lcd display, but dont really understand the "bgetc" function as it is written. The RS232 code seems to be working, but I was looking to printf(lcd_put,"\f%S",buffer); and have it display the data on my lcd so I can work out the protocol issues needed for reliable wireless transmission. What is supposed to happen when the buffer count is reached?
BOB_SANTANA



Joined: 16 Oct 2006
Posts: 110
Location: HOVE, EAST SUSSEX

View user's profile Send private message

PostPosted: Thu Nov 30, 2006 1:31 pm     Reply with quote

Dont know if you have got this sorted yet
But you can't use
Code:
printf(lcd_put,"\f%S",buffer);

As the data is not a string

The data is store in the 32 element array
Code:
 buffer[BUFFER_SIZE]


So you need to read each element in the array where the data is
it uses next_out as a pointer to the data

As for the lcd part you could do something like assuming you wanted to
read the first elements of the array

Code:

 for(counter=0;counter < 8;counter++)
       
          {
          lcd_gotoxy(1+counter, 2);               // Go to begining of 2nd Line
          printf(lcd_putc,"%c",buffer[counter]);                       
          }
                                 

_________________
BOB_Santana Smile
BOB_SANTANA



Joined: 16 Oct 2006
Posts: 110
Location: HOVE, EAST SUSSEX

View user's profile Send private message

PostPosted: Thu Nov 30, 2006 1:33 pm     Reply with quote

Sorry i meant the first 8 elements Cool
_________________
BOB_Santana Smile
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