Announcement

Collapse
No announcement yet.

COMM SET and PARITY

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • COMM SET and PARITY

    I'm programming big led displays with rs232 connectivity and faced with parity problem.
    It seems that combination
    COMM SET #hComm, PARITY = %TRUE
    COMM SET #hComm, PARITYTYPE = 3
    doesn't work with v9.0.
    Tested with Serial data logger programms and got paritytype = 0, since other programms can set up paritytype > 0.

    Can someone be able to run simple test with rs232 devices to check whether the paritytype can be >0 ?

    Many thanks,
    Aslan.

  • #2
    Aslan,
    Got a sample? I work with Serial Port all the time, so this would be a new one to me???
    Engineer's Motto: If it aint broke take it apart and fix it

    "If at 1st you don't succeed... call it version 1.0"

    "Half of Programming is coding"....."The other 90% is DEBUGGING"

    "Document my code????" .... "WHYYY??? do you think they call it CODE? "

    Comment


    • #3
      Aslan,

      What are the BYTE and STOP settings?

      If you set BYTE = 8, STOP = 1 and PARITYTYPE = 3; the sent character would appear exactly the same as BYTE = 8, STOP = 2 and PARITYTYPE = 0.

      Is there also a problem with PARITYTYPEs 1 and 2?

      To me PARITYTYPEs 3 and 4 seem pretty useless unless you're padding BYTE = 7 at one end to look like BYTE = 8 at the other end.

      Cheers,
      Dale

      Comment


      • #4
        here is the code,
        Code:
        COMM OPEN "\\.\COM1" AS 1
        IF ERRCLEAR THEN EXIT FUNCTION       ' Exit if port cannot be opened
        COMM SET 1, BAUD     = 9600    ' 9600 baud
        COMM SET 1, STOP     = 0         ' 1 stop bit
        COMM SET 1, BYTE     = 8         ' 8 bits 
        COMM SET 1, PARITY   = %TRUE ' tested even with PARITY = 1
        COMM SET 1, PARITYTYPE = 3    ' MARK - setup first line
        COMM SEND 1, CHR$(0,0,0,&h11,0,0,"ABCDEF")
        COMM CLOSE 1
        There are no return values from device, it receives only commands.

        Parity 3 used in conjuction with Flow = NONE used to control first line on led
        Parity 4 used in conjuction with Flow = Xon/Xoff used to control second line on led.

        I've tested all possible combinations and no luck. The log file sais that pairty is 0....


        Also, I couldn't setup following lines using internal PB commands:
        Code:
                IOCTL_SERIAL_SET_HANDFLOW - Request sets the configuration of handshake flow control
                    ControlHandShake - 0x1 (SERIAL_DTR_CONTROL)
                    FlowReplace - 0x40 (SERIAL_RTS_CONTROL)
                    XonLimit - 512
                    XoffLimit - 512
        Log lines after running my prog.
        Code:
                   ControlHandShake - 0x1 (SERIAL_DTR_CONTROL)
                   FlowReplace - 0x42 (SERIAL_AUTO_RECEIVE | SERIAL_RTS_CONTROL)
                   XonLimit - 2048
                   XoffLimit - 512
        Last edited by Aslan Babakhanov; 15 Sep 2008, 01:45 AM.

        Comment


        • #5
          Wrong OPEN syntax for COM1? My help file (8.03, version in use not shown) says of COMM OPEN..
          Restrictions ..... When opening ports above COM9, Windows requires the port name to be specified using the following syntax:
          Code:
          COMM OPEN "\\.\COM15" AS #hComm
          The underline of "above" [COM9] is in the help file.

          (Not that what Windows wants should mean anything. COMM OPEN is a PowerBASIC function... what should matter is what PowerBASIC wants!)

          (COMM is not one of my areas of competence. This is just an idea.)
          Last edited by Michael Mattias; 15 Sep 2008, 09:45 AM.
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            All,

            Thanks for your suggestions.
            I got correct com connection/transfer by playing with different settings.

            These commands

            COMM SET #nComm, STOP = 0
            COMM SET #ncomm, BYTE = 8
            COMM SET #ncomm, DTRLINE = %TRUE ' SERIAL_DTR_CONTROL
            COMM SET #ncomm, RTSFLOW = 1 ' SERIAL_RTS_CONTROL
            COMM SET #nComm, PARITY = %TRUE
            COMM SET #nComm, PARITYTYPE = 3
            COMM SET #nComm, PARITYCHAR = 0
            COMM SET #nComm, PARITYREPL = %FALSE

            performs the operations below:
            ControlHandShake - 0x1 (SERIAL_DTR_CONTROL)
            FlowReplace - 0x40 (SERIAL_RTS_CONTROL)

            with parity enabled.

            Aslan.

            Comment

            Working...
            X