Спасибо за программу =)
Но ничего не загорается =((
Выводит только первое сообщение “ER-4 Remote” и нагло замолкает.
А можно ли с помощью микроСи перепрограммировать другой порт на "порт прерываний"?
Если будет работать, то, пока достаточно не освоюсь, можно и так пожить. Тут же еще 8 портов (5 RA и 3 RE).
З.Ы. Кстати, докопался до файлов микроСи по микроконтроллерам. Вот для моего PIC16F887:
Код:
const unsigned short
W = 0x0000,
F = 0x0001,
IRP = 0x0007,
RP1 = 0x0006,
RP0 = 0x0005,
NOT_TO = 0x0004,
NOT_PD = 0x0003,
Z = 0x0002,
DC = 0x0001,
C = 0x0000,
GIE = 0x0007,
PEIE = 0x0006,
T0IE = 0x0005,
TMR0IE = 0x0005,
INTE = 0x0004,
RBIE = 0x0003,
T0IF = 0x0002,
TMR0IF = 0x0002,
INTF = 0x0001,
RBIF = 0x0000,
ADIF = 0x0006,
RCIF = 0x0005,
TXIF = 0x0004,
SSPIF = 0x0003,
CCP1IF = 0x0002,
TMR2IF = 0x0001,
TMR1IF = 0x0000,
OSFIF = 0x0007,
C2IF = 0x0006,
C1IF = 0x0005,
EEIF = 0x0004,
BCLIF = 0x0003,
ULPWUIF = 0x0002,
CCP2IF = 0x0000,
T1GIV = 0x0007,
TMR1GE = 0x0006,
T1CKPS1 = 0x0005,
T1CKPS0 = 0x0004,
T1OSCEN = 0x0003,
NOT_T1SYNC = 0x0002,
T1INSYNC = 0x0002,
T1SYNC = 0x0002,
TMR1CS = 0x0001,
TMR1ON = 0x0000,
TOUTPS3 = 0x0006,
TOUTPS2 = 0x0005,
TOUTPS1 = 0x0004,
TOUTPS0 = 0x0003,
TMR2ON = 0x0002,
T2CKPS1 = 0x0001,
T2CKPS0 = 0x0000,
WCOL = 0x0007,
SSPOV = 0x0006,
SSPEN = 0x0005,
CKP = 0x0004,
SSPM3 = 0x0003,
SSPM2 = 0x0002,
SSPM1 = 0x0001,
SSPM0 = 0x0000,
P1M1 = 0x0007,
P1M0 = 0x0006,
DC1B1 = 0x0005,
CCP1X = 0x0005,
DC1B0 = 0x0004,
CCP1Y = 0x0004,
CCP1M3 = 0x0003,
CCP1M2 = 0x0002,
CCP1M1 = 0x0001,
CCP1M0 = 0x0000,
SPEN = 0x0007,
RX9 = 0x0006,
RC9 = 0x0006,
NOT_RC8 = 0x0006,
RC8_9 = 0x0006,
SREN = 0x0005,
CREN = 0x0004,
ADDEN = 0x0003,
FERR = 0x0002,
OERR = 0x0001,
RX9D = 0x0000,
RCD8 = 0x0000,
CCP2X = 0x0005,
DC2B1 = 0x0005,
CCP2Y = 0x0004,
DC2B0 = 0x0004,
CCP2M3 = 0x0003,
CCP2M2 = 0x0002,
CCP2M1 = 0x0001,
CCP2M0 = 0x0000,
ADCS1 = 0x0007,
ADCS0 = 0x0006,
CHS3 = 0x0005,
CHS2 = 0x0004,
CHS1 = 0x0003,
CHS0 = 0x0002,
GO = 0x0001,
NOT_DONE = 0x0001,
GO_DONE = 0x0001,
ADON = 0x0000,
NOT_RBPU = 0x0007,
INTEDG = 0x0006,
T0CS = 0x0005,
T0SE = 0x0004,
PSA = 0x0003,
PS2 = 0x0002,
PS1 = 0x0001,
PS0 = 0x0000,
ADIE = 0x0006,
RCIE = 0x0005,
TXIE = 0x0004,
SSPIE = 0x0003,
CCP1IE = 0x0002,
TMR2IE = 0x0001,
TMR1IE = 0x0000,
OSFIE = 0x0007,
C2IE = 0x0006,
C1IE = 0x0005,
EEIE = 0x0004,
BCLIE = 0x0003,
ULPWUIE = 0x0002,
CCP2IE = 0x0000,
ULPWUE = 0x0005,
SBOREN = 0x0004,
NOT_POR = 0x0001,
NOT_BO = 0x0000,
NOT_BOR = 0x0000,
IRCF2 = 0x0006,
IRCF1 = 0x0005,
IRCF0 = 0x0004,
OSTS = 0x0003,
HTS = 0x0002,
LTS = 0x0001,
SCS = 0x0000,
TUN4 = 0x0004,
TUN3 = 0x0003,
TUN2 = 0x0002,
TUN1 = 0x0001,
TUN0 = 0x0000,
GCEN = 0x0007,
ACKSTAT = 0x0006,
ACKDT = 0x0005,
ACKEN = 0x0004,
RCEN = 0x0003,
PEN = 0x0002,
RSEN = 0x0001,
SEN = 0x0000,
SMP = 0x0007,
CKE = 0x0006,
D = 0x0005,
I2C_DATA = 0x0005,
NOT_A = 0x0005,
NOT_ADDRESS = 0x0005,
D_A = 0x0005,
DATA_ADDRESS = 0x0005,
P = 0x0004,
I2C_END = 0x0004,
S = 0x0003,
I2C_BEGIN = 0x0003,
R = 0x0002,
I2C_READ = 0x0002,
NOT_W = 0x0002,
NOT_WRITE = 0x0002,
R_W = 0x0002,
READ_WRITE = 0x0002,
UA = 0x0001,
BF = 0x0000,
WPUB7 = 0x0007,
WPUB6 = 0x0006,
WPUB5 = 0x0005,
WPUB4 = 0x0004,
WPUB3 = 0x0003,
WPUB2 = 0x0002,
WPUB1 = 0x0001,
WPUB0 = 0x0000,
IOCB7 = 0x0007,
IOCB6 = 0x0006,
IOCB5 = 0x0005,
IOCB4 = 0x0004,
IOCB3 = 0x0003,
IOCB2 = 0x0002,
IOCB1 = 0x0001,
IOCB0 = 0x0000,
VREN = 0x0007,
VROE = 0x0006,
VRR = 0x0005,
VRSS = 0x0004,
VR3 = 0x0003,
VR2 = 0x0002,
VR1 = 0x0001,
VR0 = 0x0000,
CSRC = 0x0007,
TX9 = 0x0006,
NOT_TX8 = 0x0006,
TX8_9 = 0x0006,
TXEN = 0x0005,
SYNC = 0x0004,
SENDB = 0x0003,
BRGH = 0x0002,
TRMT = 0x0001,
TX9D = 0x0000,
TXD8 = 0x0000,
BRG7 = 0x0007,
BRG6 = 0x0006,
BRG5 = 0x0005,
BRG4 = 0x0004,
BRG3 = 0x0003,
BRG2 = 0x0002,
BRG1 = 0x0001,
BRG0 = 0x0000,
BRG15 = 0x0007,
BRG14 = 0x0006,
BRG13 = 0x0005,
BRG12 = 0x0004,
BRG11 = 0x0003,
BRG10 = 0x0002,
BRG9 = 0x0001,
BRG8 = 0x0000,
PRSEN = 0x0007,
PDC6 = 0x0006,
PDC5 = 0x0005,
PDC4 = 0x0004,
PDC3 = 0x0003,
PDC2 = 0x0002,
PDC1 = 0x0001,
PDC0 = 0x0000,
ECCPASE = 0x0007,
ECCPAS2 = 0x0006,
ECCPAS1 = 0x0005,
ECCPAS0 = 0x0004,
PSSAC1 = 0x0003,
PSSAC0 = 0x0002,
PSSBD1 = 0x0001,
PSSBD0 = 0x0000,
STRSYNC = 0x0004,
STRD = 0x0003,
STRC = 0x0002,
STRB = 0x0001,
STRA = 0x0000,
ADFM = 0x0007,
VCFG1 = 0x0005,
VCFG0 = 0x0004,
WDTPS3 = 0x0004,
WDTPS2 = 0x0003,
WDTPS1 = 0x0002,
WDTPS0 = 0x0001,
SWDTEN = 0x0000,
C1ON = 0x0007,
C1OUT = 0x0006,
C1OE = 0x0005,
C1POL = 0x0004,
C1R = 0x0002,
C1CH1 = 0x0001,
C1CH0 = 0x0000,
C2ON = 0x0007,
C2OUT = 0x0006,
C2OE = 0x0005,
C2POL = 0x0004,
C2R = 0x0002,
C2CH1 = 0x0001,
C2CH0 = 0x0000,
MC1OUT = 0x0007,
MC2OUT = 0x0006,
C1RSEL = 0x0005,
C2RSEL = 0x0004,
T1GSS = 0x0001,
C2SYNC = 0x0000,
SR1 = 0x0007,
SR0 = 0x0006,
C1SEN = 0x0005,
C2REN = 0x0004,
PULSS = 0x0003,
PULSR = 0x0002,
FVREN = 0x0000,
ABDOVF = 0x0007,
RCIDL = 0x0006,
SCKP = 0x0004,
BRG16 = 0x0003,
WUE = 0x0001,
ABDEN = 0x0000,
ANS7 = 0x0007,
ANS6 = 0x0006,
ANS5 = 0x0005,
ANS4 = 0x0004,
ANS3 = 0x0003,
ANS2 = 0x0002,
ANS1 = 0x0001,
ANS0 = 0x0000,
ANS13 = 0x0005,
ANS12 = 0x0004,
ANS11 = 0x0003,
ANS10 = 0x0002,
ANS9 = 0x0001,
ANS8 = 0x0000,
EEPGD = 0x0007,
WRERR = 0x0003,
WREN = 0x0002,
WR = 0x0001,
RD = 0x0000;
const unsigned int
MaxRam = 0x01FF,
_CONFIG = 0x2007,
_LP_OSC = 0x3FF8,
_XT_OSC = 0x3FF9,
_HS_OSC = 0x3FFA,
_EC_OSC = 0x3FFB,
_INTRC_OSC_NOCLKOUT = 0x3FFC,
_INTRC_OSC_CLKOUT = 0x3FFD,
_EXTRC_OSC_NOCLKOUT = 0x3FFE,
_EXTRC_OSC_CLKOUT = 0x3FFF,
_INTOSCIO = 0x3FFC,
_INTOSC = 0x3FFD,
_EXTRCIO = 0x3FFE,
_EXTRC = 0x3FFF,
_WDT_ON = 0x3FFF,
_WDT_OFF = 0x3FF7,
_PWRTE_ON = 0x3FEF,
_PWRTE_OFF = 0x3FFF,
_MCLRE_ON = 0x3FFF,
_MCLRE_OFF = 0x3FDF,
_CP_ON = 0x3FBF,
_CP_OFF = 0x3FFF,
_CPD_ON = 0x3F7F,
_CPD_OFF = 0x3FFF,
_BOR_ON = 0x3FFF,
_BOR_NSLEEP = 0x3EFF,
_BOR_SBODEN = 0x3DFF,
_BOR_OFF = 0x3CFF,
_IESO_ON = 0x3FFF,
_IESO_OFF = 0x3BFF,
_FCMEN_ON = 0x3FFF,
_FCMEN_OFF = 0x37FF,
_LVP_ON = 0x3FFF,
_LVP_OFF = 0x2FFF,
_DEBUG_ON = 0x1FFF,
_DEBUG_OFF = 0x3FFF,
_CONFIG2 = 0x2008,
_BOR21V = 0x3EFF,
_BOR40V = 0x3FFF,
_WRT_OFF = 0x3FFF,
_WRT_256 = 0x3DFF,
_WRT_1FOURTH = 0x3BFF,
_WRT_HALF = 0x39FF;
unsigned short register volatile
INDF absolute 0x0000;
unsigned short register volatile
TMR0 absolute 0x0001;
unsigned short register volatile
PCL absolute 0x0002;
unsigned short register volatile
STATUS absolute 0x0003;
unsigned short register
FSR absolute 0x0004;
unsigned short register volatile
PORTA absolute 0x0005;
unsigned short register volatile
PORTB absolute 0x0006;
unsigned short register volatile
PORTC absolute 0x0007;
unsigned short register volatile
PORTD absolute 0x0008;
unsigned short register volatile
PORTE absolute 0x0009;
unsigned short register volatile
PCLATH absolute 0x000A;
unsigned short register volatile
INTCON absolute 0x000B;
unsigned short register volatile
PIR1 absolute 0x000C;
unsigned short register volatile
PIR2 absolute 0x000D;
unsigned short register volatile
TMR1L absolute 0x000E;
unsigned short register volatile
TMR1H absolute 0x000F;
unsigned short register
T1CON absolute 0x0010;
unsigned short register volatile
TMR2 absolute 0x0011;
unsigned short register
T2CON absolute 0x0012;
unsigned short register volatile
SSPBUF absolute 0x0013;
unsigned short register
SSPCON absolute 0x0014;
unsigned short register volatile
CCPR1L absolute 0x0015;
unsigned short register volatile
CCPR1H absolute 0x0016;
unsigned short register volatile
CCP1CON absolute 0x0017;
unsigned short register volatile
RCSTA absolute 0x0018;
unsigned short register volatile
TXREG absolute 0x0019;
unsigned short register volatile
RCREG absolute 0x001A;
unsigned short register volatile
CCPR2L absolute 0x001B;
unsigned short register volatile
CCPR2H absolute 0x001C;
unsigned short register volatile
CCP2CON absolute 0x001D;
unsigned short register volatile
ADRESH absolute 0x001E;
unsigned short register volatile
ADCON0 absolute 0x001F;
unsigned short register
OPTION_REG absolute 0x0081,
TRISA absolute 0x0085,
TRISB absolute 0x0086,
TRISC absolute 0x0087,
TRISD absolute 0x0088,
TRISE absolute 0x0089,
PIE1 absolute 0x008C,
PIE2 absolute 0x008D;
unsigned short register volatile
PCON absolute 0x008E;
unsigned short register
OSCCON absolute 0x008F,
OSCTUNE absolute 0x0090;
unsigned short register volatile
SSPCON2 absolute 0x0091;
unsigned short register volatile
PR2 absolute 0x0092;
unsigned short register volatile
SSPADD absolute 0x0093;
unsigned short register
SSPMSK absolute 0x0093,
MSK absolute 0x0093;
unsigned short register volatile
SSPSTAT absolute 0x0094;
unsigned short register
WPUB absolute 0x0095,
IOCB absolute 0x0096,
VRCON absolute 0x0097;
unsigned short register volatile
TXSTA absolute 0x0098;
unsigned short register
SPBRG absolute 0x0099,
SPBRGH absolute 0x009A,
PWM1CON absolute 0x009B,
ECCPAS absolute 0x009C,
PSTRCON absolute 0x009D;
unsigned short register volatile
ADRESL absolute 0x009E;
unsigned short register
ADCON1 absolute 0x009F,
WDTCON absolute 0x0105,
CM1CON0 absolute 0x0107,
CM2CON0 absolute 0x0108,
CM2CON1 absolute 0x0109,
EEDATA absolute 0x010C,
EEDAT absolute 0x010C,
EEADR absolute 0x010D,
EEDATH absolute 0x010E,
EEADRH absolute 0x010F,
SRCON absolute 0x0185,
BAUDCTL absolute 0x0187,
ANSEL absolute 0x0188,
ANSELH absolute 0x0189,
EECON1 absolute 0x018C,
EECON2 absolute 0x018D;
Если в данном исходнике заменить - может при задействовании программы сразу будет переключать порт, скажем, RE-2 на "прерывания"???
Или это уже моя фантазия?
В общем не знаю как даже поступить. То ли искать кому МК на проверку дать, то ли схемку как-то проверять, то ли руки отрубить сразу...
З.Ы. Кстати говоря, пока я не начал въедаться в Си - может сразу перейти на микропаскаль? Я на паскале программировал пару лет назад... Но, честно, разница ощутима между турбо и микро.