|
|
View previous topic :: View next topic |
Author |
Message |
james Guest
|
rs232 on 18f4520 |
Posted: Tue Nov 18, 2008 4:02 pm |
|
|
Hi, looking for some pointers / things to check with a problem I have.
I'm running rs232 via max3232 on and 18f4520.
I have a basic program running, and can send from the pic to hyper-terminal (windows).
When I try and send something back from hyper-terminal, then return it via the pic to ensure both tx and rx work, I get hieroglyphics back... i.e, when I send a key press from the keyboard back to the pic, I used getc command, assign data to a char, then do a printf, and get junk back at the hyper terminal.
any ideas?
thanks
james |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 18, 2008 4:14 pm |
|
|
Try a simple test program, as shown below. If your crystal is above
4 MHz, then change the fuse from XT to HS and also edit the #use delay
statement for the correct frequency.
Code: |
#include <18F4520.H>
#fuses XT,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
//========================
void main()
{
int8 c;
printf("Start: \n\r");
while(1)
{
c = getc();
putc(c);
}
} |
|
|
|
james Guest
|
|
Posted: Tue Nov 18, 2008 4:17 pm |
|
|
Thanks for your very quick reply,
I am unable to test anything until Thursday, am away from the workshop,
Thanks for your help so far and I will post again after I tried your suggestion.
Thank you again.
James |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Tue Nov 18, 2008 4:41 pm |
|
|
check the baud rate, number of start bits, data bits, stop bits and parity match. Most text type applications use 1 start, 1 stop, 8 data, no parity.
If you are using your own hardware then check that the max chip is generating the +10 and -10 volt levels. When the PIC is not transmitting you should be able to measure -10 volts on the transmit output from the MAX chip to the PC _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
|
|
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
|