B
be_jouster
Guest
Hi all,# include "p24FJ64GA004.h"
# include "remapable_peripheral.h"_CONFIG1 (JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & BKBUG_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR32 & WDTPS_PS1)
_CONFIG2 (IESO_OFF & FNOSC_PRI & FCKSM_CSDCMD & OSCIOFNC_OFF & IOL1WAY_OFF & I2C1SEL_PRI & POSCMOD_XT)# define InlineAsm __asm__ πτητικών# define UnlockRegister () (InlineAsm ( "mov # OSCCON, w1 \ n \
mov # 0x46, w2 \ n \
mov # 0x57, w3 \ n \
mov.b w2, [w1] \ n \
mov.b W3, [w1] \ n \
bclr OSCCON, # 6 ")?)
# define LockRegister () (InlineAsm ( "mov # OSCCON, w1 \ n \
mov # 0x46, w2 \ n \
mov # 0x57, w3 \ n \
mov.b w2, [w1] \ n \
mov.b W3, [w1] \ n \
bset OSCCON, # 6 ")?)
void ConfigureRPpin (void)?
void ConfigureRPpin (void) (
UnlockRegister ()?
/ / Είσοδος
RPINR0bits.INT1R = RP0?
RPINR1bits.INT2R = RP1?
RPINR3bits.T2CKR = rp2?
RPINR3bits.T3CKR = RP3?
RPINR4bits.T4CKR = RP4?
RPINR4bits.T5CKR = RP5?
RPINR7bits.IC1R = RP6?
RPINR7bits.IC2R = RP7?
RPINR8bits.IC3R = RP8?
RPINR8bits.IC4R = RP9?
RPINR9bits.IC5R = RP10?
RPINR11bits.OCFAR = RP11?
RPINR11bits.OCFBR = RP12?
RPINR18bits.U1RXR = RP13?
RPINR18bits.U1CTSR = RP14?
RPINR19bits.U2RXR = RP15?
RPINR19bits.U2CTSR = RP16?
RPINR20bits.SDI1R = RP17?
RPINR20bits.SCK1R = RP18?
RPINR21bits.SS1R = RP19?
RPINR22bits.SDI2R = RP20?
RPINR22bits.SCK2R = RP21?
RPINR23bits.SS2R = RP22?
/ / Output
RPOR0bits.RP0R = NULL?
RPOR0bits.RP1R = NULL?
RPOR1bits.RP2R = NULL?
RPOR1bits.RP3R = NULL?
RPOR2bits.RP4R = NULL?
RPOR2bits.RP5R = NULL?
RPOR3bits.RP6R = NULL?
RPOR3bits.RP7R = NULL?
RPOR4bits.RP8R = NULL?
RPOR4bits.RP9R = NULL?
RPOR5bits.RP10R = NULL?
RPOR5bits.RP11R = NULL?
RPOR6bits.RP12R = NULL?
RPOR6bits.RP13R = NULL?
RPOR7bits.RP14R = NULL?
RPOR7bits.RP15R = NULL?
RPOR8bits.RP16R = NULL?
RPOR8bits.RP17R = NULL?
RPOR9bits.RP18R = NULL?
RPOR9bits.RP19R = NULL?
RPOR10bits.RP20R = NULL?
RPOR10bits.RP21R = NULL?
RPOR11bits.RP22R = NULL?
RPOR11bits.RP23R = NULL?
RPOR12bits.RP24R = NULL?
RPOR12bits.RP25R = NULL?
LockRegister ()?
)
int main (void) (
ConfigureRPpin ()?
AD1PCFG = 0xFFFF?
TRISB = 0x0000?
ODCB = 0x0000?
TRISC = 0x0000?
ODCC = 0x0000?
ενώ (1) (
PORTB = 0xFFFF?
PORTC = 0xFFFF?
PORTB = 0x0000?
PORTC = 0x0000?
)
)
Εδώ είναι το πρόγραμμά μου.Απλώς αναβοσβήνει το LED για portB και portC.4MHz osc κρύσταλλο χρησιμοποιείται.Μετά εγώ φλας της Ειρήνης και κάντε κλικ στο κουμπί Τύπου από Reset, τίποτα δεν συμβαίνει.Αλλά όταν άλλαξε icd2 μου σε debug mode, το πρόγραμμα πίσω το ΣΜΕ και κάντε κλικ στο κουμπί αναπαραγωγής, τότε αυτό εργασίας.
Plz συμβουλεύει.
# include "remapable_peripheral.h"_CONFIG1 (JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & BKBUG_OFF & ICS_PGx1 & FWDTEN_OFF & WINDIS_OFF & FWPSA_PR32 & WDTPS_PS1)
_CONFIG2 (IESO_OFF & FNOSC_PRI & FCKSM_CSDCMD & OSCIOFNC_OFF & IOL1WAY_OFF & I2C1SEL_PRI & POSCMOD_XT)# define InlineAsm __asm__ πτητικών# define UnlockRegister () (InlineAsm ( "mov # OSCCON, w1 \ n \
mov # 0x46, w2 \ n \
mov # 0x57, w3 \ n \
mov.b w2, [w1] \ n \
mov.b W3, [w1] \ n \
bclr OSCCON, # 6 ")?)
# define LockRegister () (InlineAsm ( "mov # OSCCON, w1 \ n \
mov # 0x46, w2 \ n \
mov # 0x57, w3 \ n \
mov.b w2, [w1] \ n \
mov.b W3, [w1] \ n \
bset OSCCON, # 6 ")?)
void ConfigureRPpin (void)?
void ConfigureRPpin (void) (
UnlockRegister ()?
/ / Είσοδος
RPINR0bits.INT1R = RP0?
RPINR1bits.INT2R = RP1?
RPINR3bits.T2CKR = rp2?
RPINR3bits.T3CKR = RP3?
RPINR4bits.T4CKR = RP4?
RPINR4bits.T5CKR = RP5?
RPINR7bits.IC1R = RP6?
RPINR7bits.IC2R = RP7?
RPINR8bits.IC3R = RP8?
RPINR8bits.IC4R = RP9?
RPINR9bits.IC5R = RP10?
RPINR11bits.OCFAR = RP11?
RPINR11bits.OCFBR = RP12?
RPINR18bits.U1RXR = RP13?
RPINR18bits.U1CTSR = RP14?
RPINR19bits.U2RXR = RP15?
RPINR19bits.U2CTSR = RP16?
RPINR20bits.SDI1R = RP17?
RPINR20bits.SCK1R = RP18?
RPINR21bits.SS1R = RP19?
RPINR22bits.SDI2R = RP20?
RPINR22bits.SCK2R = RP21?
RPINR23bits.SS2R = RP22?
/ / Output
RPOR0bits.RP0R = NULL?
RPOR0bits.RP1R = NULL?
RPOR1bits.RP2R = NULL?
RPOR1bits.RP3R = NULL?
RPOR2bits.RP4R = NULL?
RPOR2bits.RP5R = NULL?
RPOR3bits.RP6R = NULL?
RPOR3bits.RP7R = NULL?
RPOR4bits.RP8R = NULL?
RPOR4bits.RP9R = NULL?
RPOR5bits.RP10R = NULL?
RPOR5bits.RP11R = NULL?
RPOR6bits.RP12R = NULL?
RPOR6bits.RP13R = NULL?
RPOR7bits.RP14R = NULL?
RPOR7bits.RP15R = NULL?
RPOR8bits.RP16R = NULL?
RPOR8bits.RP17R = NULL?
RPOR9bits.RP18R = NULL?
RPOR9bits.RP19R = NULL?
RPOR10bits.RP20R = NULL?
RPOR10bits.RP21R = NULL?
RPOR11bits.RP22R = NULL?
RPOR11bits.RP23R = NULL?
RPOR12bits.RP24R = NULL?
RPOR12bits.RP25R = NULL?
LockRegister ()?
)
int main (void) (
ConfigureRPpin ()?
AD1PCFG = 0xFFFF?
TRISB = 0x0000?
ODCB = 0x0000?
TRISC = 0x0000?
ODCC = 0x0000?
ενώ (1) (
PORTB = 0xFFFF?
PORTC = 0xFFFF?
PORTB = 0x0000?
PORTC = 0x0000?
)
)
Εδώ είναι το πρόγραμμά μου.Απλώς αναβοσβήνει το LED για portB και portC.4MHz osc κρύσταλλο χρησιμοποιείται.Μετά εγώ φλας της Ειρήνης και κάντε κλικ στο κουμπί Τύπου από Reset, τίποτα δεν συμβαίνει.Αλλά όταν άλλαξε icd2 μου σε debug mode, το πρόγραμμα πίσω το ΣΜΕ και κάντε κλικ στο κουμπί αναπαραγωγής, τότε αυτό εργασίας.
Plz συμβουλεύει.