|
|
|
|
|
|
|
||
|
||
|
|
||
July 1998 |
Revision 1.01 |
|
Persistor Instruments Inc. |
© 1998 All rights reserved. |
|
This section is your gentler introduction to some of the more common BIOS functions at you disposal. The routines listed here offer some likely functionalitly for embedded controllers and loggers that the C standard libraries could not provide. In particular, that include:
// Set the system clock frequency short PWRSetSysClock(ushort kHz, bool waitQSM, bool waitLock); Delay1us(); Delay2us(); Delay5us(); Delay10us(); Delay20us(); Delay50us(); Delay100us(); Delay200us(); Delay500us(); Delay1ms(); // Delay for microseconds void RTCDelayMicroSeconds(ulong us); // Setup a countdown timer (us) void RTCCountdownTimerSetup(RTCTimer *rt, ulong us); // Check a countdown timer for timeout bool RTCCountdownTimeout(RTCTimer *rt); // Reset a countdown timer to its initial state void RTCCountdownReset(RTCTimer *rt); // Setup and start an elapsed timer (us) void RTCElapsedTimerSetup(RTCTimer *rt); // Read the elapsed time (us) ulong RTCElapsedTime(RTCTimer *rt);
ushort IEVSaveSRThenDisable(void); void IEVRestoreSavedSR(ushort savedSR); void IEVEnableAll(void); void IEVDisableAll(void); // Reset the Persistor void BIOSReset(void);
// Configure I/O pin as input and read level short PIORead(short pin); // Configure I/O pin as output and write level short PIOWrite(short pin, short value); // Configure I/O pin as output and set high short PIOSet(short pin); // Configure I/O pin as output and set low short PIOClear(short pin); // Configure I/O pin as output and toggle current level short PIOToggle(short pin); //Read an I/O pin, then configure as an output at the level read short PIOMirror(short pin); // Make an I/O pin perform its alternate function (varies) short PIOBusFunct(short pin);
// Set the LED state void LEDSetState(ushort lrLED, ushort state); // Toggle LED between Red and Green void LEDToggleRG(ushort lrLED); // Toggle LED between Red, Green, and Off void LEDToggleRGOff(ushort lrLED); // Orbit the LEDs on each call void LEDOrbit(bool ccw);
// Return the number of words in the receive queue short SCIRxQueuedCount(void); #define kbhit() SCIRxQueuedCount() // Wait for incoming serial to idle with ms delay short SCIRxGetCharWaitIdle(short millisecs); #define kbflush() (SCIRxGetCharWaitIdle(1) != -1) // Wait for, and return the next word short SCIRxGetChar(void); #define getch() SCIRxGetChar() // input line with minimal editing features short SCIRxGetLine(char *buf, short len); #define getstr(s,n) SCIRxGetLine(s,n) // Transmit word void SCITxPutChar(ushort data); #define putch(c) SCITxPutChar(c) // Transmit zero terminated string with C '\n' to '\r'-'\n' translation void SCITxPutStr(const char *str); #define putstr(s) SCITxPutStr(s) // Wait for all transmission to complete void SCITxWaitCompletion(void); #define putflush() SCITxWaitCompletion() // Simple printf to SCI with no floating point void SCITxPrintf(const char * format, ...); #define uprintf SCITxPrintf #define hexdump SCITxHexDump // Dump memory in hex and ASCII to the UART bool SCITxHexDump(void *mem, ulong addr, short wsize, long bytecount); // Set the baud rate and parity long SCIConfigure(long baud, char parity, bool autoTiming); // Select buffered (true) or non-buffered receive void SCIRxSetBuffered(bool buffered); // Select buffered (true) or non-buffered transmit void SCITxSetBuffered(bool buffered); // Return next word with timeout short SCIRxGetCharWithTimeout(short millisecs); // Wait for incomming serial to idle with ms delay short SCIRxGetCharWaitIdle(short millisecs);
|
|
|
|
|
|
Tel: 508-759-6434 |
|
Fax: 508-759-6436 |
|
|
||