• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::

論壇索引


Board index » All Posts (matsuwang)




上課的demo程式不能執行
#1
初級會員
初級會員


版主你好:

Toolsuite Contents:
選擇 MPLAB C18 C Compiler(mcc18.exe)
但是build all 會有問題
我不了解哪裡有問題??
感謝版主的慈悲!!


程式:

*********************************************
/*********************************************************************
*
* Microchip USB Bootloader Version 1.2
*
*********************************************************************
* FileName: main.c
* Dependencies: See INCLUDES section below
* Processor: PIC18
* Compiler: C18 3.11+
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the ompany? for its PICmicro?Microcontroller is intended and
* supplied to you, the Company customer, for use solely and
* exclusively on Microchip PICmicro Microcontroller products. The
* software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN S IS?CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Rawin Rojvanit 11/19/04 Original.
* Rawin Rojvanit 05/14/07 Minor updates.
********************************************************************/

/*********************************************************************
IMPORTANT NOTE: This booloader example code is not intended to work
with the PIC18F87J50 Family of microcontrollers.
*********************************************************************/


/** I N C L U D E S **********************************************************/
#include "C:\MCC18\h\P18F4550.h"
#include "C:\MCHPFSUSB\ttt\Boot\system\typedefs.h" // Required
#include "C:\MCHPFSUSB\ttt\Boot\system\usb\usb.h" // Required
#include "C:\MCHPFSUSB\ttt\Boot\io_cfg.h" // Required

#include "C:\MCHPFSUSB\ttt\Boot\system\usb\usb_compile_time_validation.h" // Optional

/** C O N F I G U R A T I O N ************************************************/

#if defined(__18F4550)||defined(__18F4455)|| \
defined(__18F2550)||defined(__18F2455)|| \
defined(__18F4553)||defined(__18F4458)|| \
defined(__18F2553)||defined(__18F2458)

// Note: Some of the below configuration bits are commented out
// to prevent build errors with some of the above listed devices.
// For example, on the PIC18F4458 CP3, WRT3, and EBTR3 don't exist.

#pragma config PLLDIV = 5 // (20 MHz input)
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2 // Clock source from 96MHz PLL/2
#pragma config FOSC = HSPLL_HS
#pragma config FCMEN = OFF
#pragma config IESO = OFF
#pragma config PWRT = OFF
#pragma config BOR = ON
#pragma config BORV = 3
#pragma config VREGEN = ON
#pragma config WDT = OFF
#pragma config WDTPS = 32768
#pragma config MCLRE = ON
#pragma config LPT1OSC = OFF
#pragma config PBADEN = OFF
#pragma config CCP2MX = ON
#pragma config STVREN = ON
#pragma config LVP = OFF
//#pragma config ICPRT = OFF // Dedicated In-Circuit Debug/Programming
#pragma config XINST = OFF // Extended Instruction Set
#pragma config CP0 = OFF
#pragma config CP1 = OFF
#pragma config CP2 = OFF
//#pragma config CP3 = OFF
#pragma config CPB = OFF
#pragma config CPD = OFF
#pragma config WRT0 = OFF
#pragma config WRT1 = OFF
#pragma config WRT2 = OFF
//#pragma config WRT3 = OFF
#pragma config WRTB = ON // Boot Block Write Protection
#pragma config WRTC = OFF
#pragma config WRTD = OFF
#pragma config EBTR0 = OFF
#pragma config EBTR1 = OFF
#pragma config EBTR2 = OFF
//#pragma config EBTR3 = OFF
#pragma config EBTRB = OFF

#endif

/** V A R I A B L E S ********************************************************/
#pragma udata

/** P R I V A T E P R O T O T Y P E S ***************************************/

/** V E C T O R R E M A P P I N G *******************************************/

#pragma code _HIGH_INTERRUPT_VECTOR = 0x000008
void _high_ISR (void)
{
_asm goto RM_HIGH_INTERRUPT_VECTOR _endasm
}

#pragma code _LOW_INTERRUPT_VECTOR = 0x000018
void _low_ISR (void)
{
_asm goto RM_LOW_INTERRUPT_VECTOR _endasm
}

#pragma code

/** D E C L A R A T I O N S **************************************************/
#pragma code
/******************************************************************************
* Function: void main(void)
*
* PreCondition: None
*
* Input: None
*
* Output: None
*
* Side Effects: None
*
* Overview: Main program entry point.
*
* Note: None
*****************************************************************************/
void main(void)
{
byte temp;
temp = ADCON1;
ADCON1 |= 0x0F;

//TRISBbits.TRISB4 = 1; // Reset value is already '1'

//Check Bootload Mode Entry Condition
if(PORTBbits.RB4 == 1) // If not pressed, User Mode
{
ADCON1 = temp; // Restore reset value
_asm goto RM_RESET_VECTOR _endasm
}//end if

//Bootload Mode
mInitAllLEDs();
mInitializeUSBDriver(); // See usbdrv.h
USBCheckBusStatus(); // Modified to always enable USB module
while(1)
{
USBDriverService(); // See usbdrv.c
BootService(); // See boot.c
}//end while
}//end main

#pragma code user = RM_RESET_VECTOR

/** EOF main.c ***************************************************************/


*********************************************


錯誤訊息如下

