![Tern CAN-Engine Скачать руководство пользователя страница 31](http://html.mh-extra.com/html/tern/can-engine/can-engine_technical-manual_1089501031.webp)
CAN-Engine
Chapter 4: Software
4-9
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 ae_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 file ser0.h and ser1.h in the directory
tern\186\include
.
The internal asynchronous serial ports are functionally identical. SER0 is used by the DEBUG ROM
provided as part of the TERN EV-P/DV-P 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 Am186ES CPU: SER0 and SER1. Both ports have
baud rates based on the 40 MHz clock, and can operate at a maximum of 1/16 of that clock rate.
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 which 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 both chapter 10 of the Am186ES Microprocessor User’s Manual and the
schematic of the CAN-Engine provided on the CD in the tern_docs\schs directory.
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 1/16 of the processor frequency.
The following table shows the function arguments that express each baud rate, to be used in TERN
functions. These are based on a 40 MHz system clock.
Function Argument
Baud Rate
1
110
2
150
3
300
4
600
5
1200
6
2400