MikroElektronika PIC Microcontrollers PIC16 Ficha de datos Pagina 131

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 194
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 130
Programming PIC Microcontrollers in BASIC - mikroElektronika
Prototype sub procedure RS485master_read(dim byref data as byte[5])
Description Master receives any message sent by Slaves. As messages are multi-byte, this procedure must be called for each
byte received (see the example at the end of the chapter). Upon receiving a message, buffer is filled with the
following values:
data[0..2] is actual data
data[3] is number of bytes received, 1..3
data[4] is set to 255 when message is received
data[5] is set to 255 if error has occurred
data[6] is the address of the Slave which sent the message
Procedure automatically sets data[4] and data[5] upon every received message. These flags need to be cleared
repeatedly from the program.
Note: MCU must be initialized as Master in 485 communication to assign an address to MCU
Example
RS485Master_Read(dat)
5.2.14.3 RS485Master_Write – Sends message to Slave
Prototype
sub procedure RS485Master_Write(dim byref data as byte[2], dim datalen as
byte, dim address as byte)
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/05.htm (89 sur 112)05/11/2004 02:20:53
Vista de pagina 130
1 2 ... 126 127 128 129 130 131 132 133 134 135 136 ... 193 194

Comentarios a estos manuales

Sin comentarios