Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/06/04 01:10
Read: times


 
#75524 - RE: RS232 - PC&51 communication
Responding to: ???'s previous message

You can use any protocol you wish! I gather your issue is having the PC know what input data it is receiving.

Personally I use Modbus protocol for a lot of my devices (www.modbus.org - or it may have changed) and in your instance Modbus ASCII would suffice. Or you just hijack the basic protocol and modify.

The first char of a data packet is ':'
Then each data byte is sent as two ascii hex chars '5E' for example
The packet is terminated by a CR (carriage return 13dec)

Thus the packet looks like this:
:01458711FF<CR>
In modbus ascii the last data byte is the checksum.

On the receive side, your code looks for the start token ':' then grabs the data until it gets the carriage return. Visual Basic has a 'lineinput' feature
that will do the trick here so you will get a character string with a data packet in it. Your code should convert the ascii hex back into values that are stored in a array. Your user interface code can then index into that array and pick out the input channel data it wants.


List of 15 messages in thread
TopicAuthorDate
RS232 - PC&51 communication            01/01/70 00:00      
   RE: RS232 - PC&51 communication            01/01/70 00:00      
      Not modem            01/01/70 00:00      
   RE: RS232 - PC&51 communication            01/01/70 00:00      
      Using VB6.0 OnComm            01/01/70 00:00      
         RE: Using VB6.0 OnComm            01/01/70 00:00      
      RE: RS232 - PC&51 communication            01/01/70 00:00      
   RE: RS232 - PC&51 communication            01/01/70 00:00      
      RE: RS232 - PC&51 communication            01/01/70 00:00      
         RE: RS232 - PC&51 communication            01/01/70 00:00      
         RE: RS232 - PC&51 communication            01/01/70 00:00      
   RE: RS232 - PC&51 communication            01/01/70 00:00      
      RE: RS232 - PC&51 communication            01/01/70 00:00      
    RS232 - VB&51 data transfer            01/01/70 00:00      
   RE: RS232 - PC&51 communication            01/01/70 00:00      

Back to Subject List