Home > Software engineering >  Using VB to how to carry out parallel communication?
Using VB to how to carry out parallel communication?

Time:11-02

Do you want to be a bluetooth address since the interface of writing bluetooth chip, after the success of the writing in the interface address automatically add a, continue to the next address input of IC.

Going to do with VB interface will start address entered into the interface, click the "enter" button, the bluetooth address through the mainframe computer parallel port output, output to the parallel port transfer board (models for IDS - 1309 - c, taobao bought http://item.taobao.com/item.htm? Id=4456008392) in by writing bluetooth IC SPI.

Question 1: how to get the interface of the data (both bluetooth address) output to the parallel port (VB how to carry out parallel communication)?

Question 2: estimated by computer parallel simulation SPI communication, 25 pin parallel simulation SPI communication? General idea is how?

CodePudding user response:

Some troubles than serial port, reference,

CodePudding user response:

Reference here

CodePudding user response:

Using general need to use the parallel port driver stage dynamic link library, such as WinIO. DLL is more complex, however, two upstairs had already given example, I am no longer a question,

CodePudding user response:

Thank you very much, must be carefully reference,

CodePudding user response:

WINIO that seemingly under WIN9X dongdong.

CodePudding user response:

Some troubles than serial port

CodePudding user response:

reference 5 floor wallescai reply:
WINIO that seemingly under WIN9X dongdong.

XP is to be able to use the
http://download.csdn.net/source/2321502

CodePudding user response:


The things I did,

1 to download a Dllport. DLL library, such as there are two functions

Public Declare Function Inp Lib "DLLPORT. DLL" Alias "Inp32" (ByVal PortAddress As Integer) As Byte

Public Declare Sub Out Lib "DLLPORT. DLL" Alias "Out32" (ByVal PortAddress As an Integer, ByVal Value As Byte)

2 connected parallel and SPI line as follows:
'parallel port pin number parallel port pin name register address bits corresponding to the SPI pin
'11 state Busy 0 x379 Bit 7 MISO
'2 data Data0 0 x378 Bit 0 MOSI
'1 control Strobe 0 x37a Bit 0 SCK
7 '9 data Data7 0 x378 Bit/SS
'25 GND - GND

3 using VB to control/SS and clock line at the same time, reading and writing data line,

CodePudding user response:

refer to the eighth floor of123 response:
the things I did,

1 to download a Dllport. DLL library, such as there are two functions

Public Declare Function Inp Lib "DLLPORT. DLL" Alias "Inp32" (ByVal PortAddress As Integer) As Byte

Public Declare Sub Out Lib "DLLPORT. DLL" Alias "...

This fresh, whether specific?

CodePudding user response:

Can you specifically, don't use!

CodePudding user response:

So old posts can interpret,
Here are the two main module code:
 
'Declare Inp and Out for I/O port
Public Declare Function Inp Lib "DLLPORT. DLL" _
Alias "Inp32" (ByVal PortAddress As Integer) As Byte
Public Declare Sub Out Lib "DLLPORT. DLL" _
Alias "Out32" (ByVal PortAddress As an Integer, ByVal Value As Byte)

 
Option Explicit

Public SCKActive As Long
'As Clock, the/Strobe is the hardware inverted
Public Const SCKHighActive As Long=0
Public Const SCKLowActive As Long=1

Public SCKPhase As Long
Public Const SCKPhase1st As Long=0
Public Const SCKPhase2nd As Long=1

Public SCKFrequency As Long

Public BitSequence As Long
Public Const MSBFirst As Long=0
Public Const LSBFirst As Long=1

Public SCKHalf As Long
Public SampleFirst As Long
Public SampleDelta As Long

Const SSInactive As Byte=& amp; H80
Const SSActive As Byte=& amp; H0

Const DataPort As Integer=& amp; H378
Const StatePort As Integer=& amp; H379
Const ControlPort As Integer=& amp; H37A

Dim ByteToSend As Byte
Dim the Sample1 As Byte
Dim the Sample2 As Byte
Dim Sample3 As Byte
Dim ByteReceived As Byte
Dim As Integer I

Public Sub SCKDelay (ByVal X As Long)
The QueryPerformanceCounter T1
Do
The QueryPerformanceCounter T2
Loop Until (T2) lowpart - T1) lowpart) & gt;=X
End Sub

Public Sub SendByte (ByVal a As Byte)

ByteToSend=a
'set the clock to inactive
The Out ControlPort SCKActive Xor 1

The Out DataPort, SSActive

'If SCKPHA=1 then delay a half of a clock cycle
If SCKPhase=SCKPhase2nd Then SCKDelay SCKHalf

For I=1 To 8
'the data bit change
If BitSequence=MSBFirst Then
If (ByteToSend And & amp; H80) & gt; 0 Then
The Out DataPort, SSActive Or 1
The Else
The Out DataPort, SSActive
End the If
ByteToSend=((ByteToSend And & amp; H7F) * 2)
The Else
If ByteToSend And & amp; H1 & gt; 0 Then
The Out DataPort, SSActive Or 1
The Else
The Out DataPort, SSActive
End the If
ByteToSend=ByteToSend \ 2
End the If

'Switching clock
If SCKPhase=SCKPhase2nd Then
The Out ControlPort, SCKActive
The Else
Out ControlPort, SCKActive Xor (1)
End the If

SCKDelay SCKHalf

'Switching clock
If SCKPhase=SCKPhase1st Then
The Out ControlPort, SCKActive
The Else
Out ControlPort, SCKActive Xor (1)
End the If

SCKDelay SCKHalf

Next I

'If SCKPHA=0 then the switch clock to inactive and delay a half of a clock cycle
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related