USB-BDI
|
#include "fx2regs.h"
Go to the source code of this file.
Defines | |
#define | usbOutBufferUart EP4FIFOBUF |
#define | usbInBufferUart EP8FIFOBUF |
#define | NUMBER_OF_STD_VALUES 7 |
#define | UART_BUF_LEN 512 |
#define | Uart0Insert(char) |
#define | Uart0TriggerSend() |
Functions | |
void | initUART () |
initialize uart0 | |
void | changeBaudRate (unsigned long bitRate) |
changes the BaudeRate | |
Variables | |
__xdata volatile unsigned char | uart0OutBuffer [UART_BUF_LEN] |
__xdata volatile unsigned char | uart0InBuffer [UART_BUF_LEN] |
volatile unsigned short | uart0OutBufferStart |
volatile unsigned short | uart0OutBufferEnd |
volatile unsigned short | uart0InBufferStart |
volatile unsigned short | uart0InBufferEnd |
unsigned short | uart0InBufferLen |
#define NUMBER_OF_STD_VALUES 7 |
#define Uart0Insert | ( | char | ) |
{\ uart0InBuffer[uart0InBufferEnd] = char;\ uart0InBufferEnd = (uart0InBufferEnd + 1) % UART_BUF_LEN;\ /* used to overwrite the oldest char if buffer full*/\ if (uart0InBufferEnd == uart0InBufferStart) {\ uart0InBufferStart = (uart0InBufferStart + 1) % UART_BUF_LEN;\ }\ }
puts a char into the buffer
#define Uart0TriggerSend | ( | ) |
{\ uart0InBufferLen = ((uart0InBufferEnd - uart0InBufferStart) + UART_BUF_LEN) % UART_BUF_LEN;\ if (uart0InBufferLen > 0) {\ SBUF0 = uart0InBuffer[uart0InBufferStart];\ uart0InBufferStart = (uart0InBufferStart + 1) % UART_BUF_LEN;\ }\ }
triggers sending a message
#define UART_BUF_LEN 512 |
#define usbInBufferUart EP8FIFOBUF |
#define usbOutBufferUart EP4FIFOBUF |
void changeBaudRate | ( | unsigned long | bitRate | ) |
changes the BaudeRate
bitRate | new bit Rate |
Bit rate = 12Mhz/16/(255-TH1) Default value is 9600 baud/sec NOTE: the bit rate is rounded for example if you chose 350000 than TH1 = 255-750000/bitRate is set to 252 and thus the rate is 750000/(255-252) = 375000. the same happens in the MPC555 for these reason there are sometimes rates which don't match. the higher the rates the higher is the probability that this effect takes place
void initUART | ( | ) |
__xdata volatile unsigned char uart0InBuffer[UART_BUF_LEN] |
volatile unsigned short uart0InBufferEnd |
unsigned short uart0InBufferLen |
uart0 buffer length
Definition at line 30 of file dispatch.c.
volatile unsigned short uart0InBufferStart |
__xdata volatile unsigned char uart0OutBuffer[UART_BUF_LEN] |
volatile unsigned short uart0OutBufferEnd |
volatile unsigned short uart0OutBufferStart |