WaveWare SPS5 V9 Especificaciones Pagina 33

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 59
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 32
Appendix C – TAP Checksum Calculation
Following is a sample Visual Basic™ code, that creates a string to be sent to the paging encoder. A subset of the
string has a checksum calculation performed on it, and then the checksum and a control character are appended
to form the string to be sent to the paging system. Refer to the TAP specification for more details on the
checksum calculation.
'String that checksum is calculated on, of the form:
‘<STX>ID<CR>Message<CR><ETX>
TXString$ = Chr(2) & txtID.Text & Chr(13) & txtMessage.Text & Chr(13) & Chr(3)
'Calculate and append checksum
j = 1
Sum = 0
Do Until j > Len(TXString$)
B$ = Mid(TXString$, j, 1)
D = Asc(B$)
Sum = Sum + D
j = j + 1
Loop
'Create the three characters to be transmitted to represent this checksum.
d3 = 48 + Sum - Int(Sum / 16) * 16
Sum = Int(Sum / 16)
d2 = 48 + Sum - Int(Sum / 16) * 16
Sum = Int(Sum / 16)
d1 = 48 + Sum - Int(Sum / 16) * 16
Check1$ = Chr$(d1)
Check2$ = Chr$(d2)
Check3$ = Chr$(d3)
CheckSum$ = Check1$ & Check2$ & Check3$
'Create complete string to be sent to paging system, of the form:
‘<STX>ID<CR>Message<CR><ETX>Checksum<CR>
TXString$ = TXString$ & CheckSum$ & Chr(13)
Vista de pagina 32
1 2 ... 28 29 30 31 32 33 34 35 36 37 38 ... 58 59

Comentarios a estos manuales

Sin comentarios