48 #if !USE_HEARTBEAT && !defined(__DOXYGEN__)
136 static _PERSISTENT INTTREGBITS INTTREGBITS_last;
143 # define u16_INTTREGlast BITS2WORD(INTTREGBITS_last)
188 uint16_t u16_offset = u32_address;
189 TBLPAG = u32_address >> 16;
190 return ( ((uint32_t) __builtin_tblrdh(u16_offset)) << 16) |
191 __builtin_tblrdl(u16_offset);
201 outString(
"**** SIMULATION MODE: cannot read device and revision ID ****\n");
206 const char* devIDStr =
"unknown";
207 const char* revisionStr =
"unknown";
218 # ifdef EXPECTED_REVISION2
219 case EXPECTED_REVISION2 :
220 revisionStr = EXPECTED_REVISION2_STR;
223 # ifdef EXPECTED_REVISION3
224 case EXPECTED_REVISION3 :
225 revisionStr = EXPECTED_REVISION3_STR;
228 # ifdef EXPECTED_REVISION4
229 case EXPECTED_REVISION4 :
230 revisionStr = EXPECTED_REVISION4_STR;
233 # ifdef EXPECTED_REVISION5
234 case EXPECTED_REVISION5 :
235 revisionStr = EXPECTED_REVISION5_STR;
252 "******************************************************\n"
253 "* WARNING - this program was compiled for the wrong *\n"
254 "* chip. This program may produce unexpected behvior! *\n"
255 "* Edit the header files to properly define this chip *\n"
256 "* and to insure correct operation. *\n"
258 "* NOTE: If this was compiled for the correct chip, *\n"
259 "* and only occurs at power-on (not during a MCLR *\n"
260 "* reset), verify that AVDD and AVSS are connected. *\n"
261 "* On the PIC24H32GP202, not connecting AVDD *\n"
262 "* produces this message only at power-up. *\n"
263 "******************************************************\n");
283 outString(
"Primary Osc (XT, HS, EC) with PLL\n");
291 #if defined(__PIC24H__) || defined(__dsPIC33F__) || defined(__PIC24E__) || defined(__dsPIC33E__)
298 #elif defined(__PIC24F__) || defined(__PIC24FK__)
301 outString(
"Low power fast RC Osc with Postscaler\n");
305 outString(
"Fast RC Osc with Postscaler\n");
308 # error "Unknown processor."
323 u8_resetIdentified = 0;
325 outString(
"\nDevice has been in sleep mode\n");
329 outString(
"\nDevice has been in idle mode\n");
334 u8_resetIdentified = 1;
348 u8_resetIdentified = 1;
353 u8_resetIdentified = 1;
363 u8_resetIdentified = 1;
368 u8_resetIdentified = 1;
373 u8_resetIdentified = 1;
378 u8_resetIdentified = 1;
384 u8_resetIdentified = 1;
391 if (!u8_resetIdentified) {
443 if ((f_x - u32_y) < 0.5)
return u32_y;
455 if ((f_x - u16_y) < 0.5)
return u16_y;
465 uint16_t
compute_brg(uint32_t u32_fcy, uint16_t u16_brgh, uint32_t u32_baudrate) {
471 f_brg = (((float) u32_fcy)/((float) u32_baudrate)/16.0) - 1.0;
473 f_brg = (((float) u32_fcy)/((float) u32_baudrate)/4.0) - 1.0;
479 #else // #ifndef _NOFLOAT, so _NOFLOAT is defined.
481 uint16_t
compute_brg(uint32_t u32_fcy, uint16_t u16_brgh, uint32_t u32_baudrate) {
486 u32_brg = u32_fcy/u32_baudrate;
488 if ((u32_brg & 0x0FL) >= 8) {
489 u32_brg = u32_brg/16;
491 u32_brg = u32_brg/16 - 1;
494 if ((u32_brg & 0x03L) >= 2) {
497 u32_brg = u32_brg/4 - 1;