MikroElektronika PIC Microcontrollers PIC16 Datový list Strana 133

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 194
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 132
Programming PIC Microcontrollers in BASIC - mikroElektronika
Description Only messages that appropriately address Slaves will be received. 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
rest of the buffer is undefined
Procedure automatically sets data[4] and data[5] upon every received message. These flags need to be cleared
repeatedly from the program.
MCU must be initialized as Master in 485 communication to assign an address to MCU.
Example
RS485Slave_Read(dat)
5.2.14.6 RS485Slave_Write – Sends message to Master
Prototype
sub procedure RS485Slave_Write(dim byref data as byte[2], dim datalen as
byte)
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/05.htm (91 sur 112)05/11/2004 02:20:55
Zobrazit stránku 132
1 2 ... 128 129 130 131 132 133 134 135 136 137 138 ... 193 194

Komentáře k této Příručce

Žádné komentáře