|
#define | delay_us(us) nzDelayUs(us) |
|
#define | delay_ms(ms) nzDelayMs(ms) |
|
#define | DWORD_BYTE0(dw) ((unsigned char)((dw)&0xFF)) |
|
#define | DWORD_BYTE1(dw) ((unsigned char)(((dw)>>8)&0xFF)) |
|
#define | DWORD_BYTE2(dw) ((unsigned char)(((dw)>>16)&0xFF)) |
|
#define | DWORD_BYTE3(dw) ((unsigned char)(((dw)>>24)&0xFF)) |
|
#define | nzDwordGetLowByte_MACRO(dw) ((unsigned char)((dw)&0xFF)) |
|
#define | DWORD_LOW_BYTE(dw) ((unsigned char)((dw)&0xFF)) |
|
#define | nzDwordGetHighByte_MACRO(dw) ((unsigned char)(((dw)>>24)&0xFF)) |
|
#define | DWORD_HIGH_BYTE(dw) ((unsigned char)(((dw)>>24)&0xFF)) |
|
#define | nzDwordGetLowWord_MACRO(dw) ((unsigned char)((dw)&0xFFFF)) |
|
#define | DWORD_LOW_WORD(dw) ((unsigned char)((dw)&0xFFFF)) |
|
#define | nzDwordGetHighWord_MACRO(dw) ((unsigned char)(((dw)>>16)&0xFFFF)) |
|
#define | DWORD_HIGH_WORD(dw) ((unsigned char)(((dw)>>16)&0xFFFF)) |
|
#define | WORD_BYTE0(w) ((unsigned char)((w)&0xFF)) |
|
#define | WORD_BYTE1(w) ((unsigned char)(((w)>>8)&0xFF)) |
|
#define | nzWordGetLowByte_MACRO(w) ((unsigned char)((w)&0xFF)) |
|
#define | WORD_LOW_BYTE(w) ((unsigned char)((w)&0xFF)) |
|
#define | nzWordGetHighByte_MACRO(w) ((unsigned char)(((w)>>8)&0xFF)) |
|
#define | WORD_HIGH_BYTE(w) ((unsigned char)(((w)>>8)&0xFF)) |
|
#define | nzByteGetLowNibble_MACRO(b) ((unsigned char)((b)&0x0F)) |
|
#define | BYTE_LOW_NIBBLE(b) ((unsigned char)((b)&0x0F)) |
|
#define | nzByteGetHighNibble_MACRO(b) ((unsigned char)(((b)>>4)&0x0F)) |
|
#define | BYTE_HIGH_NIBBLE(b) ((unsigned char)(((b)>>4)&0x0F)) |
|
#define | nzWordSetHighByte_MACRO(w, b) (((BYTE*)&(w))[1] = (b)) |
|
#define | nzWordSetLowByte_MACRO(w, b) (((BYTE*)&(w))[0] = (b)) |
|
#define | nzWordFromBytes_MACRO(msb, lsb) ( ((WORD)((msb)<<8)) | ((WORD)(lsb)) ) |
|
#define | WORD_FROM_BYTES(msb, lsb) ( ((WORD)((msb)<<8)) | ((WORD)(lsb)) ) |
|
|
void | nzDelayMs (WORD msDelay) |
|
void | nzDelayUs (WORD usDelay) |
|
BYTE | nzAsciiHexToByte (WORD_VAL asciiChars) |
|
BYTE | nzAsciiHexNibbleToByte (BYTE c) |
|
WORD_VAL | nzByteToAsciiHex (BYTE b) |
|
void | nzByteToAsciiHexStr (BYTE b, char *dst) |
|
BYTE | nzLowNibbleToAsciiHex (BYTE b) |
|
BYTE | nzHighNibbleToAsciiHex (BYTE b) |
|
BYTE | nzBitCount (WORD x) |
|
BYTE | nzBitCountArr (BYTE *p, BYTE size) |
|
WORD | nzParseDecHexWord (const char *str, BYTE *retFlags) |
|
WORD | nzParseHexDecWord (const char *str, BYTE *retFlags) |
|
void | nzUintToAsciiStr (WORD val, BYTE *buf) |
|
void | nzFlashWriteConst (DWORD adr, BYTE newVal) |
|
void | nzMemCpy (BYTE *pDst, BYTE *pSrc, WORD count) |
|
void | nzMemCpyNoCheck (BYTE *pDst, BYTE *pSrc, WORD count) |
|
void | nzMemCpyDecNoCheck (BYTE *pDst, BYTE *pSrc, WORD count) |
|
Netcruzer Helper Functions.
- Author
- Modtronix Engineering
- Compiler:
- MPLAB XC16 compiler
Description
This module contains code for implementing a variable size circular buffers. The size can be configured at run time. It is not limited to a power of 2 value.
Configuration
The following defines are used to configure this module, and should be placed in projdefs.h. Note that all items marked [-DEFAULT-] are defaults, and do not have to be placed in projdefs.h if they contain desired configuration! For details, see Project Configuration.
Software License Agreement
The software supplied herewith is owned by Modtronix Engineering, and is protected under applicable copyright laws. The software supplied herewith is intended and supplied to you, the Company customer, for use solely and exclusively on products manufactured by Modtronix Engineering. The code may be modified and can be used free of charge for commercial and non commercial applications. All rights are reserved. Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil liability for the breach of the terms and conditions of this license.
THIS SOFTWARE IS PROVIDED IN AN 'AS IS' CONDITION. NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
File History
2010-11-24, David H. (DH):
void nzFlashWriteConst |
( |
DWORD |
adr, |
|
|
BYTE |
newVal |
|
) |
| |
Writes the given value to the "const BYTE" at the given address. The FLASH location is NOT erased, so bits of variable at given address can only change from 1's to 0's. When erasing a FLASH, all bits are set to 1's. For example, if variable is 0xff, it can be written with any value. If varialbe is 0, it can not be changed (all bits are already 0's).
When placing data in program memory with "const BYTE" syntax, only the lower words of instructions are used. The upper word of instructions has a usable byte, and the "phantom byte", which are both not used. When using the __builtin_tbladdress() function, we get the word address used in program memory for given "const BYTE" variable.
- "const BYTE" variable with even address is stored in LSB of lower word of instruction.
To update this byte, place it in LSB of __builtin_tblwtl(). Supply varialbes address to __builtin_tblwtl().
MSB of __builtin_tblwtl() will update variable one address higher, at address: ((varialbe's address)+1).
__builtin_tblwth() is not used for "const BYTE" variable.
- "const BYTE" with odd address is stored in MSB of lower word of instruction.
To update this byte, place it in MSB of __builtin_tblwtl(). Supply ((varialbe's address)&0xfffe) to __builtin_tblwtl().
LSB of __builtin_tblwtl() will update variable one address lower, at address: ((varialbe's address)&0xfffe).
__builtin_tblwth() is not used for "const BYTE" variable.
- Parameters
-
adr,: | Address of "const BYTE" variable to update. Use "__builtin_tbladdress(&var)" to get address |
newVal,: | New value that should be assigned to given "const BYTE" variable. Only 0 bits will be written. |