need help in RS-232 programming

Discussion in 'Programmer's Corner' started by nube01, Sep 12, 2009.

  1. nube01

    Thread Starter New Member

    Sep 10, 2009
    hi all,

    does anyone know how to write a program (in any language) to interface the input from a bluetooth device plugged in a PC through RS-232 serial port to a PIC 16f84 IC?

    i only need the program for bluetooth interfacing, for example, when I press a button on the bluetooth device, the program (that i need) is able to transmit the information of the particular button through the RS-232 serial port to the PIC 16f84 IC.

  2. beenthere

    Retired Moderator

    Apr 20, 2004
  3. nube01

    Thread Starter New Member

    Sep 10, 2009
    Thks 'beenthere' for your help, i've visited the link, and read it through, thks very much :)

    i've found a program but do not know whether is it what i want? The program:

    #include <bios.h>
    #include <conio.h>
    #define COM1 0
    #define DATA_READY 0x100
    #define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
    int main(void)
    int in, out, status;
    bioscom(0, SETTINGS, COM1); /*initialize the port*/
    cprintf("Data sent to you: ");
    while (1)
    status = bioscom(3, 0, COM1); /*wait until get a data*/
    if (status & DATA_READY)
    if ((out = bioscom(2, 0, COM1) & 0x7F) != 0) /*input a data*/
    if (kbhit())
    if ((in = getch()) == 27) /* ASCII of Esc*/
    bioscom(1, in, COM1); /*output a data*/
    return 0;