PIC and MAX232 in/out


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default PIC and MAX232 in/out

    Hi. I made some circuits a while ago that take commands from a PC through serial. The circuits could also send out serial to each other. Since then ive been told i really shouldnt be using the method i was using and i have to put a MAX232 chip (or similar) between the PICs and the PC.

    I have 3 wires. DataIn, DataOut and Common. When the PC is sending the commands this isnt a problem. PC > MAX232 > PIC. I know how to do that much. The problem comes when the PC isnt around and one of the PICs wants to send commands. How do i go about doing that?

    Before i simply used the seriout command on the same pin that usually used serin. This time i will be using hardware UART so i can do PWM and a MAX232 chip. Both of those things stop me from sending data out of the DataIn wire.

    I had a thought. Can i use a seperate pin on the PICs so when its set as the master it uses serout on some other random pin which makes use of the second output of MAX232. Connect the output of the MAX232 into the input (the DataIn wire). The master chip will ignore itself and the others will listen.

    Is this possible? Is it the best way? Will it work without something exploding? lol

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    If you have the in line resistor between the PIC and PC the MAX chip is not needed. The MAX chips are for inverting signal levels and adding some boost to the transmission..

    If you were using USART then yes you need it, but then it would not work with out one.

    So, the software SERIN/SERIN2 is OK straight to the PC if the distance is short enough.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default

    I plan to use these circuits in my disco lights. Im using 3 pin DMX cables but the last light could be a total of 30-40 meters of wire away from the PC.

    Im using the serial RX/TX pins on the pic chip. Last time i tried that i was told its impossible without a MAX232 chip. When in slave mode the chips wont be using serin. It will use the other code which i cant remember off the top of my head but it reads bytes straight from the buffer.

    As far as i know i would need a 3rd pin for one of them to act as a master. When acting as a master a normal serout should work fine but its how to connect that pin into the DataIn wire so all theo ther lights pick it up

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Usually DMX will use something like a 75176. Open the datasheet, and see how you could trick it.

    But MAX232 is really not what you need to use to meet the real DMX protocol/requirement.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default

    Sorry if i wasnt clear. Im just using DMX wires. The actual circuits will use RS232

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Depending your baudrate and if you need interrupt, SERIN/DEBUG/SERIN2 may have their advantages.

    HSERIN's timeout could be handy in this case. You send data, next line is a HSERIN if the timeout happen, you do something else.

    Maybe i need another coffee
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Direct PIC to PC without MAX232
    By acjacques in forum Serial
    Replies: 14
    Last Post: - 23rd October 2014, 21:32
  2. Interface Pic --> Max232 --> GSM Modem
    By SangkiMangki in forum GSM
    Replies: 1
    Last Post: - 28th September 2013, 12:57
  3. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  4. Reading PIC serout in hyperterminal
    By financecatalyst in forum Schematics
    Replies: 5
    Last Post: - 22nd October 2009, 15:13
  5. help my bluetooth and PIC 16F877A?
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2008, 06:52

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts