:::

論壇索引


Board index » All Posts (a780917a)




PIC16F18155 MCC設定疑問
#1
高級會員
高級會員


PIC16F18155,開啟MCC好像都強制選用Melody,
比起Classic設定差異蠻大的,有Melody使用教學影片嗎?

我的疑問是在我設定完ADC、PWM1、PWM3等等初始化選項後
在PIN設定區並沒有跳出腳位讓我勾選,是我哪裡漏設定了嗎?

Attach file:



jpg  1.jpg (208.83 KB)
49103_68ff1e930a0d5.jpg 1514X683 px

發表於: 10/27 15:26
頂部


Re: PIC16F18144 MCC EEPROM設定問題
#2
高級會員
高級會員


謝謝回覆
我發現nvm.c生成之後,NVMCON2 這需要手動修改為0X55,0XAA。
NVMCON2 = 0x55;//unlockKeyLow;
NVMCON2 = 0xAA;//unlockKeyHigh;
還有須手動加入 while (NVMCON1bits.WR){}延遲才能正常使用。
這部份是我MCC沒設定好還是有BUG呢?

void EEPROM_Write(eeprom_address_t address, eeprom_data_t data)
{
//Save global interrupt enable bit value
uint8_t globalInterruptBitValue = INTCONbits.GIE;

//Access EEPROM
NVMCON1bits.NVMREGS = 1;

//Enable write operation
NVMCON1bits.WREN = 1;

//Load NVMADR with the EEPROM address
NVMADRH = (uint8_t) (address >> 8);
NVMADRL = (uint8_t) address;

//Load NVMDAT with the desired value
NVMDATL = data;

//Disable global interrupt
INTCONbits.GIE = 0;

//Perform the unlock sequence
NVMCON2 = 0x55//unlockKeyLow;
NVMCON2 = 0xAA//unlockKeyHigh;

NVMCON1bits.WR = 1;
while (NVMCON1bits.WR)
{
}

//Restore global interrupt enable bit value
INTCONbits.GIE = globalInterruptBitValue;

//Disable write operation
NVMCON1bits.WREN = 0;
}

發表於: 8/22 10:13
頂部


PIC16F18144 MCC EEPROM設定問題
#3
高級會員
高級會員


PIC16F18144 規格書寫有Data EEPROM (bytes):256

在MCC選取使用時Memory 裡的EEPROM似乎只能與I2C一起用?

設定選項裡出現
Hardware Settings
Device
Density
Page Write Buffer

但我只想單純使用EEPROM 該怎麼設定呢?

選擇ON-chip : NVM後
eeprom.c裡的 eeprom_address_t 與EEPROM_Write(), EEPROM_Read()
沒有被自動定義,該怎麼修改呢?
bool EEPROM_ByteWrite(uint32_t address, uint8_t *data)
{
uint8_t getData = *data;
eeprom_address_t writeAddress = (eeprom_address_t) (address);
NVM_UnlockKeySet(UNLOCK_KEY);
EEPROM_Write(writeAddress, getData);
NVM_UnlockKeyClear();
while (NVM_IsBusy());
if (NVM_StatusGet() == NVM_OK)
{
return true;
}
else
{
NVM_StatusClear();
return false;
}
}
bool EEPROM_ByteRead(uint32_t address, uint8_t *data)
{
eeprom_address_t readAddress = (eeprom_address_t) (address);
*data = EEPROM_Read(readAddress);
return true;
}

發表於: 8/18 15:35

Edited by a780917a on 2025年08月18日 15:59:13
頂部


Re: MPLAB X IDE V6.00 開啟時跳錯誤訊息
#4
高級會員
高級會員


謝謝,安裝V6.20版確實是折衷的辦法,沒有再跳出錯誤訊息,且ICD3可以繼續使用

發表於: 8/5 13:02
頂部


MPLAB X IDE V6.00 開啟時跳錯誤訊息
#5
高級會員
高級會員


從某天在Plugins 更新與下載一些軟件之後,MPLAB X IDE開啟時就會跳出這段錯誤訊息, 我將軟體刪除重新安裝還是無法解決。 該怎麼處理呢?
目前安裝6.25版本可正常使用, 但我的燒錄器是ICD3,所以還需要用舊版一段時間直到買新的燒錄器

