​ ​ ​ ​ Logging Data from serial port - Page 2
Page 2 of 2 FirstFirst 1 2
Results 11 to 18 of 18

Thread: Logging Data from serial port

  1. #11
    Senior Member
    Join Date
    Jan 1970
    Location
    Nova Scotia, Canada
    Posts
    2,853

    Default

    "skip:" is a label to which program execution will jump if the serin "times out"--that is, within 2 seconds, fails to receive all of the input specified in the serin statement. Your SERIN has a timeout time but no jump label, so will fall through to the next statement (and your w1 value may not be valid).

    If you had to translate with a MAX232 chip, it may be that your data was "inverted" (idle low--standard with PICAXE but not so common with external devices), so you might have been able to read straight from the device with "N2400" instead of "T2400".

  2. #12
    New Member
    Join Date
    Mar 2012
    Location
    Indiana
    Posts
    8

    Default

    The label...duh! I should have caught on to that.

    The MAX232 was implemented because the device voltage was too high (read somewhere that it was necessary for my type of signal)...and it's cheap...and the budget for this is high. However, I may sacrifice a chip and give it a try without the MAX232 chip just to see what happens.

    Thanks again!

  3. #13
    New Member
    Join Date
    Mar 2012
    Location
    Indiana
    Posts
    8

    Default

    Holy $&@# it WORKED!!!

    Rule #549: Trust lbenson over some other random person on the internet...

    The N2400 was the key to me saving $2 and 1" squared per board.

    Thanks again!

  4. #14
    Senior Member
    Join Date
    Jan 1970
    Location
    Nova Scotia, Canada
    Posts
    2,853

    Default

    Quote Originally Posted by Greeper View Post
    ... the key to me saving $2
    Treat yourself to a coffee (but not at Starbucks, sorry).

    If the MAX232 was also "level shifting" (of the voltage) in addition to inverting, at what voltage is your external device running? And the picaxe? The picaxe download circuit allows connection of traditional RS232 serial voltage levels (up to +/- 15V) but that level could/would damage the picaxe without the current-limiting 22K resistor.

  5. #15
    New Member
    Join Date
    Mar 2012
    Location
    Indiana
    Posts
    8

    Default

    Alas, I could be done, and move on, but somebody's going to come across this...

    Sure enough, the Picaxe ran for a while, then failed. Stopped reporting altogether...so I'm thinking the voltage levels of the device are too high. The device is RS232 and intended to connect to a PC for reporting.

    So, if I just do a resistor array of 10K and 22K just like the download circuit, but on C.3, that should save my Picaxe rather than using the MAX232? Since C.4 is TX should not be affected, right?

  6. #16
    Senior Member
    Join Date
    Feb 2013
    Location
    UK
    Posts
    429

    Default

    Quote Originally Posted by Greeper View Post
    Alas, I could be done, and move on, but somebody's going to come across this...

    Sure enough, the Picaxe ran for a while, then failed. Stopped reporting altogether...so I'm thinking the voltage levels of the device are too high. The device is RS232 and intended to connect to a PC for reporting.

    So, if I just do a resistor array of 10K and 22K just like the download circuit, but on C.3, that should save my Picaxe rather than using the MAX232? Since C.4 is TX should not be affected, right?
    As a true RS232 signal swings +/-15 volts I would clamp the input voltage to the PICAXE Vcc with a couple of diodes and limit the current with a resistor as follows;
    PICAXE RS232 INPUT.png

    If you look in PICAXE manual 3 page 44 it shows the "PICAXE recommended" handling of RS232.

  7. #17
    Senior Member
    Join Date
    Feb 2012
    Location
    London
    Posts
    2,896

    Default

    Hi,

    Quote Originally Posted by Greeper View Post
    So, if I just do a resistor array of 10K and 22K just like the download circuit, but on C.3, that should save my Picaxe rather than using the MAX232? Since C.4 is TX should not be affected, right?
    So you didn't put a resistor in series with the (c.3) input?

    A series resistor is nearly always recommended to help the internal "electrostatic protection" diodes do their job. Particularly with PIC{axe} chips because nearly all inputs can be "accidentally" configured as an output by a software mistake; An output "talking" to another output is quite a good way to damage chips.

    But c.3 (on an M2) is a rather "special" pin because it's the "base" PIC's MR and "high voltage" Programming input pin. So it doesn't have a clamping diode to the supply rail and can be pulled above the supply rail (tolerant up to about 9v IIRC). Therefore, if you want to use that as an "RS232" (voltage levels) input then you should use a 22k series resistor and a diode from the pin to the supply rail (the 10k is generally optional, but must be used for the PICAXE programming input pin).

    To conclude, a MAX232 is only needed if a signal inversion is required (but there are cheaper methods) or if RS232 output levels are required (i.e. >5v and <0 volts), but in practice almost no systems actually need these now.

    Cheers, Alan.

  8. #18
    New Member
    Join Date
    Mar 2012
    Location
    Indiana
    Posts
    8

    Default

    Well, resistors in place. I didn't have diodes, but I designed it in the PCB, so I took a chance anyway. All night with the delays down to 1 second, so I sent the request and received a response around 50,000 times. In actual usage it will have the diodes and will message once a minute, so I think I have a winning solution.

    I'm attaching an early schematic for those looking to try this. It's not up to date as far as diode values and R2 isn't right yet (I didn't have a 180 so I wondered about a 220, which I did have and it worked).

    Anyway, thanks all for the help!
    RS232 Picaxe.jpg

Bookmarks

Posting Permissions

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