Hello,
I have a problem with an RCM4100 and DC 10.21. Perhaps someone could help me.
I can't handle the Timer C interrupt correctly. The code below will hang the CPU at power-up. The examples provided from Rabbit (located in the Sample folder od Dynamic C) work fine so I guess the problem is in my config lib (see below too).
Any idea to find out the problem?
Thanks in advance Marco / iw2nzm
--
#class auto #use "UND_CORE_BOARD.LIB"
#define led_red_toggle() BitWrPortI(PBDR, &PBDRShadow, !BitRdPortI(PBDR, 7), 7);
nodebug root interrupt void timerC_isr() { led_red_toggle(); }
void main() { UND_BoardInit(); SetVectIntern(TIMERC_OFS / 0x10, timerC_isr);
for (;;) {} }
/*** BeginHeader */ #ifndef __UND_CORE_BOARD_LIB #define __UND_CORE_BOARD_LIB /*** EndHeader */
/* START LIBRARY DESCRIPTION
************************************************ UND_CORE_BOARD.LIB DESCRIPTION: This library was generated by the Rabbit 4000 I/O LIB Utility. If it is modified in any incorrect way it might not load properly. Usage: #use "UND_CORE_BOARD.LIB" main() { UND_BoardInit(); ... }SUPPORT LIBRARIES: none END DESCRIPTION
*************************************************************//*** BeginHeader UND_BoardInit */ void UND_BoardInit(); void ClockCheck(); void SetupSerial(); #define CINBUFSIZE 31 #define COUTBUFSIZE 31 #define SERC_TXPORT PCDR #define CDRIVE_TXD 2 #define SERC_RXPORT PCDR #define CDRIVE_RXD 3 #define DINBUFSIZE 511 #define DOUTBUFSIZE 511 #define SERD_TXPORT PCDR #define DDRIVE_TXD 0 #define SERD_RXPORT PCDR #define DDRIVE_RXD 1 #define EINBUFSIZE 127 #define EOUTBUFSIZE 63 #define SERE_TXPORT PEDR #define EDRIVE_TXD 6 #define SERE_RXPORT PEDR #define EDRIVE_RXD 7 #define FINBUFSIZE 31 #define FOUTBUFSIZE 31 #define SERF_TXPORT PEDR #define FDRIVE_TXD 2 #define SERF_RXPORT PEDR #define FDRIVE_RXD 3 /*** EndHeader */
/* START FUNCTION DESCRIPTION
*********************************************** UND_BoardInit END DESCRIPTION *************************************************************/void ClockCheck() { if (freq_divider != 96) // 29.49 MHz, doubled { exception(-ERR_LIBCLOCKSPEED); } }
void SetupSerial() { serCopen(1200L); serDopen(115200L); WrPortI(SDCR,&SDCRShadow, 0x03); serEopen(19200L); WrPortI(SECR,&SECRShadow, 0x21); serFopen(19200L); WrPortI(SFCR,&SFCRShadow, 0x21); }
void UND_BoardInit() { ClockCheck(); // The following differ from BIOS settings SetupSerial(); WrPortI(I0CR,&I0CRShadow,0x03); // Port E Input and output Pins WrPortI(ICS1R,&ICS1RShadow,0x33); // IC Channel 1 WrPortI(ICT1R,&ICT1RShadow,0x42); // Port C Input and output Pins WrPortI(PBDDR,&PBDDRShadow,0xFF); // Port B Input and output Pins WrPortI(PCAHR,&PCAHRShadow,0xC0); // Port C Input and output Pins WrPortI(PCFR,&PCFRShadow,0x15); // Port C Input and output Pins WrPortI(PEAHR,&PEAHRShadow,0x30); // Port E Input and output Pins WrPortI(PEALR,&PEALRShadow,0x30); // Port E Input and output Pins WrPortI(PEDDR,&PEDDRShadow,0x44); // Port E Input and output Pins WrPortI(PEFR,&PEFRShadow,0x44); // Port E Input and output Pins WrPortI(QDCR,&QDCRShadow,0x08); // Port E Input and output Pins WrPortI(SBDHR,NULL, 0x81); // Serial Port B WrPortI(SBDLR,NULL, 0xFF); // Serial Port B WrPortI(TAT1R,&TAT1RShadow,0x02); // Timer A WrPortI(TCCR,&TCCRShadow,0x09); // Timer C WrPortI(TCCSR,&TCCSRShadow,0x01); // Timer C WrPortI(TCDHR,NULL, 0x8F); // Timer C WrPortI(TCDLR,NULL, 0xBE); // Timer C }
// The following are used by the configuration utility // Restore(SBCR, 0x0D) // Serial Port B // Restore(SCCR, 0x01) // Serial Port C // Restore(SCDHR, 0x8B) // Serial Port C // Restore(SCDLR, 0xFF) // Serial Port C // Restore(SDCR, 0x03) // Serial Port D // Restore(SDDLR, 0x1F) // Serial Port D // Restore(SECR, 0x21) // Serial Port E // Restore(SEDLR, 0xBF) // Serial Port E // Restore(SFCR, 0x21) // Serial Port F // Restore(SFDLR, 0xBF) // Serial Port F // Restore(APIC, 0x01) // Serial Port C // Restore(APID, 0x01) // Serial Port D // Restore(APIE, 0x01) // Serial Port E // Restore(APIF, 0x01) // Serial Port F // Restore(DBL, 0x01) // Processor Options // Restore(DINBF, 0x1FF) // Serial Port D // Restore(DOUTBF, 0x1FF) // Serial Port D // Restore(EINBF, 0x7F) // Serial Port E // Restore(EOUTBF, 0x3F) // Serial Port E // Restore(USEPC, 0x01) // Serial Port C // Restore(USEPD, 0x01) // Serial Port D // Restore(USEPE, 0x01) // Serial Port E // Restore(USEPF, 0x01) // Serial Port F
/*** BeginHeader */ #endif /*** EndHeader */ //checksum:F314