SPI to 4 X UART Bridge MULTIUART 6 Steps.The software was created using MPLAB X and the XC8 compiler.Flowcode does not natively support SPI slave just yet so I had to go back to basics with my C compiler.Flowcode 6 does provide some nice features out of the box such as multiple UART support and circular buffers so this really helped to speed up the development in terms of generating C code i could copy and paste into my program.I go through the process of obtaining a completely unlocked 3.Flowcode for all chip types in my Two wheel robot Instructable.To develop the software I created a simple protocol for the SPI connection to allow me to access each of the UART channels functionality.Each value is sent via the SPI as a byte with the CS signal pulled low.When the command is complete the CS signal is pulled high.The command code and UART channel are packed together into a single byte to increase efficiency.The command code resides in the top 4 bits and the channel resides in the bottom 2 bits.Here are the bits in the byte and their representation.UART channel. Command Code Parameters Returns Description.NA Num. Bytes 0 2.Download the free trial version below to get started.Doubleclick the downloaded file to install the software.Reads the number of bytes in the channel receive buffer.NA Num. Bytes 0 2.Reads the number of bytes in the channel transmit buffer. First Fleet Interactive Whiteboard Activities Literacy . Num. Bytes 0 2. Data.Byte 0 2. Reads data bytes from the channel receive buffer.Num. Bytes 0 2. Data.Byte 0 2. NA Puts a data byte into the channel transmit buffer.Baud 0 7 NA Sets the channel baud rate Here are the options for the baud rate parameter.So to read the number of bytes in UART channel 2 receive buffer we send the following command code and then perform a read.CS Low. SPISend 0x.Num. Bytes SPIReceive 0x.FF CS High. To read 5 bytes from UART channel 2 receive buffer we send the following command code, the number of bytes and then perform enough reads to pull out all the data we want.CS Low. SPISend 0x.SPISend 0x. 05 Byte0 SPIReceive 0x.FF Byte1 SPIReceive 0x.Flowcode For Arm 5 3 0 0' title='Flowcode For Arm 5 3 0 0' />
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |