how to write interrupt service routines a serial port device.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srikanth123456
    New Member
    • Jan 2007
    • 16

    how to write interrupt service routines a serial port device.

    whether windows.h is supported in C language if so how to include it in c library.

    can u also help me by giving concepts for the interrupt handling phenomenon in C language for a device at serial port.

    how to sent 8 bytes of data to a serial port device
    i tried with inportb( ),outportb( ),they are used for only the one byte only.
    Last edited by srikanth123456; Feb 2 '07, 06:37 AM. Reason: spelling and grammar
  • horace1
    Recognized Expert Top Contributor
    • Nov 2006
    • 1510

    #2
    Originally posted by srikanth123456
    whether windows.h is supported in C language if so how to include it in c library.

    can u also help me by giving concepts for the interrupt handling phenomenon in C language for a device at serial port.

    how to sent 8 bytes of data to a serial port device
    i tried with inportb( ),outportb( ),they are used for only the one byte only.
    how interrupts are handled depends upon the compiler - which one are you using?
    also operating systems such as Windows XP will not let user programs access I/O ports, etc. - are you using Windows 95/98?
    to write 8 bytes to the serial port you use a loop and write a byte at a time checking that the transmit buffer is empty beore loading the next byte.

    Comment

    • srikanth123456
      New Member
      • Jan 2007
      • 16

      #3
      windows2000,tur bo c compiler.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        You should be able to use the functions

        CreateFile
        ReadFile(Ex)
        WriteFile(Ex)
        CloseHandle

        from the WIN32 API to access a serial port, the following functions are also useful in configuraing the port



        BuildCommDCB
        BuildCommDCBAnd Timeouts
        ClearCommBreak
        ClearCommError
        CommConfigDialo g
        EscapeCommFunct ion
        GetCommConfig
        GetCommMask
        GetCommModemSta tus
        GetCommProperti es
        GetCommState
        GetCommTimeouts
        GetDefaultCommC onfig
        PurgeComm
        SetCommBreak
        SetCommConfig
        SetCommMask
        SetCommState
        SetCommTimeouts
        SetDefaultCommC onfig
        SetupComm
        TransmitCommCha r
        WaitCommEvent

        I believe that Turbo C++ has access to the windows API.

        Comment

        Working...