When i set the BL70 to output, it stay ON for 100ms and then off again. Other port such as BL50-BL53 are ok
here is the codes. Do you have any ideas? Please help
void setDigitalOutput(int channel,int onOff)
{
switch (channel)
{
case DO_0:
WrPortE(0x0a,NULL,0x0d);//port 5 bit 1
if (onOff==TRUE)
WrPortE(0x0b,NULL,0x07);//port 5 bit 1 on
else
WrPortE(0x0b,NULL,0x06);//port 5 bit 1 off
break;
case DO_1:
WrPortE(0x0a,NULL,0x0e);//port 5 bit 2
if (onOff==TRUE)
WrPortE(0x0b,NULL,0x07);//port 5 bit 2 on
else
WrPortE(0x0b,NULL,0x06);//port 5 bit 2 off
break;
case DO_2:
WrPortE(0x0a,NULL,0x0f);//port 5 bit 3
if (onOff==TRUE)
WrPortE(0x0b,NULL,0x07);//port 5 bit 1 on
else
WrPortE(0x0b,NULL,0x06);//port 5 bit 1 off
break;
case DO_3:
WrPortE(BL6,NULL,P0CR);//port 6 bit 1
if (onOff==TRUE)
WrPortE(IR6,NULL,0x07);//port 6 bit 1 on
else
WrPortE(IR6,NULL,0x06);//port 6 bit 1 off
break;
}
}
/*** BeginHeader /
#ifndef __HINE_HA_GEN_II_ELEVATOR2_LIB
#define __HINE_HA_GEN_II_ELEVATOR2_LIB
/** EndHeader */
/* START LIBRARY DESCRIPTION ************************************************
HINE_HA_GEN_II_ELEVATOR2.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 “HINE_HA_GEN_II_ELEVATOR2.LIB”
main()
{
BoardInit();
…
}
SUPPORT LIBRARIES: none
END DESCRIPTION *************************************************************/
/*** BeginHeader BoardInit /
void BoardInit();
void ClockCheck();
void SetupSerial();
#define BINBUFSIZE 31
#define BOUTBUFSIZE 31
#define SERB_TXPORT PCDR
#define BDRIVE_TXD 4
#define SERB_RXPORT PCDR
#define BDRIVE_RXD 5
#define CINBUFSIZE 31
#define COUTBUFSIZE 31
#define SERC_TXPORT PCDR
#define CDRIVE_TXD 2
#define SERC_RXPORT PCDR
#define CDRIVE_RXD 3
#define DINBUFSIZE 31
#define DOUTBUFSIZE 31
#define SERD_TXPORT PCDR
#define DDRIVE_TXD 0
#define SERD_RXPORT PCDR
#define DDRIVE_RXD 1
/** EndHeader */
/* START FUNCTION DESCRIPTION ***********************************************
BoardInit <HINE_HA_GEN_II_ELEVATOR2.LIB>
END DESCRIPTION *************************************************************/
void ClockCheck()
{
if (freq_divider != 265) // 81.50 MHz, doubled
{
exception(-ERR_LIBCLOCKSPEED);
}
}
void SetupSerial()
{
serBopen(10187500L);
serCopen(10187500L);
serDopen(10187500L);
}
void BoardInit()
{
//ClockCheck();
// The following differ from BIOS settings
SetupSerial();
WrPortI(IB0CR,&IB0CRShadow,0x08); // Bank 0
WrPortI(PBDDR,&PBDDRShadow,0xFF); // Port B Input and output Pins
WrPortI(PCFR,&PCFRShadow,0x55); // Serial Port C
WrPortI(PDDDR,&PDDDRShadow,0x0F); // Port D Input and output Pins
WrPortI(PEDDR,&PEDDRShadow,0xD7); // Port E Input and output Pins
WrPortI(SACR,&SACRShadow,0x01); // Serial Port A
WrPortI(SPCR,&SPCRShadow,0x8C); // Port B Input and output Pins
}
// The following are used by the configuration utility
// Restore(SBCR, 0x01) // Serial Port B
// Restore(SCCR, 0x01) // Serial Port C
// Restore(SDCR, 0x01) // Serial Port D
// Restore(APIB, 0x01) // Serial Port B
// Restore(APIC, 0x01) // Serial Port C
// Restore(APID, 0x01) // Serial Port D
// Restore(BASE, 0x4DB9760) // Processor Options
// Restore(DBL, 0x01) // Processor Options
// Restore(USEPB, 0x01) // Serial Port B
// Restore(USEPC, 0x01) // Serial Port C
// Restore(USEPD, 0x01) // Serial Port D
/*** BeginHeader /
#endif
/** EndHeader */
//checksum:842F