How to remove Noise/Voltage in TX pin of PIC16F877?

Discussion in 'Embedded Systems and Microcontrollers' started by PersianEngineer, Aug 15, 2013.

  1. PersianEngineer

    Thread Starter New Member

    Aug 15, 2013
    19
    0
    Dear friends,
    I wanna connect an existing device to PC using RS485/RS232. I have programmed the microcontroller correctly and it works when I haven't switch on the power of device. I mean after programming by PIC kit 2, I have tested it by connecting the related cable from TX pin to PC and have received the test messages of microcontroller by hyperterminal. but when I turn on the device I can not receive. I tested the output voltage of the TX pin, It shows 4.3v voltage. I used 1k pull-down resistor in this pin. the voltage removed but still I can not receive any message.
    Suddenly one day, after programming the microcontroller and without disconnecting the in-circuit programming cable, I saw that the device is sending message. after checking all pins of PICKIt 2 programmer, I saw the pin GND of programmer is affecting the device and removes the voltage in pin Tx. I mean if I connect the GND pin of microcontroller to an external GND, It sends correctly the message but sometimes with a bit changes in some characters randomly like a noise.
    briefly, there is a noise in Pin Tx of PIC microcontroller. How can I remove this noise when the device is connected to mains. I should mention that this device has some parallel boards: power supply board, MCU board and IO boards beside each other. the power supply board is very close to MCU board which including out microcontroller (around 2cm).
    Should I use a bigger pull down resistor? Should I use capacitor in parallel with pull down resistor? which capacitor?
    Please guide me. I'm a EEE student working on a summer project.
    I appreciate a lot in advance.
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    Show your circuit schematic.
     
  3. mitko89

    Member

    Sep 20, 2012
    123
    19
    Are you using MAX232 or any other kind of an inteface ic?
     
  4. PersianEngineer

    Thread Starter New Member

    Aug 15, 2013
    19
    0
    Dear MrChips, Unfortunately, I don't have the schematic. but it's very simple. it's an alarm system that has some inputs and output as LEDs and buzzers which drives by relays. these relays are far from PIC but there is a power supply circuit in a separate board close to this board in parallel.

    Dear mitko89, Yes, Max232 and Max485.
     
  5. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    No, it is not that simple.

    You say you are using MAX232 and MAX485.

    We have to see how those are connected in your situation. Draw what you have and show us how these are connected.

    Do you want help or not?
     
  6. PersianEngineer

    Thread Starter New Member

    Aug 15, 2013
    19
    0
    https://docs.google.com/file/d/0B684gATizmvhbDBpOVhNcnhHSWc/edit?usp=sharing
    This is the circuit of connection between PC and PIC that I have added to device and not the circuit of device.
    Please notice that the programming doesn't have any problem and the connection circuit as you can see in the above pic.
    Why when I connect an external GND source to Vss of PIC, the noise reduces a lot and I can receive the messages but not perfectly? what is the role of external GND here?
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    You keep on saying "device". What is device?

    Why is there an inverter U3 in that schematic?

    What is the purpose of U4 and U5, MAX487?
     
  8. PersianEngineer

    Thread Starter New Member

    Aug 15, 2013
    19
    0
    MrChip, This circuit is working properly. I have tested on breadboard and then connected this circuit to PIC microcontroller of device just by pin Tx of UART. SO don't look for fault in this circuit.

    This cicuit first convert the TTL signal to RS485 (U4) then at the other end of the cable convets back to TTL (U5) then for delivering to com port of PC, Max232 convert signal level to RS232.
    Ignore inverter. there is no inverter in real circuit. Here I added in proteus software.
     
  9. MrChips

    Moderator

    Oct 2, 2009
    12,446
    3,362
    Your circuit is working properly. Then you don't need any help.
    I'm outta here!

    Goodbye, Mr. Chips.
     
  10. PersianEngineer

    Thread Starter New Member

    Aug 15, 2013
    19
    0
    You didn't read the first post properly and maybe you couldn't understand it. Just you asked some unrelated questions without any help. Bye.
    I explained the situation completely and then asked some clear questions in two posts. let me ask a different question:
    If we encounter to a noise in transmission pins of microcontroller caused by inductors and transformers etc around it, How can we remove it? You think a grounded capacitor connected to that pin can help? How about the big pull down resistor?
     
    Last edited: Aug 15, 2013
Loading...