How to send data from computer to pic

Lempo

Học sinh phổ thông
#1
Hi master,
Currently I am using mikroC as my compiler, and sometime I use too CCS behind my MikroC.

I need some help from you here, how can i write code to send a data from computer to PIC, I use software to write code using Visual Basic 6.0.

Small VB 6.0 code error:

Mã:
 Private Sub MSComm1_OnComm ()

Select Case MSComm1.CommEvent

Case comEvReceive

'Dim StringIn As String

If MSComm1.CommEvent = comEvReceive Then

UARTrd = MSComm1.Input

        
    MikroC.Caption = UARTrd 'Read data from Microcontroller
  
   End If
   End Select
E
   [/ CODE]
[
{
                     UART1_Write_Text ("Microcontroller Connected"); // Send data to VB
                     UART1_Write (13);
                     UART1_Write (10);
                    break;
                    }
[/ CODE]

Detail what I Want:
I write code in VB 6.0 with text, then từ văn bản I write some text "hello" và trong PIC sẽ được nhận dữ liệu rồi hiển thị trong LCD 2x16.

So could anyone here help me please.

Thanks.
E
 

BuiBachTuanAnh

Quản trị viên
Thành viên BQT
#2
Hi master,
Currently I am using mikroC as my compiler, and sometime I use too CCS behind my MikroC.

I need some help from you here, how can i write code to send a data from computer to PIC, I use software to write code using Visual Basic 6.0.

Small VB 6.0 code error:

Mã:
 Private Sub MSComm1_OnComm ()

Select Case MSComm1.CommEvent

Case comEvReceive

'Dim StringIn As String

If MSComm1.CommEvent = comEvReceive Then

UARTrd = MSComm1.Input

       
    MikroC.Caption = UARTrd 'Read data from Microcontroller
 
   End If
   End Select
E
   [/ CODE]
[
{
                     UART1_Write_Text ("Microcontroller Connected"); // Send data to VB
                     UART1_Write (13);
                     UART1_Write (10);
                    break;
                    }
[/ CODE]

Detail what I Want:
I write code in VB 6.0 with text, then từ văn bản I write some text "hello" và trong PIC sẽ được nhận dữ liệu rồi hiển thị trong LCD 2x16.

So could anyone here help me please.

Thanks.
E
Hi Lempo !
You can reference at https://codientu.org/threads/lap-trinh-giao-tiep-vb6-voi-vdk-qua-rs232.1492/
Hope to help you.
 

Lempo

Học sinh phổ thông
#3
Hi BuiBach TuanAn,
Firstly thank you for respond my problem.
I was making it similiar like that reference, it's working very well, I converting from CCS to MikroC.
Still confused to send the text from PC to Hardware PIC, could you please give me some sample how to write to sending text from VB.6.0 to PIC ?.
Please sample for VB.6.0 and MikroC or CCS compiler.

Thank you for help.
Thanks.
Empo.
 

Quảng cáo Google