----------------------------------------------------------------------
Release build of project `C:\MCHPFSUSB\ttt\Hid\Ctrl_IO_AD_DEMO\MCHPUSB.mcp' started.
Wed Jan 16 15:11:54 2008
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\MCHPFSUSB\ttt\Hid\Ctrl_IO_AD_DEMO\main.o".
Clean: Done.
Executing: "c:\mcc18\bin\mcc18.exe" -p=18F4550 "C:\MCHPFSUSB\ttt\Boot\main.c" -fo="main.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 v3.15 (demo)
Copyright 1999-2005 Microchip Technology Inc.
Days remaining until demo becomes feature limited: 60
Skipping link step. The project contains no linker script.
----------------------------------------------------------------------
Release build of project `C:\MCHPFSUSB\ttt\Hid\Ctrl_IO_AD_DEMO\MCHPUSB.mcp' failed.
Wed Jan 16 15:11:54 2008
FAILED
----------------------------------------------------------------------

發表於: 2008/1/16 15:25
頂部


pic 12f675 內部震盪的問題??
#2
初級會員
初級會員


我遇到一個很奇怪的問題
我的mcu是12f675
電路設計是沒有石英晶體的,用的是內部震盪
可是呢我燒錄時~~設定由內部震盪
程式動作就壞怪怪的!!

我就改成不內部震盪,也沒外部震盪.
程式動作就正常了!!

我有看過有關12f675內部震盪的資料
有LP XT HS RC EC INTOSC
INTOSC是內部震盪的設定??
他是在CONFIG裡邊設定的嗎??
為什麼12F675的DATA MEMORY沒有CONFIG的暫存器??

請問各位大大有遇到這樣的問題過嗎??
我很疑惑??

發表於: 2007/3/30 10:28
頂部


奇怪的燒錄的問題!!
#3
初級會員
初級會員


事情是這樣的
公司內有兩台電腦分別假設為A跟B

軟體是MPLAB IDE v7.50免費的
A電腦跟B電腦都是用這套軟體

第一個問題

奇怪的事情發生了!!
同樣的code(燒錄設定也都一樣)
在A電腦燒錄後MCU動作是正常的
在B電腦燒錄後動作就異常了!!

請問各位先進有遇過類這樣的問題嗎??
我是覺得是232傳輸的問題!!
但是MPLAB IDE v7.50這套軟體我不知道在哪裡可以設定232傳輸了速率-------------

**************************************

第2個問題是

吾人在B電腦把這套軟體(MPLAB IDE v7.50)刪除,然後從灌..
發現一個令人困惑的問題...
在Project --> project wizard 裡的

第二步 設定Microchip MPASM Tollsuite 的路徑
怎麼會記憶上次的路徑

例如:上次是灌在D槽 這次灌在C槽
這次要將路徑由
D:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe改為
C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe時就會有問題!!







發表於: 2007/3/26 12:12
頂部


MPLAB模擬
#4
初級會員
初級會員


各位先進....
請問哪裡可以到有關
MPLAB模擬....有關Debugger功能裡頭....
可以設定I/O腳的...資料

發表於: 2006/11/16 16:35
頂部


乘法跟除法
#5
初級會員
初級會員



發表於: 2006/7/26 21:55
頂部


判斷負號
#6
初級會員
初級會員


請問各位先進~~~~pic16f72
有可以判斷負號的旗標ㄇ???
請先進教教可以ㄇ!!感恩拉

發表於: 2006/7/19 23:50
頂部


組合語言的除法
#7
初級會員
初級會員


請問組合語言的除法,我想用的方法是右移的方法
因為我覺得用迴圈浪費時間
假設是39除3以組合語言右移是除2
除三的話我該怎麼做ㄋ???
25/5也是一個問題???
請各位先進教教我吧???
我想了一個晚上,還是沒想通,

發表於: 2006/7/13 8:49
頂部


有關PORTA
#8
初級會員
初級會員


list    p=16F873Af=INHX8Mr=DECb=8C=80
    
#include     <p16F873A.inc>        ; Include file locate at defult directory
        


        
ORG        0X00
        
GOTO    MAIN_C
        ORG        0X04
        
GOTO    INT_MAIN 
        ORG        0X10            

                                MAIN_C    BSF    STATUS
,RP0
        MOVLW    0X06
        MOVWF    ADCON1
        
;MOVLW    0X06
        MOVWF    CMCON
        MOVLW    0X0F
        MOVWF    TRISA
        MOVLW    0X80
        MOVWF    TRISC
        MOVLW    0XF0
        MOVWF    TRISB
        MOVLW    0X20
        MOVWF    TXSTA
        MOVLW    0X19
        MOVWF    SPBRG
        MOVLW    0X20
        MOVWF    PIE1

        BCF        STATUS
,RP0
        MOVLW    0X90
        MOVWF    RCSTA
        MOVLW    0XC0
        MOVWF    INTCON

MAIN    MOVLW    0XF5
        MOVWF    PORTB
XX        CALL    DEL_1MS
        BTFSS    PORTA
,1
        
GOTO     MAIN    
        BSF        PORTB
,1
        
GOTO    XX
        

當PROTA
,1     ON時   設定PORTB,1為1....我用的是16F873A....
可是當PORTA,1ON時,我的PORTB,1怎麼都沒動作ㄋ....
是不是我哪裡還沒有設定阿???   
請各位先進,幫我解開迷團ㄇ!!我看了DATA SHEET  我覺得這樣設定應該是可以動作的阿!!!

發表於: 2006/6/15 19:03
頂部


請教有經驗的先進
#9
初級會員
初級會員


有什麼辦法讓單晶片輸出穩定??

發表於: 2006/5/3 10:34
頂部


Re: PIC 16F877的RS232傳輸
#10
初級會員
初級會員


其實你可以用中斷~~~有資料近TXREG就跳中斷!!
沒資料就在主程式等待

發表於: 2006/5/2 23:41
頂部



(1) 2 3 »



:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
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
https://page.microchip.com/APAC-PrefCenters-TW.html
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... ]

教育訓練中心

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