Fx2lib  0.2
Functions
include/serial.h File Reference
#include "fx2types.h"

Go to the source code of this file.

Functions

void sio0_init (DWORD baud_rate) __critical
void putchar (char c)
char getchar ()

Detailed Description

defines functions to print to a serial console with SIO0

Definition in file serial.h.


Function Documentation

char getchar ( )
void putchar ( char  c)

putchar('\n') or putchar('\r') both transmit \r\n Just use one or the other. (This makes terminal echo easy)

void sio0_init ( DWORD  baud_rate)

This function inits sio0 to use T2CON (timer 2) See TRM 14.3.4.1 (Table 14-16) Certain baud rates have too high an error rate to work. All baud rates are .16% except:

12MHZ 24MHZ

  • 57600 -6.99%
  • 38400 -2.34% -2.34%
  • 19200 -2.34%

Possible Baud rates:

  • 2400
  • 4800
  • 9600
  • 19200
  • 28800
  • 38400
  • 57600

Any of these rates should work except 57600 at 12mhz. -2.34% is pushing most hardware specs for working. All rates at 48mhz work at .16%

Examples:
fw.c.