Menu

RS485 Basic Test

Help
Mr. Duke
2021-01-07
2021-01-07
  • Mr. Duke

    Mr. Duke - 2021-01-07

    I am trying to do very basic RS485 communication and I am having very frustrating results. I have read many of the forum posts regarding RS485 and still don't really know how to explain my results.

    I am using a MAX485 chip. I can reliable send a byte 0x30 and on the receiving end I see 0x98. The PIC chip is sending data to a PC with a USB/RS485 device using HTerm. I can connect the same computer to another device communicating over RS485 sending a known data stream and it appears on the PC as expected. This leads me to believe the problem exists with whatever I am doing on the PIC chip.

    Any help is appreciated. Code snippet below.

    #chip 16F628A, 4
    #config OSC = INTOSC
    #option Explicit
    
    #define USART_BAUD_RATE 9600
    #define USART_BLOCKING
    #define SerInPort PORTB.1
    #define SerOutPort PORTB.2
    #define masterslave PORTB.0
    
    Dir SerInPort In
    Dir SerOutPort Out
    Dir masterslave Out
    
    START:
    'Start RS485 Code
    DATA:
    'Send some data
    Set masterslave ON
    HSerSend 0x30
    wait 2 ms
    Set masterslave OFF
    End
    
     

    Last edit: Mr. Duke 2021-01-07
  • Mr. Duke

    Mr. Duke - 2021-01-07

    I actually figured out my own problem. I'm embarrassed to admit that in my haste to create a quick circuit I had failed to place any filter capacitors on my power supply. That seemed to be causing my issues. Everything is working as expected now.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.