• slider image 442
  • slider image 492
  • slider image 493
  • slider image 494
  • slider image 495
  • slider image 496
  • slider image 488
  • slider image 491
:::

論壇索引


Board index » All Posts (duck288)




Re: 偶又碰到問題啦....
資深會員
資深會員


我的笨程式也許是太長啦....
可否教偶如何瘦身呢?
我希望在收到同步訊號後Delay 4ms
再送出一個0.1ms的觸發訊號
然後收到下個同步訊號後送出一個的Delay 3.9ms觸發訊號
也就是說每收到同步訊號後會減少0.1ms
從Delay 4ms 直到 Delay 1ms
我現在是用CALL Delay 的方式來完成
所以我有3個 delay程式 delay 1ms, delay0.2ms,delay0.1ms
btfss GPIO,0 ---等同步訊號
goto.... ----check sync again
goto loop_1
loop_1
call delay_1ms
call delay_1ms
call delay_1ms
call delay_1ms -----total Delay 4ms
bsf GPIO,1 -----觸發訊號
call delay_0.1ms -----
bcf GPIO,1
btfss GPIO,0 ---等同步訊號
goto.... ----check sync again
goto loop_2
loop_2
call delay_1ms
call delay_1ms
call delay_1ms
call delay_0.2ms
call delay_0.2ms
call delay_0.2ms
call delay_0.2ms
call delay_0.1ms -----total Delay 3.9ms
bsf GPIO,1 -----觸發訊號
call delay_0.1ms -----
bcf GPIO,1
.
.
直到call delay_1ms -----total Delay 1ms
所以程式是又笨又臭又長
我想一定有比較簡單的方法來完成
不知是否有人教偶如何瘦身呢? 3Q 3Q 3Q lor!!!!

發表於: 2005/10/9 13:21
頂部


偶又碰到問題啦....
資深會員
資深會員


偶 用12F508 寫了個程式 在Build all 以後出現下列訊息

warring: Crossing page boundary -- ensure page bits are set.
warring: Address exceeds maximum range for this processor

是蝦咪意思呀???
但是 Build all 以後又出現是 build succeeded
不知該怎麼辦耶???如何 set page 呀 ????

發表於: 2005/10/8 5:54
頂部


Re: 老師.. 偶又有問題囉??
資深會員
資深會員


謝謝版主
16C5X series 偶還不會用 笨鳥偶還在玩10F20X series.
所以啦 可不可以 教偶 如何把副程式放在前 256 bytes裡。

發表於: 2005/9/21 4:30
頂部


Re: 老師.. 偶又有問題囉??
資深會員
資深會員


阿哈..... 素不素偶 的笨程式 超過記憶容量啦 !!!!!
如何在 MPLAB IDE v7中 ,查程式使用量呀???
素不素 這麼個踗.... checksum: 0xee1d ....

發表於: 2005/9/20 6:57
頂部


老師.. 偶又有問題囉??
資深會員
資深會員


Dear All :
中秋節快樂嗎??
偶又有問題囉?? 所以不黑皮耶!!!

在10F202中 使用 " CALL " 的指令是否有限制次數呢?

我連續 CALL 40次,結果組譯時從第20個 CALL 出現問題....
Call or jump not allowed at this address ( must be in low half page )
偶素不素又做錯甚麼咚咚啦
那偶該怎麼辦踗?????

發表於: 2005/9/20 5:12
頂部


Re: 偶又有問題囉...
資深會員
資深會員


謝謝板主....90 度鞠躬...
真的找到了 .hahaha!
又學到從書本找不到的咚咚耶 !
本網頁.... 有效 .....
那天應該辦個網友大會
那麼多高手聚會 一定很有意思
說不定 還有美媚程式高手參加
那學起來一定 ...事半功倍,,,,
流口水啦 ... 哈哈...

發表於: 2005/9/13 0:29
頂部


Re: 偶又有問題囉...
資深會員
資深會員


大哥大 謝謝..3Q.. 阿里阿多啦!!!
真的會工作了耶... 黑皮,黑皮, 真是黑皮.哈哈
就只是大小寫的問題... 害我差點抓狂啦 !!!!
但是為何在 DATA SHEET 中沒有看到呢 ????
您所提到去找安装目录下的头文件,,,,, 不了也!!!
去那兒找呀?????

發表於: 2005/9/10 1:39
頂部


偶又有問題囉...
資深會員
資深會員


各位老書, 前輩, 大哥大,
笨鳥又有問題囉 ?????
剛拿到12F508 於是寫個程式玩玩 ..
程式是取材修改於10F200程式.
但是在build all 時 初現 failed as---->
symbol not previously defined ( INTRC_OSC )
程式如下

; PIC12F508 LED FLASHER FOR TEST
list p=12f508
#include <p12F508.inc> ; processor specific variables
; Configure: Controls the reset pin, code protect, oscillator selection, WDT.
__CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _INTRC_OSC
;-----[Defines & Variable Assignments]---------------------------------------
程式略過
end

