|
|
View previous topic :: View next topic |
Author |
Message |
amit78
Joined: 17 Jul 2009 Posts: 22 Location: Kolkata, India
|
Newbie: RS485 commnication is not working |
Posted: Mon Aug 24, 2009 1:33 am |
|
|
Hi All
I am a newbie not only in ccs but also in world of micro. However in last couple of month I learned lot many things just by searching this forum''. Now I stumbled in developing a RS485 circuit. My aim is to device a dedicated transmitter from PIC Micro and a dedicated receiver in the PC end. At the PC end I used a RS485 to RS232 converter circuit.
Problem is: Nothing is showing in the PC Hyperterminal. But when ever I connect the PIC TXD directly with the T2Out of MAX232 every thing is working fine. But I need this via RS485. (I dont have any Oscilloscope to observe the signal behavior).
Below is my circuit diagram and my code.
[url]
http://www.flickr.com/photos/41767017@N04/3851821780/sizes/o/
[/url]
Code: |
#include <18F452.h>
#device *=16
#fuses HS, NOWDT, NOLVP, NOBROWNOUT, NOPROTECT, PUT
#use delay(clock=4000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, stream=RS485, ERRORS)
#include <stdio.h>
//======================================
void main()
{
while(1)
{
printf("Hello World\n\r");
delay_ms(1);
}
}
|
Where I am wrong? In the circuit or in the code?
I am using
PIC18F452
CCS 3.0.0.1.0
MAX485
MAX232
Thanks in Advance
Amit |
|
|
Ttelmah Guest
|
|
Posted: Mon Aug 24, 2009 3:24 am |
|
|
First thing, check the pinout of your MAX485's.
You show 'RE', on pin 4, but this is only correct on the uMAX pinout version of the chip. The more common 'DIP' pinout, has RE on pin 2. The same applies to several other pins. What version of the chip have you got?...
Then, you don't show the other connections to the PIC itself. MCLR needs to be pulled high. How is your crystal connected?. You don't show power connections. What smoothing by the chip?.
Your fuses, have 'HS' selected. This is for crystals > 4MHz. Yet your clock is set for 4MHz. It'll probably run with a 4MHz crystal, but not if the gain is low. What loading capacitors etc..
First, add a LED, and current limit resistor to one output on the chip, and prove you have the processor running, by flashing this. Once you have this going, and flashing at the right rate, then look at getting the comms working...
Best Wishes |
|
|
Guest
|
|
Posted: Mon Aug 24, 2009 4:25 am |
|
|
Quote: | First thing, check the pinout of your MAX485's.
You show 'RE', on pin 4, but this is only correct on the uMAX pinout version of the chip. The more common 'DIP' pinout, has RE on pin 2. The same applies to several other pins. What version of the chip have you got?... |
And you are right. I missed this. Thanks a Lot Ttelmah. Its now running. I mistakenly used the pin configuration of uMAX. U are simply god.
Amit |
|
|
|
|
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
|