AnsweredAssumed Answered

Addressing NV_FTRIM in C for KA2

Question asked by Carl Norman on Sep 30, 2007
Latest reply on Oct 2, 2007 by Carl Norman
Simple question, (not sure if this is in the correct section either, as i dont know what I am doing wrong)

using KA2 for a basic transmitter, written in C.

I want to load the trim, but, i get the warningC2705, and, it my problem is causing the wrong address to be loaded

Here is the code that i thought would simply load the trim from flash and store in RAM

  if((NV_ICSTRM_TRIM == 0xFF) | (NV_ICSTRM_TRIM == 0x00))
    ICSTRM = 0x80;
  else
    ICSTRM = NV_ICSTRM;
 
  if(NV_FTRIM_FTRIM)
    ICSSC_FTRIM = 1;
  else
    ICSSC_FTRIM = 0;

What is the correct method for loading testing/loading NV_ICSTRM_TRIM and ICSSC_FTRIM?

To save looking up the header file:
/*** ICSSC - ICS Status and Control; 0x00000017 ***/
typedef union {
  byte Byte;
  struct {
    byte FTRIM       :1;                                       /* ICS Fine Trim */
    byte             :1;
    byte CLKST       :1;                                       /* Clock Mode Status */
    byte             :1;
    byte             :1;
    byte             :1;
    byte             :1;
    byte             :1;
  } Bits;
} ICSSCSTR;
extern volatile ICSSCSTR _ICSSC @0x00000017;
#define ICSSC                           _ICSSC.Byte
#define ICSSC_FTRIM                     _ICSSC.Bits.FTRIM
#define ICSSC_CLKST                     _ICSSC.Bits.CLKST

#define ICSSC_FTRIM_MASK                1
#define ICSSC_CLKST_MASK                4


/*** NV_ICSTRM - Nonvolatile ICS Trim Register; 0x00003FFA ***/
typedef union {
  byte Byte;
  struct {
    byte TRIM        :8;                                       /* ICS Trim Setting */
  } Bits;
} NV_ICSTRMSTR;
/* Tip for register initialization in the user code:  const byte NV_ICSTRM_INIT @0x00003FFA = <NV_ICSTRM_INITVAL>; */
#define _NV_ICSTRM (*(const NV_ICSTRMSTR *)0x00003FFA)
#define NV_ICSTRM                       _NV_ICSTRM.Byte
#define NV_ICSTRM_TRIM                  _NV_ICSTRM.Bits.TRIM

#define NV_ICSTRM_TRIM_MASK             255
#define NV_ICSTRM_TRIM_BITNUM           0


/*** NV_FTRIM - Nonvolatile ICS Fine Trim Register; 0x00003FFB ***/
typedef union {
  byte Byte;
  struct {
    byte FTRIM       :1;                                       /* ICS Fine Trim */
    byte             :1;
    byte             :1;
    byte             :1;
    byte             :1;
    byte             :1;
    byte             :1;
    byte             :1;
  } Bits;
} NV_FTRIMSTR;
/* Tip for register initialization in the user code:  const byte NV_FTRIM_INIT @0x00003FFB = <NV_FTRIM_INITVAL>; */
#define _NV_FTRIM (*(const NV_FTRIMSTR *)0x00003FFB)
#define NV_FTRIM                        _NV_FTRIM.Byte
#define NV_FTRIM_FTRIM                  _NV_FTRIM.Bits.FTRIM

#define NV_FTRIM_FTRIM_MASK             1



Message Edited by CarlFST60L_3rd on 2007-09-30 01:55 PM

Outcomes