Apply all port settings that BFTC GUI as required.
In HARDWARE tab of BFTC widget are present several tables for port configurations.
Function, direction, LABEL name etc., all these settings are included in config.c and config.h files This procedure execute built code. This procedure must be executed as first at code beginning.
Enable the interrupt on the rising edge of specified bits on port F. With this procedure is possible to create an interrupt service on the rising edge of a specifed bit.
Enable the interrupt on the rising edge of specified bits on port G. With this procedure is possible to create an interrupt service on the rising edge of a specifed bit.
Enable coretimer to generate a periodic interrupt. The core timer is a programmable 32-bit interval timerwhich can generate periodic interrupts.
Unlike other peripherals, the core timer resides inside the Blackfin core and runs at the core clock (CCLK) rate.
Core timer features include:
-32-bit timer with8-bit prescaler -Operates at core clock (CCLK) rate -Dedicated high-priority interrupt channel -Single-shot or continuous operation.
Set wathcdog activity. This procedure set a 32-bit timer that can be used to implement a software watchdog function.
A software watchdog can improve system reliability by generating an event to the processor core if the watchdog expires before being updated by software. Typically, the watchdog timer is used to supervise stability of the system software.
When used in this way, software reloads the watchdog timer in a regular manner so that the downward counting timer never expires (neverbecomes 0).
An expiring timer then indicates that system software might be out of control.
At this point a special error handler may recover the system.
For safety, however, it is often better to reset and reboot the system directly by hardware control.
Set direction of expansion port. On Y11 are available four bit of parallel expansion port named PA[7:4] with this procedure you can set the direction of these bit.
PA[3:0] are internally used for TFT light controls and must set always in output.
Write Port A. On Y11 are available four bit of parallel expansion port named PA[7:4] with this procedure is possible to write the port with a desidered value.
unsigned int Get_AD (unsigned char singDiff, unsigned char channel)
Read an A/D channel. 12 bit plus sign 100KHz A/D converter. Is possible to select differential or single ended from 8 input channels.
In single ended mode are available 8 channels CH[7:0], while in differential mode are available 4 channels according to:
VREF = 2.5V.
void Set_DA (unsigned char gain, unsigned char dac, unsigned int value)
Set the core and the peripheral frequency.
This the first procedure to be executed.
CORE Frequency = CRYSTAL (25MHz) * vcoMultiplier
SCLK Frequency = CORE Frequency / sclkDivider
Max SCLK Frequency = 100MHz
Max CORE Frequency = 400MHz (200MHz for -2).
Init serial port with specified baud rate. As default serial port is used as standard input/output.
printf and _scanf allow the access to this i/o channel.
Serial defaults are: 8 bit, no parity, one stop bit.
Writes the C string pointed by format to the standard output (UART0). If format includes format specifiers (subsequences beginning with %), the additional arguments following format are formatted and inserted in the resulting string replacing their respective specifiers.
Write formatted data to string. Composes a string with the same text that would be printed if format was used on printf, but instead of being printed, the content is stored as a C string in the buffer pointed by str. The size of the buffer should be large enough to contain the entire resulting string. A terminating null character is automatically appended after the content. After the format parameter, the function expects at least as many additional arguments as needed for format.
Read formatted data from stdin (UART0). Reads data from stdin and stores them according to the parameter format into the locations pointed by the additional arguments. The additional arguments should point to already allocated objects of the type specified by their corresponding format specifier within the format string.
Convert uppercase letter to lowercase. Converts c to its lowercase equivalent if c is an uppercase letter and has a lowercase equivalent. If no such conversion is possible, the value returned is c unchanged. Notice that what is considered a letter may depend on the locale being used; In the default "C" locale, an uppercase letter is any of:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
which translate respectively to:
a b c d e f g h i j k l m n o p q r s t u v w x y z.
Convert lowercase letter to uppercase. Converts c to its lowercase equivalent if c is an uppercase letter and has a lowercase equivalent. If no such conversion is possible, the value returned is c unchanged. Notice that what is considered a letter may depend on the locale being used; In the default "C" locale, an lowercase letter is any of:
a b c d e f g h i j k l m n o p q r s t u v w x y z
which translate respectively to:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
Get string length. The length of a C string is determined by the terminating null-character:
A C string is as long as the number of characters between the beginning of the string and the terminating null character (without including the terminating null character itself).
Compare two strings. Compares the C string str1 to the C string str2. This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until a terminating null-character is reached. This function performs a binary comparison of the characters.
int _strncmp (const char *str1, const char *str2, int num)
Compare characters of two strings. Compares up to num characters of the C string str1 to those of the C string str2. This function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ, until a terminating null-character is reached, or until num characters match in both strings, whichever happens first.
Copy string. Copies the C string pointed by source into the array pointed by destination, including the terminating null character (and stopping at that point). To avoid overflows, the size of the array pointed by destination shall be long enough to contain the same C string as source (including the terminating null character), and should not overlap in memory with source.
char * _strncpy (char *destination, const char *source, int num)
Copy characters from string. Copies the first num characters of source to destination. If the end of the source C string (which is signaled by a null-character) is found before num characters have been copied, destination is padded with zeros until a total of num characters have been written to it. No null-character is implicitly appended at the end of destination if source is longer than num. Thus, in this case, destination shall not be considered a null terminated C string (reading it as such would overflow).
unsigned _str_split (char *string, char charSep, int maxArgs, char *argv)
Splits the string into substrings wherever charSep occurs, and returns the list of those strings. If charSep does not match anywhere in the string, _str_split() returns a single-element list containing this string. The output is a sequence of string separated by 0. Use _str_field the get selected field.
Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.
const char * _str_field (const char *string, int field)
Is Not-A-Number. Returns whether x is a NaN (Not-A-Number) value. The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.
Break into fractional and integral parts. Breaks x into an integral and a fractional part. The integer part is stored in the object pointed by intpart, and the fractional part is returned by the function. Both parts have the same sign as x.
Get significand and exponent. Breaks the floating point number x into its binary significand (a floating point with an absolute value between 0.5(included) and 1.0(excluded)) and an integral exponent for 2, such that:
x = significand * 2^exponent
The exponent is stored in the location pointed by exp, and the significand is the value returned by the function.
If x is zero, both parts (significand and exponent) are zero.
If x is negative, the significand returned by this function is negative.
Generate value from significand and exponent. Returns the result of multiplying x (the significand) by 2 raised to the power of exp (the exponent).
lexpr(x,exp) = x * 2^exp.
Compute arc cosine. Returns the principal value of the arc cosine of x, expressed in radians. In trigonometrics, arc cosine is the inverse operation of cosine.
Compute arc tangent. Returns the principal value of the arc tangent of x, expressed in radians. In trigonometrics, arc tangent is the inverse operation of tangent. Notice that because of the sign ambiguity, the function cannot determine with certainty in which quadrant the angle falls only by its tangent value.
See atan2 for an alternative that takes a fractional argument instead.
Compute arc tangent with two parameters. Returns the principal value of the arc tangent of y/x, expressed in radians. To compute the value, the function takes into account the sign of both arguments in order to determine the quadrant. If both arguments passed are zero, a domain error occurs.
Compute remainder of division. Returns the floating-point remainder of numer/denom (rounded towards zero):
fmod = numer - tquot * denom Where tquot is the truncated (i.e., rounded towards zero) result of: numer/denom.
Is Not-A-Number. Returns whether x is a NaN (Not-A-Number) value.
The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.
Compute remainder. Returns the floating-point remainder of numer/denom (rounded to nearest):
remainder = numer - rquot * denom
Where rquot is the result of: numer/denom, rounded toward the nearest integral value (with halfway cases rounded toward the even number). A similar function, fmod, returns the same but with the quotient truncated (rounded towards zero) instead.
Compute natural logarithm. Returns the natural logarithm of x. The natural logarithm is the base-e logarithm: the inverse of the natural exponential function (exp). For common (base-10) logarithms, see log10.