Warning - could not install some modules: org.eclipse.equinox.common - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-equinox-common.jar: Cannot start org.eclipse.equinox.common state remains INSTALLED after start() org.eclipse.core.runtime.compatibility.auth - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-core-runtime-compatibility-auth.jar: Cannot start org.eclipse.core.runtime.compatibility.auth state remains INSTALLED after start() org.eclipse.core.jobs - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-core-jobs.jar: Cannot start org.eclipse.core.jobs state remains INSTALLED after start() org.eclipse.equinox.registry - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-equinox-registry.jar: Cannot start org.eclipse.equinox.registry state remains INSTALLED after start() org.eclipse.equinox.preferences - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-equinox-preferences.jar: Cannot start org.eclipse.equinox.preferences state remains INSTALLED after start() org.eclipse.equinox.app - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-equinox-app.jar: Cannot start org.eclipse.equinox.app state remains INSTALLED after start() org.eclipse.core.contenttype - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-core-contenttype.jar: Cannot start org.eclipse.core.contenttype state remains INSTALLED after start() org.eclipse.core.runtime - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-core-runtime.jar: Cannot start org.eclipse.core.runtime state remains INSTALLED after start() org.eclipse.mylyn.wikitext.core - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-wikitext-core.jar: Cannot start org.eclipse.mylyn.wikitext.core state remains INSTALLED after start() org.eclipse.equinox.security - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-equinox-security.jar: Cannot start org.eclipse.equinox.security state remains INSTALLED after start() org.eclipse.core.net - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-core-net.jar: Cannot start org.eclipse.core.net state remains INSTALLED after start() org.eclipse.mylyn.commons.core - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-commons-core.jar: Cannot start org.eclipse.mylyn.commons.core state remains INSTALLED after start() org.eclipse.mylyn.commons.net - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-commons-net.jar: Cannot start org.eclipse.mylyn.commons.net state remains INSTALLED after start() org.eclipse.mylyn.commons.xmlrpc - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-commons-xmlrpc.jar: Cannot start org.eclipse.mylyn.commons.xmlrpc state remains INSTALLED after start() org.eclipse.mylyn.commons.repositories.core - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-commons-repositories-core.jar: Cannot start org.eclipse.mylyn.commons.repositories.core state remains INSTALLED after start() org.eclipse.mylyn.tasks.core - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-tasks-core.jar: Cannot start org.eclipse.mylyn.tasks.core state remains INSTALLED after start() org.eclipse.mylyn.bugzilla.core - org.netbeans.InvalidException: Netigso: C:\Program Files\Microchip\MPLABX\v6.00\mplab_platform\ide\modules\org-eclipse-mylyn-bugzilla-core.jar: Cannot start org.eclipse.mylyn.bugzilla.core state remains INSTALLED after start()

發表於: 8/5 8:24
頂部


BLDC六步驅動的問題
#6
高級會員
高級會員


大家好,這次想問的是用於BLDC六步驅動的腳位控制
使用的是PIC16F1933,搭配MCC做腳位設定,用ECCP(1~3)將
RC0,RC2,RC7設為PWM輸出控制上臂,
RA6,RC1,RC6設一般IO輸出控制下臂,

問題1:PWM關斷方式
下面的程式,當上臂需關斷時用 EPWM1_LoadDutyValue(0);
將DutyCycle寫0,這樣有問題嗎?還是可以用IO_RC2_LAT=0;
或PORTC = (PORTC & 0xFB);之類的程式去關

/*
 反轉順序:132645
 RC0(EPWM2):W+ RC2(EPWM1):V+ RC7(EPWM3):U+
 RA6:W- RC1:V- RC6:U-
 */
void PWM_Switch(void)
{
    switch(
Hall_P)
    {
        case 
0:
                
LED_RC4_LAT 0;
                break;
    
        case 
1://U+W-   
            
if(Hall_N == ||  Flag.Initial==0)
            {
                
EPWM3_LoadDutyValue(DutyCycle); //U+
                
IO_RA6_LAT 1//W-
                
EPWM1_LoadDutyValue(0);  //V+ = 0
                
Hall_N 1;
                
Hall_Er_T 0;   
            }
                break;
                
        case 
2://W+V-   U+ = 0   
            
if(Hall_N == ||  Flag.Initial==0)
            {               
                
EPWM2_LoadDutyValue(DutyCycle); //W+
                
IO_RC1_LAT 1//V-
                
EPWM3_LoadDutyValue(0); //U+ = 0
                
Hall_N 2;
                
Hall_Er_T 0;   
            }                
                break;      
                
        case 
3://U+V-   W- = 0
            
if(Hall_N == ||  Flag.Initial==0)
            {            
                
EPWM3_LoadDutyValue(DutyCycle); //U+
                
IO_RC1_LAT 1//V-
                
IO_RA6_LAT 0//W- = 0
                
Hall_N 3;
                
Hall_Er_T 0;                
            }
                break;     
                
        case 
4://V+U-  W+ = 0
            
if(Hall_N == ||  Flag.Initial==0)
            {
                
EPWM1_LoadDutyValue(DutyCycle); //V+
                
IO_RC6_LAT 1//U-
                
EPWM2_LoadDutyValue(0);  //W+ = 0
                
Hall_N 4;
                
Hall_Er_T 0;
            }
                break;  
                
        case 
5://V+W-   U- = 0
            
if(Hall_N == ||  Flag.Initial==0)
            {            
                
EPWM1_LoadDutyValue(DutyCycle); //V+
                
IO_RA6_LAT 1;  //W-
                
IO_RC6_LAT 0;  //U- = 0
                
Hall_N 5;
                
Hall_Er_T 0;
            }
                break;
         
        case 
6://W+U-   V- = 0
            
if(Hall_N == ||  Flag.Initial==0)
            {                
                
EPWM2_LoadDutyValue(DutyCycle); //W+
                
IO_RC6_LAT 1//U-
                
IO_RC1_LAT 0//V- = 0
                
Hall_N 6;
                
Hall_Er_T 0;         
            }
                break;  
           
        case 
7:
                
LED_RC4_LAT 0;
                break;            
    }
}