我試著把 INTRC_OSC 拿掉 再build all 就ok lar!
不知道這樣對不對也 ?
還有其他設定對不對呢?
Thanks Guys.

發表於: 2005/9/9 4:48
頂部


10 F2XX , PWM ???
資深會員
資深會員


笨鴨我 ,有個地方不了 ??????
煩請大哥能解惑囉!!! 謝謝啦 !!!!
那就是這麼個指令 讓笨鴨我左思右不解

-------> btfsc STATUS,2 <-----------------
2 又表示甚麼呢 ????


全文如下---->

; File Name:PIC10F206_04.asm, by John Massa, Nov 20, 2004, Ver 1.00
; Description: Press the pushbutton and the LED will pulsate on and off.
LIST
; P10F206.INC Standard Header File, Version 1.01 Microchip Technology, Inc.
NOLIST
#include <p10F206.inc> ; processor specific variables
; Configure: Controls the reset pin, code protect, oscillator selection, WDT.
__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF
;-----[Defines & Variable Assignments]---------------------------------------
cblock 0x08
COUNT ; Count buffer
COUNT1 ; Count buffer #1
PWM_BUF ; PWM buffer
endc
;-----[Reset Vector]---------------------------------------------------------
ORG 0x000 ; PIC goes here (Origin of code) after reset.
movwf OSCCAL ; Load the oscillator calibration factor.
goto init ; go to initialization routine
;-----[Initialization]-------------------------------------------------------
init
;-----[OPTION]---------------------------------------------------------------
; OPTION register controls wake on GP0,1,3 change, GP0,1,3 pull-ups, TM0, etc
movlw b'10000111' ; Set pull-ups only, max pre-scaler
OPTION ;
;-----[CMCON0]---------------------------------------------------------------
; Comparator control register
movlw b'10001111' ; Turn-off the comparator, enable the I/O pins.
movwf CMCON0
;-----[TRIS]-----------------------------------------------------------------
; TRIS (reg#) tri-state I/O register. All I/O pins default to inputs at reset.
movlw b'00001000' ; Set GPIO pin 3 to an input, pins 0 - 3 to outputs.
TRIS GPIO ; Register 06h
;-----[Main routine]---------------------------------------------------------
main ; Routine pulsates an LED connected to GP0 thru 220 Ohms
btfsc GPIO,3 ; Press the pushbutton to begin
goto main ; ...Loop, if the pushbutton is not pressed

clrf COUNT ; The reg COUNT causes the subroutine to loop 255 times.
clrf COUNT1 ; The reg COUNT1 sets the PWM value
clrf PWM_BUF ; The reg PWM_BUF holds the PWM ratio of 'on' to 'off'
bcf GPIO,0 ; Start with the LED turned off
main1
movf COUNT1,W ; Transfer the value in reg COUNT1 to reg PWM_BUF
movwf PWM_BUF
call pwm
incfsz COUNT1,F ; Has COUNT1 counted from 0 to 255?
goto main1 ; ...No, loop again
main2
decf COUNT1,F ; ...Yes, and now COUNT1 holds the decrementing PWM value
main3
movf COUNT1,W ; Transfer the value in reg COUNT1 to reg PWM_BUF
movwf PWM_BUF
call pwm
decfsz COUNT1,F ; Has COUNT1 counted from 255 to 0?
goto main3 ; ...No, loop again
goto main ; ...Yes, start over.
;-----[Subroutines]----------------------------------------------------------
pwm ; This subroutine performs pulse width modulation.
movlw 0xFF ; Move the literal count of 255 to reg 'W'
movwf COUNT ; ...then store it in the register 'COUNT'
pwm1
movf PWM_BUF,F ; Test if the register PWM_BUF is zero
btfsc STATUS,2 ; ...Is PWM_BUF = 0?
goto led_off ; ...No, not yet, skip this instruction for now.
led_on
bsf GPIO,0 ; ...Yes, set GPIO pin-1 high, turn-on the LED
decf PWM_BUF,F ; Decrement the register PWM_BUF
goto exit
led_off
bcf GPIO,0 ; Set GPIO pin-1 low, turn-off the LED
nop
goto exit ;
exit
decfsz COUNT,F ; Has this sobroutine looped 255 times?
goto pwm1 ; ...No, keep looping
retlw 0 ; ...yes, return to the calling program

END ; Directive to end the program

發表於: 2005/7/9 1:09
頂部


Re: 10F2xx, wake on pin change????
資深會員
資深會員


3Q ,,, lar !
笨鴨我 查看 I/O port and wake up from sleep 的細節是有提到 Right before entering SLEEP,read the input pins.

那就是去睡覺前還要做 一件事....

-----> MOVF GPIO,W <------

對吧 ??? 哈...哈... 了解......

發表於: 2005/7/9 0:50
頂部



« 1 ... 27 28 29 (30) 31 32 »



:::

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

教育訓練中心

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