Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interfacing Visual Basics with 89c51 microcontroller.

Status
Not open for further replies.

kamalkumarkalra

Newbie level 4
Joined
Dec 4, 2007
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
INDIA
Activity points
1,326
vb.net microcontroller

i want to design the form in the VB 6 to transfer data to microcontroller and it will be displayed on the 2x16 lcd. i need help, how to make a form and code for the same. i am using assembly language for microcontroller. Can any one help me.
 

microcontroller basics

Hi,

In VB you have options to set connections via COM1, COM2 ports. You need to add a port in your form. The front end can have a data base to store the entry. Once your microcontroller is on, and VB is executed, the from will connect the microcontroller to the system via the hardware wire through the port configured.
And the assembly code has to treat this interupt as an I/O to store it or process it directly to the lcd display driver. This is a nutshell view of what u r looking for.
 

microcontroller basics89c51

Thanking you for giving the idea, can u help me to make a form to send data to LCD from VB . i m using mscom component in the VB. i do not know how to us this component and programming for transfering the data. if u know so plz help me.
 

programming microcontroller with vb.net

If you want to look at sample project with VB6 and serial port, take a look at this page on CodeProect: https://www.codeproject.com/KB/vb-interop/CommConfig.aspx
I wrote that code and I reuse it ever since.

P.S. CodeProject is currently being updated, so my project page might be temporarily inaccessible (Dec 6, 2007)
P.P.S. It looks like a lot of embedded developers (if not most of them; myself included) use old VB6 for programming PC hosts. Why not switch to VB.NET?
 

89c51 projects visual basic communication

Hi Here is some VB code I'm using to communicate with outside world I read the code of a Dallas iButton that is send by a PIC16F627
NOTE: I only recieve 8 characters at a time
This part go in the bigining of your startup form to setup the comm control
Code:
   '************************************
   Dim Instring As String
   MSComm1.CommPort = 1
   MSComm1.RThreshold = 8                 'wait until buffer have 8 characters then perform comm event
   MSComm1.Settings = "2400,N,8,1"
   MSComm1.InputLen = 8
   MSComm1.PortOpen = True
'************************************
This part is a loop where the program wait for a comm event to take place and exit the loop as soon as characters arive at the comm port
Code:
While KeyCode = ""
DoEvents
Wend
And this part you can paste in Private Sub MSComm1_OnComm()
NOTE: This is the event driven method I'm not using all the events but I always include it in case I need it
Code:
'**********************************************
   Select Case MSComm1.CommEvent
   ' Handle each event or error by placing
   ' code below each case statement

   ' Errors
      Case comEventBreak   ' A Break was received.
      Case comEventFrame   ' Framing Error
      Case comEventOverrun   ' Data Lost.
      Case comEventRxOver   ' Receive buffer overflow.
      Case comEventRxParity   ' Parity Error.
      Case comEventTxFull   ' Transmit buffer full.
      Case comEventDCB   ' Unexpected error retrieving DCB]

   ' Events
      Case comEvCD   ' Change in the CD line.
      Case comEvCTS   ' Change in the CTS line.
      Case comEvDSR   ' Change in the DSR line.
      Case comEvRing   ' Change in the Ring Indicator.
      Case comEvReceive   ' Received RThreshold # of
                        ' chars.
    Dim Chain  As String
    Dim ChainASCII As String
    Dim Character As String
    Dim CodeCharacter As Integer
    Dim Dummy As String
    Dim Letter  As String
    Dim Counter As Integer
    
    'Form1.MSComm1.Output = "SSA"              'Send  Acnolage to PIC
    If (Form1.MSComm1.InBufferCount > 0) Then
       Chain = Form1.MSComm1.Input       ' +
    
       Text1.Text = Chain
       Text1.SelStart = Len(Chain)
        
        ChainASCII = ""
        For Counter = 1 To Len(Chain)
            Character = Mid(Chain, Counter, 1)
            CodeCharacter = Asc(Character)
            Letter = Hex(CodeCharacter)
            ChainASCII = ChainASCII + Letter
        Next Counter
       
        KeyCode = Right(ChainASCII, 11)
        Gate = Left(ChainASCII, 1)
        If Left(KeyCode, 1) > 0 Then KeyCode = 0 & Right(KeyCode, 10)
        
       
        End If
        
        Form1.MSComm1.Output = "SSA"      'This string is send to the PIC
       If (Form1.MSComm1.InBufferCount <> 8) Then
    Form1.MSComm1.InputLen = 0
    Dummy = Form1.MSComm1.Input
   
    Form1.MSComm1.InputLen = 8
    End If
      Case comEvSend   ' There are SThreshold number of
                     ' characters in the transmit
                     ' buffer.
      Case comEvEOF   ' An EOF charater was found in
                     ' the input stream
   End Select
'******************************************
 

mscomm1 frame error

its better you learn a little visual basic it is very easy, i learned it from some tutorials on the net. since then i have developed numerous projects using it. tell me if you have problems with it
 

vb cho 89c51

kender said:
If you want to look at sample project with VB6 and serial port, take a look at this page on CodeProect: https://www.codeproject.com/KB/vb-interop/CommConfig.aspx
I wrote that code and I reuse it ever since.

P.S. CodeProject is currently being updated, so my project page might be temporarily inaccessible (Dec 6, 2007)
P.P.S. It looks like a lot of embedded developers (if not most of them; myself included) use old VB6 for programming PC hosts. Why not switch to VB.NET?
Hi Kender, can you tell me why not VB.net in the old gwbasic and Qbasic, it was very easy to use the comm. port, the same as open a file an read or write to it for example:
Code:
 open comm1:1400,8,n,1 for input as #1
do while not EOF(1)
x=x+1
input #1,var(x)
loop
close #1
but MS have to made it more and more complicated with every new version of VB now I stick to VB6, I can do with it what I need it for, to install VB.net is a mission on its own.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top