Need help from PIC16F877A to VB2008 through rs232 serial port

fyee

Joined Mar 7, 2010
16
I'm actually facing the same problem.
For my project, the output from PIC16F877A will be weight, and then voice announcing the signal by using VB. A friend of mine tried this before by using Parallel port, what if I'm using a serial port? Any circuit should I build for that?
I need pro to help in solving my problem too.
Thanks. ;)
 

symqwerty

Joined Feb 22, 2010
31
PIC16f877A have built-in UART and i think that you know how to program it. If your PC dont have COM port, then you have 2 options, either buying USBtoRS232 cable converter or FTD232R chip. As far as i know, the cable comes with cd driver. why we need driver?because data was sent using USB protocol. So, after you install the driver plug in the cable, the cable itself will appear as VIRTUAL rs232 port. By now, you can serve it as rs232 port(you DONT have to know any about USB.)

VB2008 allowed you to use .NET component. There is a class known as serialPort. The component is inside System.IO.Ports. After instantiate the object, you need to set the 'rs232' properties such as baudrate, handshaking and etc. I have an example that written in C#(.NET) and VB6(using mscomm32.ocx). Dont get confuse with the syntax but look how I write it. Sorry for the language that i use. If needed, i will try to get codes from my final year project which i wrote it using VB.NET
http://symqwerty.blogspot.com/2010/02/serial-port-rs232-protocol.html

Bear in mind that the baud rate must tally with the oscillator freq used. You can check PIC datasheet for that info.
 

sgkho

Joined Feb 2, 2012
11
hi there, i new to this forum n pic-vb2008 communication needed some guide. As same as holybrings . I doing in the serial communication (software part) n the level converter n rs232 converter (usb to rs232) are ready. My project is turn on/off the sensor so do it same as wht previously discuss with the led turn on/off program ? Here are my partly hardware code :

Rich (BB code):
#include<pic.h>
//#define XTAL_FREQ    20Mhz    //one may choose this argument or the one below
#define PIC_CLK == 20000000  //be sure to include this argument;this argument is inside delay.h
// the above 2 statement define the frequency of oscillator used;choose either one
#include"delay.h"
//__CONFIG(0x3F32); in this case might be not important because pin assignment has been defined
#define SW1    RB0
#define SW2    RB1
#define LED1    RB6
#define LED2    RB7
#define buzzer     RB2

//------function prototype-------//
void delayS(int sec);
void delaymS(int msec);

//----global variable---------//



//------main program-------//
void main()
{
    int flag;
    TRISB=0x03;
    LED1=0;
    LED2=0;
    buzzer=0;
    
    while(1)
    {                //checking if the sw1 is pressed
        if(SW1==0)
            LED1=1;
        if(SW1==1) 
            LED1=0;    
        if(SW2==0)
            LED2=1;
        if(SW2==1)
            LED2=0;
    /*    if(LED1==1 || LED2==1)
            buzzer=1;
        else
            buzzer=0;*/
    }
}
 
Top