Link to home
Start Free TrialLog in
Avatar of wmchew
wmchew

asked on

Retrieving the Appropriate Bits From Data

Hi All,

I have a problem. I will be using VB6 to code an application to retrieve the appropriate bits from the data. This application will communicate with Device 1, whilst Device 2 can only communicate with Device 1. The application in the PC will always poll Device 1 for data, whilst Device 1 will poll Device 2 for data. The data is stored in the buffer of the device. The protocol is as follows:-

<Head><Type><Level><ID><Command><Length><Data>
    01         01       01       01         4fH            n        12bytes

When <Level> = 2, this show that PC is polling for Device 2 data. Device 1 will start to poll data in Device 2 buffer. The data will then transfer from Device 2 buffer to Device 1 buffer. how can I code in VB to send this command to poll for device 2. After getting the data, how can i abstract the last 6 bytes from the data and drop the first 6 bytes?

thanks you
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And to drop the first 6 bytes

strRestOfBuffer = Mid$(strFullBuffer, 7)

Avatar of wmchew
wmchew

ASKER

hi GrahamSkan,

Ok. Let me be more detail. I have this application(coded in VB6) in PC monitoring 2 card access readers. They are both installed on a different floor of a building. These access readers actually stores the swipe card records in the readers. this application will always poll for data from reader in the 1st level(the one nearest PC) whilst PC can only communicate with reader 2 through reader 1.

As you can see from the protocol, when the level = 2, that mean PC wanted to poll data from reader 2(in 2nd level). Then reader 1 will recognise this and poll for data in reader 2 which was stored in buffer. The data was then transferred from reader 2 buffer to reader 1 buffer, finally to PC.

How should I code this part.

Secondly, after getting this data how can I abstract the last 6 bytes of the 12 bytes data?

thanks.
Avatar of wmchew

ASKER

BTW, the devices can communicate. and the communication standard is RS485.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
PS.
or reverse according BigEndian/LittleIndian bytes order