#include "p24fj32ga002.h"
int main()
{
//************************************* // Unlock Registers //************************************* asm volatile ( "MOV #OSCCON, w1
" "MOV #0x46, w2
" "MOV #0x57, w3
" "MOV.b w2, [w1]
" "MOV.b w3, [w1]
" "BCLR OSCCON,#6"); //*************************** // Configure Input Functions // (See Table 9-1) //*************************** //*************************** // Assign U1RX To Pin RP0 //*************************** RPINR18bits.U1RXR = 0; //*************************** // Assign U1CTS To Pin RP1 //*************************** RPINR18bits.U1CTSR = 1; //*************************** // Configure Output Functions // (See Table 9-2) //*************************** //*************************** // Assign U1TX To Pin RP2 //*************************** RPOR1bits.RP2R = 3; //*************************** // Assign U1RTS To Pin RP3 //*************************** RPOR1bits.RP3R = 4; //************************************* // Lock Registers //************************************* asm volatile ( "MOV #OSCCON, w1
" "MOV #0x46, w2
" "MOV #0x57, w3
" "MOV.b w2, [w1]
" "MOV.b w3, [w1]
" "BSET OSCCON, #6" ); } 我用的是mplab ide,芯片是pic24f系列,引脚复位时要用解锁系列,现在为什么改变不了osccon中bit6的值,而其他位的值能改变?是不是和别的寄存器有关系呢? 其他的系列不用这个解锁系列吗?谁能帮帮我,谢谢了! |