問題2:Hall訊號與換相
Hall腳位要不要用IOC中斷去觸發?或者放在主程式裡隨時偵測就好?
電子換相怎麼這麼危險..Hall隨便一個雜訊導致相位切錯就是直接爆炸
做了很多種嘗試,還是無法完全避免雜訊問題,有沒有建議呢?
Hall_P = (PORTB 0x07);
            
PWM_Switch();

問題3:ALARM後的處理
目前是用過電流與換相計時的方式觸發ALARM
ALARM觸發後該六臂全部切斷嗎?
會不會有馬達反電勢無處釋放造成IGBT燒壞的情況呢?
目前只要運作中出問題,驅動板就會有元件燒毀..只能猜原因。

發表於: 2023/11/22 14:39
頂部


Re: PIC16F ,USART接收問題
#7
高級會員
高級會員


自問自答
是輸出端的問題, 直接丟A5,00,00,00,64,7D 沒有間斷的話會有異常

設一個計時器(10ms)
每次丟一個Byte就可以了
A5
00
00
00
64
7D

發表於: 2023/10/11 14:33
頂部


PIC16F ,USART接收問題
#8
高級會員
高級會員


版主好大家好,

這次要問PIC16F系列Usart的接收問題
用的是PIC16F1829,MPLABX IDE,波特率:19200

我需要接收一組訊號 :A5,00,00,00,00,64,7D
A5=字頭, Tab[0~3]=開關使用0 or 1,Tab[4]=0x00~0x64, 7D=字尾
Tab[4]數據會一直亂跳。
但如果只傳送一組變數:A5,64,7D
Tab[0]接收的數據就很正常,傳輸端修改變數,接收端會一起變化。
程式如下,可以幫我看看問題在哪嗎
uint8_t Tab[5];
void User_Usart_R(void)
{
while (EUSART_DataReady)
{
uint8_t Data = 0;
Data = EUSART_Read();
if(Uart_FLAG == 0)
{
if(Data == 0xA5)
{
Uart_FLAG = 1;
k = 0;
}
}
else
{
if(Data == 0x7D)Uart_FLAG = 0;
else
{
Tab[k] = Data;
k++;
}
}
}

發表於: 2023/10/11 10:16
頂部


Re: PIC16系列如何使用printf指令做Usart傳輸呢
#9
高級會員
高級會員


改成這樣成功了
printf("main.t0.txt=\"-100.0\"\xff\xff\xff");

發表於: 2023/9/22 16:07
頂部


PIC16系列如何使用printf指令做Usart傳輸呢
#10
高級會員
高級會員


版主好大家好,

這次要問PIC16F系列如何使用printf指令傳輸UART串列數據呢
用的是PIC16F1823,MPLABX IDE,
我在網上搜到的方法是在esuart.c裡加入
include
void putch(unsigned char byte);
void putch(unsigned char byte)
{
while(!TXIF)continue;
TXREG = byte;
}
接著我在main.c裡
while (1)
{
printf("main.t0.txt=100\0xff\0xff\0xff");
}
想試著用HMI的通訊協議傳輸100出去,但聯機一直沒有效果
是哪邊有問題呢,波特率兩邊都設19200,RX->TX TX->RX
另外想問EUSART的中斷要不要開,跟Redirect STDIO to USART要不要勾呢

發表於: 2023/9/22 15:14
頂部



(1) 2 3 4 ... 8 »



:::

Microchip連結

https://www.linkedin.com/company/microchiptechnologytaiwan
https://www.facebook.com/microchiptechnologytaiwan/?locale=zh_TW
https://mkpage.microchip.com/l/1082123/2025-03-12/2stnv5
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------