• 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 (panmay)




Re: unsigned char temp;如何將bit重新定義
#11
新會員
新會員


to;版主
謝謝回應!
1..以mplabe sim有分配位置(0xff)
2..以icd2接至目標電路板則無分配位置,產生"reserved memory"

發表於: 2005/5/14 13:05
頂部


unsigned char temp;如何將bit重新定義
#12
新會員
新會員


//1.. 如標題
//2.. hitec picc18
//3.. device pic18f1220
//4.. 全局變數如下:

union {
unsigned char j;
unsigned t0:1;
unsigned t1:1;
unsigned t2:1;
unsigned t3:1;
unsigned t4:1;
unsigned t5:1;
unsigned t6:1;
unsigned t7:1;

}ggyy;

// "watch "windows之 'ggyy'未分配位址且出現reserved memory''

發表於: 2005/5/14 9:06
頂部


PWM不能動作
#13
新會員
新會員


//PIC18F1220
//全橋式輸出,INT0=0 then Autoshutdown
//檢查RB7還是INPIT
//ECCPASE 並未=1



IRCF0 = 1; // Used to set intrc speed to 8 MHz
IRCF1 = 1; // Used to set intrc speed to 8 MHz
IRCF2 = 1; // Used to set intrc speed to 8 MHz

TRISB = 0xff;
PR2 = 0x3F; // Sets PWM Period at 31.2 kHz
CCP1CON = 0b01001110; // Full bridge PWM forward,P1M0=1,
ECCPAS = 0b11001100; // INT0 pin low causes shutdown,Pins A/C=1,B/D=0
PWM1CON =0x0; // b7=0→clear ECCPASE ,b7=1→autorestart
TMR2IF = 0;
T2CON = 0; // TMR2 Off with no prescale
CCPR1L = 0x1F; // Sets Duty Cycle to
TMR2ON = 1; // Start Timer2
while(TMR2IF)
; // wait until TMR2 overflows(first period)

PORTA = 0;
TRISA = 0b00111111; // Set RA7 and RA6 as outputs
PORTB = 0;
TRISB = 0b00110011; // Set RB7,RB6,RB3,RB2 outputs
RBPU = 1; // RB pull up resister

ADCON0 = 1; // Use Vdd as Ref,Channel select AN0,ADON
ADCON1 = 0b11110000; // Configure AN0~AN3 as analog
ADCON2 = 0b10000101; // Right j


T0CS = 0; // Timer0 as timer not a counter
TMR0 = TMR0base; // Preload value
PSA = 0; // Prescaler to Timer0
T0PS0 = 0; // Prescale to 32 => 1024 Hz
T0PS1 = 0;
T0PS2 = 1;
INTCON = 0;
PIE1 = 0;
TMR0IE = 1; // Enable Timer0 int


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


Re: eeprom write(mplab sim=ok,icd2 "pic18f1220" not ok)
#14
新會員
新會員


Thank you!
解決了!

發表於: 2005/5/2 9:04
頂部


eeprom write(mplab sim=ok,icd2 "pic18f1220" not ok)
#15
新會員
新會員



//hitec c18,pic1220
#include <pic18.h>
#include <pic18f1220.h>
#include <math.h>
#include <stdlib.h>
..
...
....
....
...

void EE_W(unsigned char address, int data)

{
union
{
unsigned int i;
unsigned char b[2];
} etemp;
etemp.i = data;

//Low
EEADR = address;
EEDATA = etemp.b[0];
EEPGD = 0;
CFGS = 0;
WREN= 1;
GIE = 0;
EECON2 = 0x55;
EECON2 = 0xAA;
WR = 1;
while(WR)
;
//Hi byte
EEADR++;
EEDATA = etemp.b[1];
EECON2 = 0x55;
EECON2 = 0xAA;
WR = 1;
while(WR)
;
WREN= 0;
GIE = 1;
}


//configbit=
//osc=int rc,ra7:6=io
//low voltage program=disable
//data eeprom code protect=disable
//data eeprom write protect=disable

發表於: 2005/4/30 13:24
頂部


GPIO<5:4>無法設成'OUTPUT'
#16
新會員
新會員


片段

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

list p=12f629
include "c:\program files\mplab ide\mchip_tools\p12f629.inc"

__CONFIG _CP_ON&_WDT_OFF&_MCLRE_OFF&_INTRC_OSC_NOCLKOUT&_PWRTE_ON&_BODEN_ON


;***** VARIABLE DEFINITIONS *****
CBLOCK 0x20

clkcount

W_TEMP ;
STATUS_TEMP ;



endc

;


;************************

ORG 0x000 ; coding begins here

bsf STATUS,RP0
call 3FFh
movwf OSCCAL

goto _MAIN

;****************************
;Interrupt Vector
interpt:
ORG 0x04
movwf W_TEMP ;
;
swapf STATUS,W ;
bcf STATUS,RP0 ;
;
movwf STATUS_TEMP ;


NOP

SER_EXIT:
bcf STATUS,RP0 ;
swapf STATUS_TEMP,W ;
;
movwf STATUS ;
swapf W_TEMP,F ;
swapf W_TEMP,W ;
retfie
;****************************
_MAIN:
call init
_doing:
nop

goto _doing

;**************************
init: ;在PAGE0
bcf STATUS,RP0 ;Bank 0
clrf GPIO ;Init GPIO
movlw 07h ;Set GP<2:0> to
movwf CMCON ;digital IO(Not ADC IN)

bcf T1CON,T1OSCEN
bcf T1CON,TMR1GE

bsf STATUS,RP0 ;Bank 1
movlw b'11110000' ;wake pull-ups
movwf WPU

;clrf ANSEL ;digital I/O
movlw b'11001111'
movwf TRISIO

movlw b'10000000' ;
movwf OPTION_REG

movlw b'00001111'
movwf IOCB ;pin on change

bcf STATUS,RP0
NOP

bsf INTCON,PEIE
bsf INTCON,T0IE
bsf INTCON,GIE
return

END



發表於: 2004/6/13 18:29
頂部



« 1 (2)



:::

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... ]

教育訓練中心

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