Shop OBEX P1 Docs P2 Docs Learn Events
serial com — Parallax Forums

serial com

ArchiverArchiver Posts: 46,084
edited 2003-02-22 00:24 in General Discussion
how do I turn off the full duplex mode when using a
stamp BS2 with a MS PC basic program? It gets
annoying re-hitting keys because of the echo . . . is
there a trick around this at both ends? Thanks . . .

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-09-25 17:05
    The hardwared design of the Stamp serial interface on the programming port
    causes the echo -- there is no way to turn it off. You can use standard pins
    (P0 - P15) for SERIN and you won't get the echo.

    If you *need* to use the programming port, your PC program can filter out the
    echos since it knows that anything sent will be kicked back.

    -- Jon Williams
    -- Parallax


    In a message dated 9/25/02 8:48:13 AM Central Daylight Time,
    jrem123@y... writes:


    > how do I turn off the full duplex mode when using a
    > stamp BS2 with a MS PC basic program? It gets
    > annoying re-hitting keys because of the echo . . . is
    > there a trick around this at both ends?




    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-09-29 20:43
    How Do you turn on the filter on a pc?
    My Toshiba Laptop Dose filter the echo but my PC will not filter the echo
    I ave checked the system setting they are both set the same the LT works hte
    PC does not.

    Regards Larry
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-21 15:51
    hello,

    I'm a student in computer science,(I doesn't speak english very well,
    sorry), I would like to create a program to
    communicate with my basic stamp 2e by serial port. But, there is a
    problem, if I start my program, the basic stamp stop.

    This is my program :
    // Compiled with DJGPP

    #include <stdio.h>
    #include <conio.h>
    #include <pc.h> // if you use borland, replace this line
    // by #include <dos.h>

    #define COM1 0x03F8
    #define COM2 0x02F8
    #define COM3 0x03E8
    #define COM4 0x02E8

    #define COMx COM1

    #define TxD COMx
    #define RxD COMx
    #define DLLB COMx
    #define IER (COMx + 1)
    #define DLHB (COMx + 1)
    #define IIR (COMx + 2)
    #define FCR (COMx + 2)
    #define LCR (COMx + 3)
    #define MCR (COMx + 4)
    #define LSR (COMx + 5)
    #define MSR (COMx + 6)

    void Init_COMx(void)
    {
    outportb(LCR , 0x80);
    outportb(DLLB , 0x0C); // 9600 bauds
    outportb(DLHB , 0x00);
    outportb(LCR , 0x03); // 1 bit stop
    }

    char Recept_car(void)
    {
    while((inportb(LSR) & 0x01) != 0x01);
    return(inportb(RxD));
    }

    int main(void)
    {
    char Reception;

    Init_COMx();
    Reception = (char)0;

    while(Reception != 27)
    {
    Reception = Recept_car();
    if (Reception != 0)
    printf("%c\n", Reception);
    else
    printf("_RIEN_\n");
    }

    return 0;
    }

    and this my program on my basic stamp :

    '{$STAMP BS2e}

    '
    ' EMISSION / RECEPTION
    '

    Rx con 8
    Tx con 9
    TxFlow con 10

    N9600 con $40F0

    '
    ' ROBOT BUG
    '

    valeur var byte

    valeur = 65
    Main:
    serout 16, N9600, [noparse][[/noparse]valeur]
    pause 100
    goto Main

    The basic programm send the caractere "A" and my program on the PC
    recept the caractere and show it on the screen, but it doesn't work !!

    please, help me....
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-21 16:10
    My guess is that you need to disable DTR from the PC either in software
    or with a jumper. You can also put a capacitor in series with DTR (ATN
    on the Stamp) as shown in the Stamp manual. This prevents the PC from
    resetting the Stamp with a steady signal, but still allows the reset
    pulse used by the programmer to pass.

    Al Williams
    AWC
    * NEW: PAK-VIa - Read PS/2 keyboards or mice -- double the buffer, lower
    current consumption.
    http://www.al-williams.com/awce/pak6.htm




    >
    Original Message
    > From: megakyle2003 <hchris@v...> [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=aJxkISdNkRHqizC5OnQ-DH96xxfRDnoCjvEWXyLHIsWzx4OAjpeDpW9eOM8BSWWkrAXOnDdCWLU7]hchris@v...[/url
    > Sent: Friday, February 21, 2003 9:52 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] serial com
    >
    >
    > hello,
    >
    > I'm a student in computer science,(I doesn't speak english very well,
    > sorry), I would like to create a program to
    > communicate with my basic stamp 2e by serial port. But, there is a
    > problem, if I start my program, the basic stamp stop.
    >
    > This is my program :
    > // Compiled with DJGPP
    >
    > #include <stdio.h>
    > #include <conio.h>
    > #include <pc.h> // if you use borland, replace this line
    > // by #include <dos.h>
    >
    > #define COM1 0x03F8
    > #define COM2 0x02F8
    > #define COM3 0x03E8
    > #define COM4 0x02E8
    >
    > #define COMx COM1
    >
    > #define TxD COMx
    > #define RxD COMx
    > #define DLLB COMx
    > #define IER (COMx + 1)
    > #define DLHB (COMx + 1)
    > #define IIR (COMx + 2)
    > #define FCR (COMx + 2)
    > #define LCR (COMx + 3)
    > #define MCR (COMx + 4)
    > #define LSR (COMx + 5)
    > #define MSR (COMx + 6)
    >
    > void Init_COMx(void)
    > {
    > outportb(LCR , 0x80);
    > outportb(DLLB , 0x0C); // 9600 bauds
    > outportb(DLHB , 0x00);
    > outportb(LCR , 0x03); // 1 bit stop
    > }
    >
    > char Recept_car(void)
    > {
    > while((inportb(LSR) & 0x01) != 0x01);
    > return(inportb(RxD));
    > }
    >
    > int main(void)
    > {
    > char Reception;
    >
    > Init_COMx();
    > Reception = (char)0;
    >
    > while(Reception != 27)
    > {
    > Reception = Recept_car();
    > if (Reception != 0)
    > printf("%c\n", Reception);
    > else
    > printf("_RIEN_\n");
    > }
    >
    > return 0;
    > }
    >
    > and this my program on my basic stamp :
    >
    > '{$STAMP BS2e}
    >
    > '
    > ' EMISSION / RECEPTION
    > '
    >
    > Rx con 8
    > Tx con 9
    > TxFlow con 10
    >
    > N9600 con $40F0
    >
    > '
    > ' ROBOT BUG
    > '
    >
    > valeur var byte
    >
    > valeur = 65
    > Main:
    > serout 16, N9600, [noparse][[/noparse]valeur]
    > pause 100
    > goto Main
    >
    > The basic programm send the caractere "A" and my program on
    > the PC recept the caractere and show it on the screen, but it
    > doesn't work !!
    >
    > please, help me....
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-22 00:24
    A software alternative to Al's hardware solution is to de-assert DTR
    from within your program. That's how I do a lot of my PC<->Stamp
    communications.

    Looks like you want add something like this in your Init_COMx
    procedure:

    outportb(MCR , inportb(MCR) & 0xFE); // deassert DTR

    Setting DTR (the low order bit of the modem control register) will
    hold your Stamp in reset, so you want to clear it and keep it that
    way throughout your program. Then your hard-wired programming cable
    will work fine for programming and communication.

    Also, to specify 9600 inverted on your BS2e, use baud value 16468 or
    $4054 rather than $40F0.

    Regards,

    Steve
Sign In or Register to comment.