View previous topic :: View next topic |
Author |
Message |
Robert@panik Guest
|
RS232 using MPLAB UART1 |
Posted: Thu Aug 10, 2006 10:30 am |
|
|
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
|
|
Posted: Thu Aug 10, 2006 11:28 am |
|
|
The text file that you give to UART1 has to have the text in quotes.
Example:
Quote: | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
|
|
|
robert@panik Guest
|
|
Posted: Fri Aug 11, 2006 12:48 pm |
|
|
Thanks , but I found the problem, I had the wdt on used a #fuse to define NOWDT and it worked.
Robert |
|
|
|