4-9
Return value: none
This function is just a simple software loop. The actual time that it waits depends on processor speed as
well as interrupt latency. The code is functionally identical to:
While(t) { t--; }
Passing in a t value of 600 causes a delay of approximately 1 ms.
void delay_ms
Arguments: unsigned int
Return value: none
This function is similar to delay0, but the passed in argument is in units of milliseconds instead of loop
iterations. Again, this function is highly dependent upon the processor speed.
unsigned int crc16
Arguments: unsigned char *wptr, unsigned int count
Return value: unsigned int value
This function returns a simple 16-bit CRC on a byte-array of count size pointed to by wptr.
void ve_reset
Arguments: none
Return value: none
This function is similar to a hardware reset, and can be used if your program needs to re-start the board for
any reason. Depending on the current hardware configuration, this might either start executing code from
the DEBUG ROM or from some other address.
4.3
Functions in SER0.OBJ/SER1.OBJ
The functions described in this section are prototyped in the header files ser0.h and ser1.h in the
tern\v25\include
directory.
The internal asynchronous serial ports are functionally identical. SER0 is used by the DEBUG ROM
provided as part of the TERN EV/DV software kits for communication with the PC. As a result, you will
not be able to debug code directly written for serial port 0.
Two asynchronous serial ports are integrated in the NEC V25 CPU: SER0 and SER1. Both ports have
baud rates based on the 8 MHz clock.
By default, SER0 is used by the DEBUG ROM for application download/debugging in Step One and Step
Two. We will use SER1 as the example in the following discussion; any of the interface functions that are
specific to SER1 can be easily changed into function calls for SER0. While selecting a serial port for use,
please realize that some pins might be shared with other peripheral functions. This means that in certain
limited cases, it might not be possible to use a certain serial port with other on-board controller functions.
For details, you should see chapter 11 of the NEC V25 User’s Manual.
TERN interface functions make it possible to use one of a number of predetermined baud rates. These baud
rates are achieved by specifying a divisor for the processor frequency.
The following table shows the function arguments that express each baud rate, to be used in TERN
functions.
Function Argument
Baud Rate