Machine Library

I've created a library targeting the hardware specific aspects of programming the Sbc-3. I believe that it should work with the other boards from Mega Micros, but since I don't have access to anything but the Sbc-3, can't confirm that.

To use the library, just include the following in your C sourcecode:

#include <machine.h>

Serial I/O

int _char_available(void);
char _getchar(void);
void _putchar(char c);

LED Control

There's a block of 10 leds (LD7 on the SBC3-b3), and six of them can be used for anything you like. Led1 is furthest from the cpu:

LED # Used for
1 Indicates that the board is being powered via an external 5v supply.
2 Indicated that the board is being powered via the ATX power connector.
3 Connected to the ~RTS pin on the duart channel B.
4 Connected to the ~RTS pin on the duart channel A.
5 Available to user.
6 Available to user.
7 Available to user.
8 Available to user.
9 Available to user.
10 Available to user.

Two functions are provided, one to turn on a led, and another to turn it off.

void set_led(int lednum);
void clear_led(int lednum);

Where lednum is an integer in the range of 5 through to 10, as per the table above. Any other value will be silently ignored.

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9