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 CCS Technical Support

RS232 using MPLAB UART1

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Robert@panik
Guest







RS232 using MPLAB UART1
PostPosted: Thu Aug 10, 2006 10:30 am     Reply with quote

Hi Folks,
I am new to this compiler and have a question about using UART1 to simulate input. It works fine in ASM but a simular C version hanges on the getc() and does not take the input from the text file. My progam is very simple
Code:
#include <18F4550.h>

#ignore_warnings NONE           // report all warnings
#define CLOCK_48MHz             // micro clock frequency

#include <stdlib.h>
#include <STRING>
#include <CTYPE>
#include <STDDEF>
#use delay(clock=48000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,bits=8,parity=n)

void main()
{
   int8 x=0x55;

   while(1)
   {
      putc(x);
      x=getc();
   }
}


Does this mplab feature work with the compiler or is there a problem with the code snippet.

PS the unital 'U' character is displayed in the display box.

Regards
Robert.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Aug 10, 2006 11:28 am     Reply with quote

The text file that you give to UART1 has to have the text in quotes.
Example:
Quote:
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
robert@panik
Guest







PostPosted: Fri Aug 11, 2006 12:48 pm     Reply with quote

Thanks , but I found the problem, I had the wdt on used a #fuse to define NOWDT and it worked.

Robert
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