Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Hardware and Devices

HI! Can some one out there give me a very simple program that includes hardwares or devices? I just know how to program in software aspect only and I just want to put my program on devices. Thank You!

Comments

  • IDKIDK Posts: 1,784Member
    : HI! Can some one out there give me a very simple program that includes hardwares or devices? I just know how to program in software aspect only and I just want to put my program on devices. Thank You!
    :
    If you got windows, go and check all the devices installed at the device handler (i don't know what it's named). There you'll find wich IRQ, ports and memmory it uses. Try to send some data to the ports, or change some memmory.

    This is a simple chat program that uses the null modem cable between two computers:
    [code]
    CLS
    port1 = &H3F8
    OUT port1 + 1, 0 ' Turn off interrupts - Port1

    ' /* PORT 1 - Communication Settings */
    dllb = &H3
    dlhb = &H0
    OUT port1 + 3, &H80 '/* SET DLAB ON */
    OUT port1 + 0, dllb '/* Set Baud rate - Divisor Latch Low Byte */
    '/* Default 0x03 = 38,400 BPS */
    '/* 0x01 = 115,200 BPS */
    '/* 0x02 = 57,600 BPS */
    '/* 0x06 = 19,200 BPS */
    '/* 0x0C = 9,600 BPS */
    '/* 0x18 = 4,800 BPS */
    '/* 0x30 = 2,400 BPS */
    OUT port1 + 1, dlhb '/* Set Baud rate - Divisor Latch High Byte */
    OUT port1 + 3, &H3 '/* 8 Bits, No Parity, 1 Stop Bit */
    OUT port1 + 2, &HC7 '/* FIFO Control Register */
    OUT port1 + 4, &HB '/* Turn on DTR, RTS, and OUT2 */

    DO
    a$ = INKEY$
    c = INP(port1 + 5)'Check to see if char has been received.
    IF (c AND 1) THEN
    in = INP(port1)
    IF in = 8 AND LEN(in$) THEN
    in$ = MID$(in$, 1, LEN(in$) - 1)
    ELSEIF in = 8 AND LEN(in$) = 0 THEN
    ELSE
    in$ = in$ + CHR$(in)
    END IF
    END IF
    IF LEN(a$) THEN
    IF a$ = CHR$(8) AND LEN(out$) THEN
    out$ = MID$(out$, 1, LEN(out$) - 1)
    OUT port1, ASC(a$)
    ELSEIF a$ = CHR$(8) AND LEN(out$) = 0 THEN
    ELSE
    out$ = out$ + a$
    OUT port1, ASC(a$)
    END IF
    END IF
    GOSUB drawscreen
    tt = tt + 1
    IF TIMER - t > 1 THEN hertz = tt: tt = 0: t = TIMER
    LOOP UNTIL a$ = CHR$(27)
    END

    drawscreen:
    LOCATE 1, 1, 0
    PRINT " IN OUT ?"
    in = 0
    ut = 0
    FOR a = 0 TO 19
    PRINT "";
    b = 0
    DO
    in = in + 1
    b$ = MID$(in$, in, 1)
    IF b$ = CHR$(13) OR in > LEN(in$) THEN EXIT DO ELSE PRINT b$;
    b = b + 1
    LOOP UNTIL b = 38
    IF NOT b = 38 THEN PRINT SPACE$(38 - b);
    PRINT "";
    b = 0
    DO
    ut = ut + 1
    b$ = MID$(out$, ut, 1)
    IF b$ = CHR$(13) OR ut > LEN(out$) THEN EXIT DO ELSE PRINT b$;
    b = b + 1
    LOOP UNTIL b = 39
    IF NOT b = 39 THEN PRINT SPACE$(39 - b);
    PRINT ""
    NEXT
    PRINT "?"
    baud = 115200 / (dlhb * 256 + dllb)
    PRINT TIME$; " "; DATE$; " Port: 0x"; HEX$(port1); " Baud rate:"; SPACE$(7 - LEN(STR$(baud))); baud; " Hertz:"; SPACE$(5 - LEN(STR$(hertz))); hertz
    RETURN
    [/code]

    My ascii isn't that nice...
Sign In or Register to comment.